Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
172 changes: 75 additions & 97 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,72 +40,45 @@ jobs:
- {compiler: gcc, version: 8}
- {compiler: gcc, version: 7}
- {compiler: gcc, version: 6}
include:
- {os: ubuntu-20.04, toolchain: {compiler: intel, version: '2023.2'}}
- {os: ubuntu-20.04, toolchain: {compiler: intel, version: '2022.2.1'}}
- {os: ubuntu-20.04, toolchain: {compiler: intel, version: '2021.4'}}

- {os: ubuntu-22.04, toolchain: {compiler: intel, version: '2023.2'}}
# {os: ubuntu-22.04, toolchain: {compiler: intel, version: '2023.1'}}
# {os: ubuntu-22.04, toolchain: {compiler: intel, version: '2023.0'}}
- {os: ubuntu-22.04, toolchain: {compiler: intel, version: '2022.2.1'}}
# {os: ubuntu-22.04, toolchain: {compiler: intel, version: '2022.2'}}
# {os: ubuntu-22.04, toolchain: {compiler: intel, version: '2022.1'}}
# {os: ubuntu-22.04, toolchain: {compiler: intel, version: '2022.0'}}
- {os: ubuntu-22.04, toolchain: {compiler: intel, version: '2021.4'}}
# {os: ubuntu-22.04, toolchain: {compiler: intel, version: '2021.3'}}
# {os: ubuntu-22.04, toolchain: {compiler: intel, version: '2021.2'}}
# {os: ubuntu-22.04, toolchain: {compiler: intel, version: '2021.1.2'}}
# {os: ubuntu-22.04, toolchain: {compiler: intel, version: '2021.1'}}

- {os: ubuntu-20.04, toolchain: {compiler: intel-classic, version: '2021.10'}}
- {os: ubuntu-20.04, toolchain: {compiler: intel-classic, version: '2021.7.1'}}
- {os: ubuntu-20.04, toolchain: {compiler: intel-classic, version: '2021.4'}}

- {os: ubuntu-22.04, toolchain: {compiler: intel-classic, version: '2021.10'}}
# {os: ubuntu-22.04, toolchain: {compiler: intel-classic, version: '2021.9'}}
# {os: ubuntu-22.04, toolchain: {compiler: intel-classic, version: '2021.8'}}
- {os: ubuntu-22.04, toolchain: {compiler: intel-classic, version: '2021.7.1'}}
# {os: ubuntu-22.04, toolchain: {compiler: intel-classic, version: '2021.7'}}
# {os: ubuntu-22.04, toolchain: {compiler: intel-classic, version: '2021.6'}}
# {os: ubuntu-22.04, toolchain: {compiler: intel-classic, version: '2021.5'}}
- {os: ubuntu-22.04, toolchain: {compiler: intel-classic, version: '2021.4'}}
# {os: ubuntu-22.04, toolchain: {compiler: intel-classic, version: '2021.3'}}
# {os: ubuntu-22.04, toolchain: {compiler: intel-classic, version: '2021.2'}}
# {os: ubuntu-22.04, toolchain: {compiler: intel-classic, version: '2021.1.2'}}
# {os: ubuntu-22.04, toolchain: {compiler: intel-classic, version: '2021.1'}}

- {os: macos-12, toolchain: {compiler: intel-classic, version: '2021.10'}}
# {os: macos-12, toolchain: {compiler: intel-classic, version: '2021.9'}}
# {os: macos-12, toolchain: {compiler: intel-classic, version: '2021.8'}}
- {os: macos-12, toolchain: {compiler: intel-classic, version: '2021.7.1'}}
# {os: macos-12, toolchain: {compiler: intel-classic, version: '2021.7'}}
# {os: macos-12, toolchain: {compiler: intel-classic, version: '2021.6'}}
# {os: macos-12, toolchain: {compiler: intel-classic, version: '2021.5'}}
- {os: macos-12, toolchain: {compiler: intel-classic, version: '2021.4'}}
# {os: macos-12, toolchain: {compiler: intel-classic, version: '2021.3'}}
# {os: macos-12, toolchain: {compiler: intel-classic, version: '2021.2'}}
# {os: macos-12, toolchain: {compiler: intel-classic, version: '2021.1'}}

- {os: windows-2022, toolchain: {compiler: intel, version: '2023.2.0'}}
- {os: windows-2022, toolchain: {compiler: intel, version: '2023.1.0'}}
- {os: windows-2022, toolchain: {compiler: intel, version: '2023.0.0'}}
- {os: windows-2022, toolchain: {compiler: intel, version: '2022.2.0'}}
- {os: windows-2022, toolchain: {compiler: intel, version: '2022.1.0'}}

- {os: windows-2022, toolchain: {compiler: intel-classic, version: '2021.10.0'}}
- {os: windows-2022, toolchain: {compiler: intel-classic, version: '2021.9.0'}}
- {os: windows-2022, toolchain: {compiler: intel-classic, version: '2021.8.0'}}
- {os: windows-2022, toolchain: {compiler: intel-classic, version: '2021.7.0'}}
- {os: windows-2022, toolchain: {compiler: intel-classic, version: '2021.6.0'}}
- {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@v3

- name: Setup Fortran
continue-on-error: ${{ matrix.toolchain.compiler == 'gcc' }}
continue-on-error: true
id: setup-fortran
uses: ./
with:
Expand All @@ -118,36 +91,45 @@ jobs:
env:
FC: ${{ steps.setup-fortran.outputs.fc }}
CC: ${{ steps.setup-fortran.outputs.cc }}
CXX: ${{ steps.setup-fortran.outputs.cxx }}
run: |
if ([ "$RUNNER_OS" == "Windows" ] && [[ "${{ matrix.toolchain.compiler }}" =~ "intel" ]]); then
# only last line of output captured by command substitution, write to temp file instead
${{ env.FC }} //QV > "$RUNNER_TEMP/${{ env.FC }}.ver" 2>&1
${{ env.CC }} //QV > "$RUNNER_TEMP/${{ env.CC }}.ver" 2>&1
${{ env.CXX }} //QV > "$RUNNER_TEMP/${{ env.CXX }}.ver" 2>&1

fcv=$(cat "$RUNNER_TEMP/${{ env.FC }}.ver" | head -n 1)
ccv=$(cat "$RUNNER_TEMP/${{ env.CC }}.ver" | head -n 1)
cxxv=$(cat "$RUNNER_TEMP/${{ env.CXX }}.ver" | head -n 1)

fcv=${fcv#*Version }
fcv=${fcv%% Build*}
ccv=${ccv#*Version }
ccv=${ccv%% Build*}
cxxv=${cxxv#*Version }
cxxv=${cxxv%% Build*}
else
fcv=$(${{ env.FC }} --version | head -n 1)
ccv=$(${{ env.CC }} --version | head -n 1)
cxxv=$(${{ env.CXX }} --version | head -n 1)

fcv=$(echo "$fcv" | grep -woE '[0123456789.]+' | head -n 1)
ccv=$(echo "$ccv" | grep -woE '[0123456789.]+' | head -n 1)
cxxv=$(echo "$cxxv" | grep -woE '[0123456789.]+' | head -n 1)
fi

[[ "$fcv" == ${{ matrix.toolchain.version }}* ]] && (echo "found ${{ env.FC }} version: $fcv") || (echo "unexpected ${{ env.FC }} version: $fcv"; exit 1)
[[ "$ccv" == ${{ matrix.toolchain.version }}* ]] && (echo "found ${{ env.CC }} version: $ccv") || (echo "unexpected ${{ env.CC }} version: $ccv"; exit 1)
[[ "$cxxv" == ${{ matrix.toolchain.version }}* ]] && (echo "found ${{ env.CXX }} version: $cxxv") || (echo "unexpected ${{ env.CXX }} version: $cxxv"; exit 1)

- name: Test compile program (bash)
- name: Test compile Fortran (bash)
if: steps.setup-fortran.outcome == 'success'
shell: bash
env:
FC: ${{ steps.setup-fortran.outputs.fc }}
CC: ${{ steps.setup-fortran.outputs.cc }}
CXX: ${{ steps.setup-fortran.outputs.cxx }}
run: |
# macos-13 / gcc 7-9 compatibility workaround
args=""
Expand All @@ -159,20 +141,21 @@ jobs:
args="-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib"
fi
fi
args="$args -o hw hw.f90"
args="$args -o hw"

${{ env.FC }} $args
${{ env.FC }} $args hw.f90
output=$(./hw '2>&1')
[[ "$output" == *"hello world"* ]] && echo "$output" || (echo "Unexpected output: $output"; exit 1)
[[ "$output" == *"hello world"* ]] && echo "$output" || (echo "Unexpected Fortran program output: $output"; exit 1)
rm hw

- name: Test compile program (Powershell Core)
- name: Test compile Fortran (pwsh)
if: ${{ steps.setup-fortran.outcome == 'success' && runner.os == 'Windows' }}
shell: pwsh
env:
FC: ${{ steps.setup-fortran.outputs.fc }}
CC: ${{ steps.setup-fortran.outputs.cc }}
CXX: ${{ steps.setup-fortran.outputs.cxx }}
run: |
rm hw.exe
${{ env.FC }} -o hw.exe hw.f90
$output=$(& ".\hw.exe")
if ($output -match "hello world") {
Expand All @@ -181,15 +164,16 @@ jobs:
write-output "unexpected output: $output"
exit 1
}
rm hw.exe

- name: Test compile program (Powershell Desktop)
- name: Test compile Fortran (powershell)
if: ${{ steps.setup-fortran.outcome == 'success' && runner.os == 'Windows' }}
shell: powershell
env:
FC: ${{ steps.setup-fortran.outputs.fc }}
CC: ${{ steps.setup-fortran.outputs.cc }}
CXX: ${{ steps.setup-fortran.outputs.cxx }}
run: |
rm hw.exe
${{ env.FC }} -o hw.exe hw.f90
$output=$(& ".\hw.exe")
if ($output -match "hello world") {
Expand All @@ -198,15 +182,16 @@ jobs:
write-output "unexpected output: $output"
exit 1
}
rm hw.exe

- name: Test compile program (cmd)
- name: Test compile Fortran (cmd)
if: ${{ steps.setup-fortran.outcome == 'success' && runner.os == 'Windows' }}
shell: cmd
env:
FC: ${{ steps.setup-fortran.outputs.fc }}
CC: ${{ steps.setup-fortran.outputs.cc }}
CXX: ${{ steps.setup-fortran.outputs.cxx }}
run: |
del hw.exe
${{ env.FC }} -o hw.exe hw.f90
for /f "tokens=* usebackq" %%f in (`.\hw.exe`) do @set "OUTPUT=%%f"
if "%OUTPUT%"=="hello world" (
Expand All @@ -215,6 +200,7 @@ jobs:
echo unexpected output: %OUTPUT%
exit 1
)
del hw.exe

- name: Create compatibility report
shell: bash
Expand All @@ -230,12 +216,25 @@ jobs:
echo "$prefix,$support" >> "compat/${prefix//,/_}.csv"

- name: Upload compatibility report
if: ${{ matrix.toolchain.compiler == 'gcc' }}
uses: actions/upload-artifact@v3
with:
name: compat
path: compat/*.csv

- name: Test compile C/C++ (bash)
continue-on-error: true
shell: bash
run: |
${{ env.CC }} -o hw hw.c
output=$(./hw '2>&1')
[[ "$output" == *"hello world"* ]] && echo "$output" || (echo "Unexpected C program output: $output"; exit 1)
rm hw

${{ env.CXX }} -o hw hw.cpp
output=$(./hw '2>&1')
[[ "$output" == *"hello world"* ]] && echo "$output" || (echo "Unexpected C++ program output: $output"; exit 1)
rm hw

compat:
name: Report compatibility
needs: test
Expand All @@ -254,8 +253,7 @@ jobs:
python-version: 3.9

- name: Install packages
run: |
pip install tabulate pandas
run: pip install tabulate pandas

- name: Download reports
uses: actions/download-artifact@v3
Expand All @@ -265,20 +263,11 @@ jobs:

- name: Concatenate reports
run: |
echo "runner,compiler,version,support" > compat_long.csv
cat compat/*.csv >> compat_long.csv
echo "runner,compiler,version,support" > long_compat.csv
cat compat/*.csv >> long_compat.csv

- name: Make wide CSV and MD table
id: merge-reports
shell: python
run: |
import pandas as pd
df = pd.read_csv("compat_long.csv")
df = pd.pivot(df, index="runner", columns="version", values="support")
df = df.sort_values(by=["runner"])
df.to_csv("compat.csv")
with open("compat.md", "w") as file:
file.write(df.to_markdown().replace("nan", ""))
run: python wide_compat_reports.py "long_compat.csv" "compat.csv"

- name: Upload artifacts
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -308,22 +297,11 @@ jobs:

- name: Update README
if: ${{ steps.diff.outputs.diff == 'true' && github.event_name == 'push' }}
shell: python
run: |
import re
from pathlib import Path
readme_path = Path("README.md")
readme = readme_path.open().read()
with open("compat.md", "r") as compat:
table = ''.join(compat.readlines())
r = re.compile(r'<!\-\- compat starts \-\->.*<!\-\- compat ends \-\->', re.DOTALL)
chunk = '<!-- compat starts -->{}<!-- compat ends -->'.format('\n{}\n'.format(table))
readme_path.open('w').write(r.sub(chunk, readme))
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
run: git diff README.md

- name: Create pull request
if: ${{ steps.diff.outputs.diff == 'true' && github.event_name == 'push' }}
Expand Down
Loading