Skip to content

Add support for Intel compiler #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
80 changes: 62 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,66 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-20.04, macos-12, macos-11, windows-2022, windows-2019]
compiler: [gcc]
version: [12, 11, 10, 9, 8, 7, 6, 5]
toolchain:
- {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: gcc, version: 5}
include:
- {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-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.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'}}

steps:

- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Fortran
continue-on-error: true
continue-on-error: ${{ matrix.toolchain.compiler == 'gcc' }}
id: setup-fortran
uses: ./
with:
compiler: ${{ matrix.compiler }}
version: ${{ matrix.version }}
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}

- name: Check compiler version
if: steps.setup-fortran.outcome == 'success'
if: ${{ steps.setup-fortran.outcome == 'success' }}
shell: bash
env:
FC: ${{ steps.setup-fortran.outputs.fc }}
Expand All @@ -48,14 +91,14 @@ jobs:
echo $fcv
echo $ccv

fcv=$(echo "${fcv##*)}" | xargs)
ccv=$(echo "${ccv##*)}" | xargs)
fcv=$(echo "$fcv" | grep -woE '[0123456789.]+' | head -n 1)
ccv=$(echo "$ccv" | grep -woE '[0123456789.]+' | head -n 1)

[[ $fcv == ${{ matrix.version }}* ]] || (echo "unexpected Fortran compiler version: $fcv"; exit 1)
[[ $ccv == ${{ matrix.version }}* ]] || (echo "unexpected C compiler version: $ccv"; exit 1)
[[ $fcv == ${{ matrix.toolchain.version }}* ]] || (echo "unexpected Fortran compiler version: $fcv"; exit 1)
[[ $ccv == ${{ matrix.toolchain.version }}* ]] || (echo "unexpected C compiler version: $ccv"; exit 1)

- name: Test compile program (bash)
if: steps.setup-fortran.outcome == 'success'
if: ${{ steps.setup-fortran.outcome == 'success' }}
shell: bash
env:
FC: ${{ steps.setup-fortran.outputs.fc }}
Expand All @@ -66,7 +109,7 @@ jobs:
[[ "$output" == *"hello world"* ]] && echo "$output" || (echo "Unexpected output: $output"; exit 1)

- name: Test compile program (Powershell Core)
if: steps.setup-fortran.outcome == 'success' && runner.os == 'Windows'
if: ${{ steps.setup-fortran.outcome == 'success' && runner.os == 'Windows' }}
shell: pwsh
env:
FC: ${{ steps.setup-fortran.outputs.fc }}
Expand All @@ -83,7 +126,7 @@ jobs:
}

- name: Test compile program (Powershell Desktop)
if: steps.setup-fortran.outcome == 'success' && runner.os == 'Windows'
if: ${{ steps.setup-fortran.outcome == 'success' && runner.os == 'Windows' }}
shell: powershell
env:
FC: ${{ steps.setup-fortran.outputs.fc }}
Expand All @@ -100,7 +143,7 @@ jobs:
}

- name: Test compile program (cmd)
if: steps.setup-fortran.outcome == 'success' && runner.os == 'Windows'
if: ${{ steps.setup-fortran.outcome == 'success' && runner.os == 'Windows' }}
shell: cmd
env:
FC: ${{ steps.setup-fortran.outputs.fc }}
Expand All @@ -126,10 +169,11 @@ jobs:
fi

mkdir compat
prefix="${{ matrix.os }},${{ matrix.compiler }},${{ matrix.version }}"
prefix="${{ matrix.os }},${{ matrix.toolchain.compiler }},${{ matrix.toolchain.version }}"
echo "$prefix,$support" >> "compat/${prefix//,/_}.csv"

- name: Upload compatibility report
if: ${{ matrix.toolchain.compiler == 'gcc' }}
uses: actions/upload-artifact@v3
with:
name: compat
Expand Down Expand Up @@ -206,7 +250,7 @@ jobs:
fi

- name: Update README
if: steps.diff.outputs.diff == 'true' && github.event_name == 'push'
if: ${{ steps.diff.outputs.diff == 'true' && github.event_name == 'push' }}
shell: python
run: |
import re
Expand All @@ -220,12 +264,12 @@ jobs:
readme_path.open('w').write(r.sub(chunk, readme))

- name: Print README diff
if: steps.diff.outputs.diff == 'true' && github.event_name == 'push'
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'
if: ${{ steps.diff.outputs.diff == 'true' && github.event_name == 'push' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand Down
46 changes: 35 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,39 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
toolchain:
- {compiler: gcc, version: 11}
- {compiler: intel-classic, version: '2021.9'}
include:
- os: ubuntu-latest
toolchain: {compiler: intel, version: '2023.1'}
exclude:
- os: windows-latest
toolchain: {compiler: intel-classic, version: '2021.9'}

steps:
- uses: awvwgk/setup-fortran@main
id: setup-fortran
with:
compiler: gcc
version: 11

- run: ${{ env.FC }} --version
env:
FC: ${{ steps.setup-fortran.outputs.fc }}
- uses: awvwgk/setup-fortran@v1
id: setup-fortran
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}

- run: ${{ env.FC }} --version
env:
FC: ${{ steps.setup-fortran.outputs.fc }}
```


## Options

- *compiler*: Compiler toolchain to setup, available options are *gcc*
- *version*: Version of the compiler toolchain, available options for *gcc* are *5-12*
- *compiler*: Compiler toolchain to setup, available options are
- *gcc* (for `gfortran`)
- *intel* (for `ifx`)
- *intel-classic* (for `ifort`)
- *version*: Version of the compiler toolchain, available options are
- *5–12* for *gcc*
- *2021.1–2023.1* for *intel*
- *2021.1–2021.9* for *intel-classic*


## Outputs
Expand Down Expand Up @@ -83,6 +98,15 @@ Support for the GCC toolchain varies across GitHub-hosted runner images.
<!-- compat ends -->


Supported Intel toolchains:

| runner | compiler | version |
| :-------- | :------------- | :------ |
| ubuntu-\* | intel | 2023.1, 2023.0, <br/> 2022.2.1, 2022.2, 2022.1, 2022.0, <br/> 2021.4, 2021.3, 2021.2, 2021.1.2, 2021.1 |
| ubuntu-\* | intel-classic | 2021.9, 2021.8, <br/> 2021.7.1, 2021.7, 2021.6, 2021.5, <br/> 2021.4, 2021.3, 2021.2, 2021.1.2, 2021.1 |
| macos-\* | intel-classic | 2021.9, 2021.8, <br/> 2021.7.1, 2021.7, 2021.6, 2021.5, <br/> 2021.4, 2021.3, 2021.2, 2021.1 |


## License

Licensed under the Apache License, Version 2.0 (the “License”);
Expand Down
27 changes: 7 additions & 20 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,30 +34,17 @@ runs:
case $compiler in
gcc)
version=${VERSION:-11}
install_gcc $platform
;;
*)
exit 1
;;
esac

case $platform in
linux*)
install_gcc_apt
;;
darwin*)
install_gcc_brew
;;
mingw*)
install_gcc_choco
;;
msys*)
install_gcc_choco
intel-classic)
version=${VERSION:-2023.1.0}
install_intel $platform true
;;
cygwin*)
install_gcc_choco
intel)
version=${VERSION:-2023.1.0}
install_intel $platform false
;;
*)
echo "Unsupported platform: $platform"
exit 1
;;
esac
Expand Down
Loading