Skip to content

Commit 47bb7bf

Browse files
authored
Merge pull request #20 from awvwgk/ci
Update CI to run on MacOS and Windows
2 parents 0c75850 + 60690ff commit 47bb7bf

File tree

1 file changed

+59
-16
lines changed

1 file changed

+59
-16
lines changed

.github/workflows/CI.yml

Lines changed: 59 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,56 @@
11
name: CI
2-
on: [push]
3-
jobs:
2+
on: [push, pull_request]
43

4+
jobs:
55
Build:
6+
runs-on: ${{ matrix.os }}
7+
strategy:
8+
fail-fast: false
9+
matrix:
10+
os: [ubuntu-latest, macos-latest, windows-latest]
11+
gcc: [10] # Version of GFortran we want to use.
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
with:
17+
submodules: recursive
18+
19+
- name: Install GFortran (MacOS)
20+
if: ${{ contains(matrix.os, 'macos') }}
21+
run: |
22+
brew install gcc@${{ matrix.gcc }}
23+
ln -s /usr/local/bin/gfortran-${{ matrix.gcc }} /usr/local/bin/gfortran
24+
25+
- name: Install GFortran (Linux)
26+
if: ${{ contains(matrix.os, 'ubuntu') }}
27+
run: |
28+
sudo update-alternatives \
29+
--install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.gcc }} 100 \
30+
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${{ matrix.gcc }} \
31+
--slave /usr/bin/gcov gcov /usr/bin/gcov-${{ matrix.gcc }}
32+
33+
- name: Install GFortran (Windows)
34+
if: ${{ contains(matrix.os, 'windows') }}
35+
run: |
36+
Invoke-WebRequest -Uri ${{ env.DOWNLOAD }} -OutFile mingw-w64.zip
37+
Expand-Archive mingw-w64.zip
38+
echo "$pwd\mingw-w64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
39+
env:
40+
DOWNLOAD: "https://github.com/brechtsanders/winlibs_mingw/releases/download/10.3.0-12.0.0-9.0.0-r2/winlibs-x86_64-posix-seh-gcc-10.3.0-mingw-w64-9.0.0-r2.zip"
41+
42+
- name: Setup Fortran Package Manager
43+
uses: fortran-lang/setup-fpm@v3
44+
with:
45+
github-token: ${{ secrets.GITHUB_TOKEN }}
46+
47+
- name: Compile
48+
run: fpm build --profile release
49+
50+
- name: Run test
51+
run: fpm test
52+
53+
Docs:
654
runs-on: ${{ matrix.os }}
755
strategy:
856
fail-fast: false
@@ -15,6 +63,12 @@ jobs:
1563
GCC_V: ${{ matrix.gcc_v }}
1664

1765
steps:
66+
- id: deploy-on-push
67+
run:
68+
echo "::set-output name=result::${{ env.DEPLOY_BRANCH }}"
69+
env:
70+
DEPLOY_BRANCH: ${{ secrets.DEPLOY_BRANCH && contains(github.ref, secrets.DEPLOY_BRANCH) && 1 || 0 }}
71+
1872
- name: Checkout code
1973
uses: actions/checkout@v2
2074
with:
@@ -28,20 +82,15 @@ jobs:
2882
- name: Setup Graphviz
2983
uses: ts-graphviz/setup-graphviz@v1
3084

31-
- name: Setup Fortran Package Manager
32-
uses: fortran-lang/setup-fpm@v3
33-
with:
34-
github-token: ${{ secrets.GITHUB_TOKEN }}
35-
3685
- name: Install Python dependencies
37-
if: contains( matrix.os, 'ubuntu')
86+
if: ${{ contains( matrix.os, 'ubuntu') }}
3887
run: |
3988
python -m pip install --upgrade pip
4089
pip install numpy matplotlib ford
4190
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
4291
4392
- name: Install GFortran Linux
44-
if: contains( matrix.os, 'ubuntu')
93+
if: ${{ contains( matrix.os, 'ubuntu') }}
4594
run: |
4695
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
4796
sudo apt-get update
@@ -50,17 +99,11 @@ jobs:
5099
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \
51100
--slave /usr/bingcov gcov /usr/bin/gcov-${GCC_V}
52101
53-
- name: Compile
54-
run: fpm build --profile release
55-
56-
- name: Run test
57-
run: fpm test
58-
59102
- name: Build documentation
60103
run: ford ./minpack.md
61104

62105
- name: Deploy Documentation
63-
if: github.ref == 'refs/heads/master'
106+
if: ${{ github.event_name == 'push' && steps.deploy-on-push.outputs.result != 0 }}
64107
uses: JamesIves/[email protected]
65108
with:
66109
branch: gh-pages # The branch the action should deploy to.

0 commit comments

Comments
 (0)