Skip to content

Commit

Permalink
use setup-fortran
Browse files Browse the repository at this point in the history
  • Loading branch information
perazz committed Jul 22, 2024
1 parent 0d9da44 commit f7dafdc
Showing 1 changed file with 26 additions and 52 deletions.
78 changes: 26 additions & 52 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,63 +21,37 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-11, windows-latest]
gcc_v: [10,11,12] # Version of GFortran we want to use.
os: [ubuntu-latest, macos-12, windows-latest]
toolchain:
- {compiler: gcc, version: 10}
- {compiler: gcc, version: 11}
- {compiler: gcc, version: 12}
- {compiler: gcc, version: 13}
exclude:
- os: macos-12
toolchain: {compiler: gcc, version: 13}
include:
- os: ubuntu-latest
os-arch: linux-x86_64
release-flags: --flag '--static -g -fbacktrace -O3'

- os: macos-11
os-arch: macos-x86_64
release-flags: --flag '-g -fbacktrace -O3'

- os: windows-latest
os-arch: windows-x86_64
release-flags: --flag '--static -g -fbacktrace -O3'
exe: .exe

env:
FC: gfortran
GCC_V: ${{ matrix.gcc_v }}
- os: ubuntu-latest
os-arch: linux-x86_64
release-flags: --flag '--static -g -fbacktrace -O3'
- os: macos-12
os-arch: macos-x86_64
release-flags: --flag '-g -fbacktrace -O3'
- os: windows-latest
os-arch: windows-x86_64
release-flags: --flag '--static -g -fbacktrace -O3'
exe: .exe

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install GFortran macOS
if: contains(matrix.os, 'macos')
run: |
ln -s /usr/local/bin/gfortran-${GCC_V} /usr/local/bin/gfortran
which gfortran-${GCC_V}
which gfortran
# Backport gfortran shared libraries to version 9 folder. This is necessary because all macOS releases of fpm
# have these paths hardcoded in the executable (no PIC?). As the gcc ABIs have not changed from 9 to 10, we
# can just create symbolic links for now. This can be removed when an updated fpm release is built with gcc-10
mkdir /usr/local/opt/gcc@9
mkdir /usr/local/opt/gcc@9/lib
mkdir /usr/local/opt/gcc@9/lib/gcc
mkdir /usr/local/opt/gcc@9/lib/gcc/9
mkdir /usr/local/lib/gcc/9
ln -fs /usr/local/opt/gcc@${GCC_V}/lib/gcc/${GCC_V}/libquadmath.0.dylib /usr/local/opt/gcc@9/lib/gcc/9/libquadmath.0.dylib
ln -fs /usr/local/opt/gcc@${GCC_V}/lib/gcc/${GCC_V}/libgfortran.5.dylib /usr/local/opt/gcc@9/lib/gcc/9/libgfortran.5.dylib
ln -fs /usr/local/lib/gcc/${GCC_V}/libgcc_s.1.dylib /usr/local/lib/gcc/9/libgcc_s.1.dylib
- name: Install GFortran Linux
if: contains(matrix.os, 'ubuntu')
run: |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \
--slave /usr/bin/gcov gcov /usr/bin/gcov-${GCC_V}
- name: Install GFortran Windows
if: contains(matrix.os, 'windows')
run: |
Invoke-WebRequest -Uri $Env:GCC_DOWNLOAD -OutFile mingw-w64.zip
Expand-Archive mingw-w64.zip
echo "$pwd\mingw-w64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
env:
GCC_DOWNLOAD: "https://github.com/brechtsanders/winlibs_mingw/releases/download/10.4.0-10.0.0-msvcrt-r1/winlibs-x86_64-posix-seh-gcc-10.4.0-mingw-w64msvcrt-10.0.0-r1.zip"
- name: Setup Fortran compiler
uses: fortran-lang/setup-fortran@v1.6.1
id: setup-fortran
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}

# Phase 1: Bootstrap fpm with existing version
- name: Install fpm
Expand Down Expand Up @@ -173,7 +147,7 @@ jobs:
rm -v ${{ env.FPM }}
echo "FPM_RELEASE=${{ env.EXE }}" >> $GITHUB_ENV
env:
EXE: fpm-${{ env.VERSION }}-${{ matrix.os-arch }}-gcc-${{ matrix.gcc_v }}${{ matrix.exe }}
EXE: fpm-${{ env.VERSION }}-${{ matrix.os-arch }}-gcc-${{ matrix.toolchain.version }}${{ matrix.exe }}

- name: Run release version
shell: bash
Expand Down

0 comments on commit f7dafdc

Please sign in to comment.