YAML · 1892 bytes Raw Blame History
1 name: CI
2
3 on:
4 push:
5 branches:
6 - trunk
7 pull_request:
8
9 permissions:
10 contents: read
11
12 env:
13 FPM_VERSION: "0.13.0"
14
15 jobs:
16 test:
17 name: Test (${{ matrix.os }})
18 runs-on: ${{ matrix.os }}
19 strategy:
20 fail-fast: false
21 matrix:
22 os:
23 - ubuntu-latest
24 - macos-latest
25
26 steps:
27 - name: Check out repository
28 uses: actions/checkout@v6
29
30 - name: Set up Linux Fortran toolchain
31 if: runner.os != 'macOS'
32 run: |
33 sudo apt-get update
34 sudo apt-get install -y gfortran gcc g++
35 echo "FC=$(command -v gfortran)" >> "$GITHUB_ENV"
36 echo "CC=$(command -v gcc)" >> "$GITHUB_ENV"
37 echo "CXX=$(command -v g++)" >> "$GITHUB_ENV"
38
39 - name: Set up macOS Fortran toolchain
40 if: runner.os == 'macOS'
41 uses: fortran-lang/setup-fortran@v1
42 with:
43 compiler: gcc
44 version: latest
45
46 - name: Install fpm from official release
47 if: runner.os != 'macOS'
48 run: |
49 asset="fpm-${FPM_VERSION}-linux-x86_64-gcc-12"
50 curl -fsSLo "${asset}" "https://github.com/fortran-lang/fpm/releases/download/v${FPM_VERSION}/${asset}"
51 curl -fsSLo "${asset}.sha256" "https://github.com/fortran-lang/fpm/releases/download/v${FPM_VERSION}/${asset}.sha256"
52 shasum -a 256 -c "${asset}.sha256"
53 chmod +x "${asset}"
54 mv "${asset}" fpm
55 echo "${PWD}" >> "$GITHUB_PATH"
56
57 - name: Install fpm with Homebrew
58 if: runner.os == 'macOS'
59 run: |
60 brew tap fortran-lang/homebrew-fortran
61 brew install fpm
62
63 - name: Show tool versions
64 run: |
65 fpm --version
66 "$FC" --version
67 "$CC" --version
68
69 - name: Run test suite
70 run: fpm test --verbose
71
72 - name: Run examples
73 run: fpm run --example --all
74