refactor: only install toolchains if necessary, cleaner tests #460
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
name: Test | |
on: | |
push: | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
branches: | |
- main | |
- develop* | |
paths-ignore: | |
- '**.md' | |
schedule: | |
- cron: '0 0 1 * *' | |
jobs: | |
test_latest: | |
name: Test latest versions | |
if: github.event_name != 'schedule' | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-22.04 | |
- ubuntu-20.04 | |
- macos-13 | |
- macos-12 | |
- macos-11 | |
- windows-2022 | |
- windows-2019 | |
toolchain: | |
- {compiler: gcc, version: 13} | |
- {compiler: intel, version: '2023.2'} | |
- {compiler: intel-classic, version: '2021.10'} | |
exclude: | |
# ifx not available for mac | |
- os: macos-13 | |
toolchain: {compiler: intel} | |
- os: macos-12 | |
toolchain: {compiler: intel} | |
- os: macos-11 | |
toolchain: {compiler: intel} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Fortran | |
id: setup-fortran | |
continue-on-error: true | |
uses: ./ | |
with: | |
compiler: ${{ matrix.toolchain.compiler }} | |
version: ${{ matrix.toolchain.version }} | |
- name: Test Fortran compiler | |
if: steps.setup-fortran.outcome == 'success' | |
uses: ./.github/actions/test-fc | |
with: | |
compiler: ${{ matrix.toolchain.compiler }} | |
version: ${{ matrix.toolchain.version }} | |
- name: Test C compiler | |
continue-on-error: true | |
if: steps.setup-fortran.outcome == 'success' | |
uses: ./.github/actions/test-cc | |
with: | |
compiler: ${{ matrix.toolchain.compiler }} | |
version: ${{ matrix.toolchain.version }} | |
- name: Test C++ compiler | |
continue-on-error: true | |
if: steps.setup-fortran.outcome == 'success' | |
uses: ./.github/actions/test-cxx | |
with: | |
compiler: ${{ matrix.toolchain.compiler }} | |
version: ${{ matrix.toolchain.version }} | |
test_full: | |
name: Full compatibility test | |
if: github.event_name == 'schedule' | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-22.04 | |
- ubuntu-20.04 | |
- macos-13 | |
- macos-12 | |
- macos-11 | |
- windows-2022 | |
- windows-2019 | |
toolchain: | |
- {compiler: gcc, version: 13} | |
- {compiler: gcc, version: 12} | |
- {compiler: gcc, version: 11} | |
- {compiler: gcc, version: 10} | |
- {compiler: gcc, version: 9} | |
- {compiler: gcc, version: 8} | |
- {compiler: gcc, version: 7} | |
- {compiler: gcc, version: 6} | |
- {compiler: intel, version: '2023.2'} | |
- {compiler: intel, version: '2023.1'} | |
- {compiler: intel, version: '2023.0'} | |
- {compiler: intel, version: '2022.2.1'} | |
- {compiler: intel, version: '2022.2'} | |
- {compiler: intel, version: '2022.1'} | |
- {compiler: intel, version: '2022.0'} | |
- {compiler: intel, version: '2021.4'} | |
- {compiler: intel, version: '2021.2'} | |
- {compiler: intel, version: '2021.1.2'} | |
- {compiler: intel, version: '2021.1'} | |
- {compiler: intel-classic, version: '2021.10'} | |
- {compiler: intel-classic, version: '2021.9'} | |
- {compiler: intel-classic, version: '2021.8'} | |
- {compiler: intel-classic, version: '2021.7.1'} | |
- {compiler: intel-classic, version: '2021.7'} | |
- {compiler: intel-classic, version: '2021.6'} | |
- {compiler: intel-classic, version: '2021.5'} | |
- {compiler: intel-classic, version: '2021.4'} | |
- {compiler: intel-classic, version: '2021.3'} | |
- {compiler: intel-classic, version: '2021.2'} | |
- {compiler: intel-classic, version: '2021.1.2'} | |
- {compiler: intel-classic, version: '2021.1'} | |
exclude: | |
# ifx not available for mac | |
- os: macos-13 | |
toolchain: {compiler: intel} | |
- os: macos-12 | |
toolchain: {compiler: intel} | |
- os: macos-11 | |
toolchain: {compiler: intel} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Fortran | |
id: setup-fortran | |
continue-on-error: true | |
uses: ./ | |
with: | |
compiler: ${{ matrix.toolchain.compiler }} | |
version: ${{ matrix.toolchain.version }} | |
- name: Test Fortran compiler | |
if: steps.setup-fortran.outcome == 'success' | |
uses: ./.github/actions/test-fc | |
with: | |
compiler: ${{ matrix.toolchain.compiler }} | |
version: ${{ matrix.toolchain.version }} | |
- name: Test C compiler | |
continue-on-error: true | |
if: steps.setup-fortran.outcome == 'success' | |
uses: ./.github/actions/test-cc | |
with: | |
compiler: ${{ matrix.toolchain.compiler }} | |
version: ${{ matrix.toolchain.version }} | |
- name: Test C++ compiler | |
continue-on-error: true | |
if: steps.setup-fortran.outcome == 'success' | |
uses: ./.github/actions/test-cxx | |
with: | |
compiler: ${{ matrix.toolchain.compiler }} | |
version: ${{ matrix.toolchain.version }} | |
- name: Create compatibility report | |
shell: bash | |
run: | | |
mkdir compat | |
support=$([ "${{ steps.setup-fortran.outcome }}" == "success" ] && echo "✓" || echo "") | |
prefix="${{ matrix.os }},${{ matrix.toolchain.compiler }},${{ matrix.toolchain.version }}" | |
report="compat/${prefix//,/_}.csv" | |
echo "$prefix,$support" >> "$report" | |
cat "$report" | |
- name: Upload compatibility report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: compat | |
path: compat/*.csv | |
compat: | |
name: Report compatibility | |
if: github.event_name == 'schedule' | |
needs: test_full | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install packages | |
run: pip install tabulate pandas | |
- name: Download reports | |
uses: actions/download-artifact@v3 | |
with: | |
name: compat | |
path: compat | |
- name: Concatenate reports | |
run: | | |
echo "runner,compiler,version,support" > long_compat.csv | |
cat compat/*.csv >> long_compat.csv | |
- name: Make wide CSV and MD table | |
run: python wide_compat_reports.py "long_compat.csv" "compat.csv" | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: compat | |
path: | | |
compat.csv | |
compat.md | |
- name: Check for changes | |
id: diff | |
run: | | |
if ! [ -f compat.csv ]; then | |
echo "diff=false" >> $GITHUB_OUTPUT | |
exit 0 | |
fi | |
diff=$(git diff compat.csv) | |
if [[ $diff == "" ]]; then | |
echo "No changes found" | |
echo "diff=false" >> $GITHUB_OUTPUT | |
else | |
echo "Changes found:" | |
echo "$diff" | |
echo "diff=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Update README | |
if: ${{ steps.diff.outputs.diff == 'true' && github.event_name == 'push' }} | |
run: python update_compat_table.py "compat.md" "README.md" | |
- name: Print README diff | |
if: ${{ steps.diff.outputs.diff == 'true' && github.event_name == 'push' }} | |
run: git diff README.md | |
- name: Create pull request | |
if: ${{ steps.diff.outputs.diff == 'true' && github.event_name == 'push' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
now=$(date +'%Y-%m-%dT%H-%M-%S') | |
updated_branch="compat_$now" | |
default_branch="${{ github.event.repository.default_branch }}" | |
git switch -c "$updated_branch" | |
git add compat.csv README.md | |
git commit -m "Update compatibility matrix" | |
git push -u origin "$updated_branch" | |
gh pr create -B "$default_branch" -H "$updated_branch" --title "Update compatibility matrix" --body-file compat.md |