flang compiler support #308
This file contains hidden or 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
| name: Build and Test Fortran | |
| on: | |
| push: | |
| branches-ignore: | |
| - "test**" | |
| tags: | |
| - "fortran-test-artifacts*" | |
| pull_request: | |
| jobs: | |
| fortran-test: | |
| runs-on: ubuntu-latest | |
| if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' | |
| && github.event.pull_request.head.repo.full_name != 'cmbant/camb') | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.x" | |
| - name: Install dependencies and build module | |
| run: | | |
| python --version | |
| gfortran --version | |
| python -m pip install -e . | |
| - name: Check failure artifact request | |
| id: failure_artifacts | |
| env: | |
| COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }} | |
| run: | | |
| upload=false | |
| if [[ "${GITHUB_REF}" == refs/tags/fortran-test-artifacts* ]]; then | |
| upload=true | |
| fi | |
| if git log -1 --pretty=%B "${COMMIT_SHA}" | grep -qi '\[fortran-test-artifacts\]'; then | |
| upload=true | |
| fi | |
| echo "upload=${upload}" >> "${GITHUB_OUTPUT}" | |
| - name: Run Build and Test Script | |
| run: python fortran/tests/run_tests.py --reference_branch v2 --verbose_diff_output | |
| - name: Upload Test Files on Failure | |
| if: failure() && steps.failure_artifacts.outputs.upload == 'true' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: test-output-${{ github.sha }} | |
| path: fortran/testfiles/ | |
| if-no-files-found: warn | |
| retention-days: 7 | |
| - name: Skip Failure Artifact Upload | |
| if: failure() && steps.failure_artifacts.outputs.upload != 'true' | |
| run: | | |
| echo "Skipping fortran/testfiles upload." | |
| echo "Add [fortran-test-artifacts] to the commit message or push a fortran-test-artifacts* tag to request it." |