1
1
name : CI
2
- on : [push]
3
- jobs :
2
+ on : [push, pull_request]
4
3
4
+ jobs :
5
5
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 :
6
54
runs-on : ${{ matrix.os }}
7
55
strategy :
8
56
fail-fast : false
15
63
GCC_V : ${{ matrix.gcc_v }}
16
64
17
65
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
+
18
72
- name : Checkout code
19
73
uses : actions/checkout@v2
20
74
with :
@@ -28,20 +82,15 @@ jobs:
28
82
- name : Setup Graphviz
29
83
uses : ts-graphviz/setup-graphviz@v1
30
84
31
- - name : Setup Fortran Package Manager
32
- uses : fortran-lang/setup-fpm@v3
33
- with :
34
- github-token : ${{ secrets.GITHUB_TOKEN }}
35
-
36
85
- name : Install Python dependencies
37
- if : contains( matrix.os, 'ubuntu')
86
+ if : ${{ contains( matrix.os, 'ubuntu') }}
38
87
run : |
39
88
python -m pip install --upgrade pip
40
89
pip install numpy matplotlib ford
41
90
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
42
91
43
92
- name : Install GFortran Linux
44
- if : contains( matrix.os, 'ubuntu')
93
+ if : ${{ contains( matrix.os, 'ubuntu') }}
45
94
run : |
46
95
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
47
96
sudo apt-get update
@@ -50,17 +99,11 @@ jobs:
50
99
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \
51
100
--slave /usr/bingcov gcov /usr/bin/gcov-${GCC_V}
52
101
53
- - name : Compile
54
- run : fpm build --profile release
55
-
56
- - name : Run test
57
- run : fpm test
58
-
59
102
- name : Build documentation
60
103
run : ford ./minpack.md
61
104
62
105
- name : Deploy Documentation
63
- if : github.ref == 'refs/heads/master'
106
+ if : ${{ github.event_name == 'push' && steps.deploy-on-push.outputs.result != 0 }}
64
107
65
108
with :
66
109
branch : gh-pages # The branch the action should deploy to.
0 commit comments