From 681767f9d26e14cadf9b1a095506c7925821fe96 Mon Sep 17 00:00:00 2001 From: ddundo Date: Sun, 15 Sep 2024 08:21:48 +0000 Subject: [PATCH] Expand if condn for PR and push to main --- .github/workflows/test_suite.yml | 80 ++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 .github/workflows/test_suite.yml diff --git a/.github/workflows/test_suite.yml b/.github/workflows/test_suite.yml new file mode 100644 index 0000000..b2e9630 --- /dev/null +++ b/.github/workflows/test_suite.yml @@ -0,0 +1,80 @@ +name: 'Run Goalie test suite' + +on: + # Run test suite whenever main is updated + push: + branches: + - main + + # Run test suite whenever commits are pushed to an open PR + pull_request: + + # Run test suite every Sunday at 1AM + schedule: + - cron: '0 1 * * 0' + +concurrency: + # Cancel jobs running if new commits are pushed + group: > + ${{ github.workflow }}- + ${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build: + name: 'Test suite' + runs-on: ubuntu-latest + container: + image: ghcr.io/mesh-adaptation/firedrake-parmmg:latest + options: --user root + steps: + - name: 'Check out the repo' + id: checkout + uses: actions/checkout@v4 + + - name: 'Determine files differing from target branch' + id: changed-files + if: ${{ github.event_name != 'push' || github.ref != 'refs/heads/main' }} + uses: tj-actions/changed-files@v44 + with: + files: | + .github/workflows/test_suite.yml + *.py + *.msh + *.geo + + - name: 'Cleanup' + if: ${{ always() }} + run: | + cd .. + rm -rf build + + - name: 'Setup Python' + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' || steps.changed-files.outcome == 'success' && steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'schedule' }} + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: 'Install Goalie' + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' || steps.changed-files.outcome == 'success' && steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'schedule' }} + run: | + . /home/firedrake/firedrake/bin/activate + python -m pip uninstall -y goalie + python -m pip install -e . + + - name: 'Lint' + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' || steps.changed-files.outcome == 'success' && steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'schedule' }} + run: | + . /home/firedrake/firedrake/bin/activate + make lint + + - name: 'Test Goalie' + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' || steps.changed-files.outcome == 'success' && steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'schedule' }} + run: | + . /home/firedrake/firedrake/bin/activate + python $(which firedrake-clean) + export GITHUB_ACTIONS_TEST_RUN=1 + python -m coverage erase + python -m coverage run -a --source=goalie -m pytest -v --durations=20 test + python -m coverage run -a --source=goalie -m pytest -v --durations=10 test_adjoint + python -m coverage report