1
1
name : CI
2
2
3
- on :
3
+ on :
4
4
push :
5
5
pull_request :
6
6
release :
16
16
RUST_BACKTRACE : " full" # Make Rust print full backtrace on error
17
17
18
18
jobs :
19
- Build :
19
+ stack-build :
20
20
runs-on : ${{ matrix.os }}
21
21
strategy :
22
22
fail-fast : false
88
88
89
89
with :
90
90
format : ' YYYY-MM'
91
-
91
+
92
92
- name : Setup github actions cache
93
93
id : cache
94
94
uses : actions/cache@v2
98
98
99
99
- name : Build Haskell fpm
100
100
run : |
101
- cd bootstrap
102
101
stack build
103
102
stack install
103
+ working-directory : bootstrap
104
104
105
105
- name : put fpm to PATH (macOS)
106
106
if : contains(matrix.os, 'macos')
@@ -116,34 +116,200 @@ jobs:
116
116
if : contains(matrix.os, 'ubuntu')
117
117
run : |
118
118
sudo cp /home/runner/.local/bin/fpm /usr/local/bin
119
-
119
+
120
120
- name : Run tests on Haskell fpm
121
121
run : |
122
- cd bootstrap
123
122
stack test
124
-
125
- - name : Build and test Fortran fpm
126
- run : ${{ matrix.TEST_SCRIPT }}
127
-
128
- - name : Build and test Fortran fpm (release version)
129
- run : ${{ matrix.TEST_SCRIPT }} ${{ matrix.RELEASE_FLAGS }}
123
+ working-directory : bootstrap
130
124
131
125
# ----- Upload binaries if creating a release -----
132
126
- name : Check that fpm --version matches release tag
133
127
if : github.event_name == 'release'
134
128
run : |
135
- cd fpm
136
129
${{ matrix.GET_VERSION_CMD }} > fpm_version
137
- fpm run -- "--version" | ${{ matrix.CHECK_VERSION_CMD }}
130
+ working-directory : fpm
138
131
139
132
- name : Stage release files for upload
140
133
if : github.event_name == 'release'
141
134
run : |
142
- cd fpm
143
- fpm run ${{ matrix.RELEASE_FLAGS }} --runner ${{ matrix.RELEASE_CMD }}
144
135
${{ matrix.BOOTSTRAP_RELEASE_CMD }}
145
136
${{ matrix.HASH_CMD }}
146
-
137
+ working-directory : fpm
138
+
139
+ - name : Upload assets
140
+ if : github.event_name == 'release'
141
+ uses : svenstaro/upload-release-action@v2
142
+ with :
143
+ repo_token : ${{ secrets.GITHUB_TOKEN }}
144
+ file : fpm/fpm-*
145
+ file_glob : true
146
+ tag : ${{ github.ref }}
147
+ overwrite : true
148
+
149
+ build :
150
+ runs-on : ${{ matrix.os }}
151
+ strategy :
152
+ fail-fast : false
153
+ matrix :
154
+ os : [ubuntu-latest, macos-latest, windows-latest]
155
+ gcc_v : [9] # Version of GFortran we want to use.
156
+ include :
157
+ - os : ubuntu-latest
158
+ os-arch : linux-x86_64
159
+ release-flags : --flag '--static -g -fbacktrace -O3'
160
+ sha256sum : sha256sum
161
+
162
+ - os : macos-latest
163
+ os-arch : macos-x86_64
164
+ release-flags : --flag '-g -fbacktrace -O3'
165
+ sha256sum : shasum -a 256
166
+
167
+ - os : windows-latest
168
+ os-arch : windows-x86_64
169
+ release-flags : --flag '--static -g -fbacktrace -O3'
170
+ exe : .exe
171
+ sha256sum : sha256sum
172
+
173
+ env :
174
+ FC : gfortran
175
+ GCC_V : ${{ matrix.gcc_v }}
176
+
177
+ steps :
178
+ - name : Checkout code
179
+ uses : actions/checkout@v1
180
+
181
+ - name : Install GFortran macOS
182
+ if : contains(matrix.os, 'macos')
183
+ run : |
184
+ ln -s /usr/local/bin/gfortran-${GCC_V} /usr/local/bin/gfortran
185
+ which gfortran-${GCC_V}
186
+ which gfortran
187
+
188
+ - name : Install GFortran Linux
189
+ if : contains(matrix.os, 'ubuntu')
190
+ run : |
191
+ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \
192
+ --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \
193
+ --slave /usr/bin/gcov gcov /usr/bin/gcov-${GCC_V}
194
+
195
+ # Phase 1: Bootstrap fpm with existing version
196
+ - name : Install fpm
197
+ uses : fortran-lang/setup-fpm@v3
198
+ with :
199
+ fpm-version : ' v0.2.0'
200
+
201
+ - name : Remove fpm from path
202
+ shell : bash
203
+ run : |
204
+ mv $(which fpm) fpm-bootstrap${{ matrix.exe }}
205
+ echo "BOOTSTRAP=$PWD/fpm-bootstrap" | cat >> $GITHUB_ENV
206
+
207
+ - name : Build Fortran fpm (bootstrap)
208
+ shell : bash
209
+ run : |
210
+ ${{ env.BOOTSTRAP }} build
211
+ working-directory : fpm
212
+
213
+ - name : Run Fortran fpm (bootstrap)
214
+ shell : bash
215
+ run : |
216
+ ${{ env.BOOTSTRAP }} run
217
+ ${{ env.BOOTSTRAP }} run -- --version
218
+ ${{ env.BOOTSTRAP }} run -- --help
219
+ working-directory : fpm
220
+
221
+ - name : Test Fortran fpm (bootstrap)
222
+ shell : bash
223
+ run : |
224
+ ${{ env.BOOTSTRAP }} test
225
+ working-directory : fpm
226
+
227
+ - name : Install Fortran fpm (bootstrap)
228
+ shell : bash
229
+ run : |
230
+ ${{ env.BOOTSTRAP }} install
231
+ working-directory : fpm
232
+
233
+ # Phase 2: Bootstrap fpm with itself
234
+ - name : Replace bootstrapping version
235
+ shell : bash
236
+ run : |
237
+ ${{ env.BOOTSTRAP }} run --runner cp -- fpm-debug${{ matrix.exe }}
238
+ rm -v ${{ env.BOOTSTRAP }}
239
+ echo "FPM=$PWD/fpm-debug" | cat >> $GITHUB_ENV
240
+ working-directory : fpm
241
+
242
+ - name : Get version (normal)
243
+ if : github.event_name != 'release'
244
+ shell : bash
245
+ run : |
246
+ VERSION=$(git rev-parse --short HEAD)
247
+ echo "VERSION=$VERSION" | cat >> $GITHUB_ENV
248
+
249
+ - name : Get version (release)
250
+ if : github.event_name == 'release'
251
+ shell : bash
252
+ run : |
253
+ VERSION=$(echo ${{ github.ref }} | cut -dv -f2)
254
+ echo "VERSION=$VERSION" | cat >> $GITHUB_ENV
255
+ FPM_VERSION=$(${{ env.FPM }} --version | grep -o '${{ env.REGEX }}')
256
+ [ "$VERSION" = "$FPM_VERSION" ]
257
+ env :
258
+ REGEX : ' [0-9]\{1,4\}\.[0-9]\{1,4\}\.[0-9]\{1,4\}'
259
+
260
+ - name : Build example packages
261
+ shell : bash
262
+ run : |
263
+ ci/run_tests.sh "${{ env.FPM }}"
264
+
265
+ - name : Build Fortran fpm
266
+ shell : bash
267
+ run : |
268
+ ${{ env.FPM }} build ${{ matrix.release-flags }}
269
+ working-directory : fpm
270
+
271
+ - name : Run Fortran fpm
272
+ shell : bash
273
+ run : |
274
+ ${{ env.FPM }} run ${{ matrix.release-flags }}
275
+ ${{ env.FPM }} run ${{ matrix.release-flags }} -- --version
276
+ ${{ env.FPM }} run ${{ matrix.release-flags }} -- --help
277
+ working-directory : fpm
278
+
279
+ - name : Test Fortran fpm
280
+ shell : bash
281
+ run : |
282
+ ${{ env.FPM }} test ${{ matrix.release-flags }}
283
+ working-directory : fpm
284
+
285
+ - name : Install Fortran fpm
286
+ shell : bash
287
+ run : |
288
+ ${{ env.FPM }} install ${{ matrix.release-flags }}
289
+ working-directory : fpm
290
+
291
+ - name : Package release version
292
+ shell : bash
293
+ run : |
294
+ ${{ env.FPM }} run ${{ matrix.release-flags }} --runner cp -- ${{ env.EXE }}
295
+ rm -v ${{ env.FPM }}
296
+ echo "FPM_RELEASE=$PWD/${{ env.EXE }}" | cat >> $GITHUB_ENV
297
+ working-directory : fpm
298
+ env :
299
+ EXE : fpm-${{ env.VERSION }}-${{ matrix.os-arch }}${{ matrix.exe }}
300
+
301
+ - name : Run release version
302
+ shell : bash
303
+ run : |
304
+ ci/run_tests.sh "${{ env.FPM_RELEASE }}"
305
+
306
+ - name : Stage release files for upload
307
+ if : github.event_name == 'release'
308
+ shell : bash
309
+ run : |
310
+ ${{ matrix.sha256sum }} ${{ env.FPM_RELEASE }} > ${{ env.FPM_RELEASE }}.sha256
311
+ working-directory : fpm
312
+
147
313
- name : Upload assets
148
314
if : github.event_name == 'release'
149
315
uses : svenstaro/upload-release-action@v2
0 commit comments