ci: improve tests_local workflow #104
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# yamllint disable | |
name: tests_local | |
on: | |
schedule: | |
- cron: '0 1 * * *' | |
pull_request: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
env: | |
# Set TEST_TIMING_OPTION if local test should be timed. Default is off. | |
TEST_TIMING_OPTION: "" | |
jobs: | |
run_tests: | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/4c-multiphysics/4c:latest | |
options: --user root --env OMPI_ALLOW_RUN_AS_ROOT=1 --env OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install rsync | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y rsync | |
- name: Create links to 4C | |
run: | | |
ln -s /home/user/4C/build/4C config/4C | |
ln -s /home/user/4C/build/post_ensight config/post_ensight | |
ln -s /home/user/4C/build/post_processor config/post_processor | |
- name: Create Python environment | |
id: environment | |
uses: ./.github/actions/create_python_environment | |
- name: Get Python package manager | |
run: echo "PYTHON_PACKAGE_MANAGER=${{steps.environment.outputs.ppm}}" >> $GITHUB_ENV | |
- name: Codechecks | |
run: | | |
$PYTHON_PACKAGE_MANAGER activate queens | |
echo "::group::Run isort..." | |
isort --check-only queens tests | |
echo "::endgroup::" | |
echo "::group::Run black..." | |
black --check queens tests | |
echo "::endgroup::" | |
echo "::group::Run pylint..." | |
pylint --rcfile=.pylintrc_ci queens tests | |
# pylint queens tests --rcfile=.pylintrc --output-format=json:pylint_warnings.json --fail-under 0 | |
echo "::endgroup::" | |
# echo "::group::Create code quality report..." | |
# python .gitlab/pipeline_utils/code_quality_creator.py pylint_warnings.json | |
# pydocstyle --match-dir='^(?!.*test).*$' queens | |
# echo "::endgroup::" | |
echo "::group::Create an rc file for the license header check..." | |
python .gitlab/pipeline_utils/create_licenserc.py --template_file ".gitlab/pipeline_utils/.licenserc_template.yaml" --text_file "license_header.tmpl" --output_file ".licenserc.yaml" --placeholder "license_header" | |
echo "::endgroup::" | |
- name: Check License headers | |
uses: apache/skywalking-eyes/[email protected] | |
- name: Run pytest | |
run: | | |
$PYTHON_PACKAGE_MANAGER activate queens | |
pytest -v -m "unit_tests or integration_tests or integration_tests_fourc" --cov --cov-report=term --cov-report=html:html_coverage_report --cov-report=xml:xml_coverage_report.xml $TEST_TIMING_OPTION --color=yes -o junit_logging=all --junitxml=test_junit.xml | |
- name: Upload coverage report | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: html_coverage_report | |
retention-days: 7 | |
- name: Publish junit pytest report | |
uses: mikepenz/action-junit-report@v5 | |
if: success() || failure() # always run even if the previous step fails | |
with: | |
report_paths: "test_junit.xml" | |
annotate_only: true | |
detailed_summary: true |