Skip to content

Commit 240060f

Browse files
committed
Update: CI to also test release version
1 parent 105644c commit 240060f

File tree

3 files changed

+47
-25
lines changed

3 files changed

+47
-25
lines changed

.github/workflows/CI.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
STACK_CACHE_VERSION: ""
3030
GET_VERSION_CMD: echo ${{ github.ref }} | cut -dv -f2
3131
CHECK_VERSION_CMD: grep $(cat fpm_version)
32-
RELEASE_CMD: "fpm run --flag --static --flag -g --flag -fbacktrace --flag -O3 --runner cp -- fpm-v$(cat fpm_version)-linux-x86_64"
32+
RELEASE_CMD: "fpm run ${{ env.RELEASE_FLAGS }} --runner cp -- fpm-v$(cat fpm_version)-linux-x86_64"
3333
BOOTSTRAP_RELEASE_CMD: cp /home/runner/.local/bin/fpm fpm-bootstrap-v$(cat fpm_version)-linux-x86_64
3434
HASH_CMD: ls fpm-*|xargs -i{} sh -c 'sha256sum $1 > $1.sha256' -- {}
3535

@@ -40,7 +40,7 @@ jobs:
4040
STACK_CACHE_VERSION: "v2"
4141
GET_VERSION_CMD: echo ${{ github.ref }} | cut -dv -f2
4242
CHECK_VERSION_CMD: grep $(cat fpm_version)
43-
RELEASE_CMD: "fpm run --flag -g --flag -fbacktrace --flag -O3 --runner cp -- fpm-v$(cat fpm_version)-macos-x86_64"
43+
RELEASE_CMD: "fpm run ${{ env.RELEASE_FLAGS }} --runner cp -- fpm-v$(cat fpm_version)-macos-x86_64"
4444
BOOTSTRAP_RELEASE_CMD: cp /Users/runner/.local/bin/fpm fpm-bootstrap-v$(cat fpm_version)-macos-x86_64
4545
HASH_CMD: ls fpm-*|xargs -I{} sh -c 'shasum -a 256 $1 > $1.sha256' -- {}
4646

@@ -51,13 +51,14 @@ jobs:
5151
STACK_CACHE_VERSION: "v2"
5252
GET_VERSION_CMD: ("${{ github.ref }}" -Split "v")[1]
5353
CHECK_VERSION_CMD: Select-String -Pattern Version | Where-Object { if ($_ -like -join("*",(Get-Content fpm_version),"*")) {echo $_} else {Throw} }
54-
RELEASE_CMD: fpm run --flag --static --flag -g --flag -fbacktrace --flag -O3 --runner copy -- (-join("fpm-v",(Get-Content fpm_version),"-windows-x86_64.exe"))
54+
RELEASE_CMD: fpm run ${{ env.RELEASE_FLAGS }} --runner copy -- (-join("fpm-v",(Get-Content fpm_version),"-windows-x86_64.exe"))
5555
BOOTSTRAP_RELEASE_CMD: copy C:\Users\runneradmin\AppData\Roaming\local\bin\fpm.exe (-join("fpm-bootstrap-v",(Get-Content fpm_version),"-windows-x86_64.exe"))
5656
HASH_CMD: Get-ChildItem -File -Filter "fpm-*" | Foreach-Object {echo (Get-FileHash -Algorithm SHA256 $PSItem | Select-Object hash | Format-Table -HideTableHeaders | Out-String) > (-join($PSItem,".sha256"))}
5757

5858
env:
5959
FC: gfortran
6060
GCC_V: ${{ matrix.gcc_v }}
61+
RELEASE_FLAGS: --flag -g --flag -fbacktrace --flag -O3
6162

6263
steps:
6364
- name: Checkout code
@@ -120,11 +121,13 @@ jobs:
120121
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos')
121122
run: |
122123
ci/run_tests.sh
124+
ci/run_tests.sh ${{ env.RELEASE_FLAGS }}
123125
124126
- name: Build and run Fortran fpm (Windows)
125127
if: contains(matrix.os, 'windows')
126128
run: |
127129
ci\run_tests.bat
130+
ci\run_tests.bat ${{ env.RELEASE_FLAGS }}
128131
129132
# ----- Upload binaries if creating a release -----
130133
- name: Check that fpm --version matches release tag

ci/run_tests.bat

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,33 @@
33
cd fpm
44
if errorlevel 1 exit 1
55

6-
fpm build
6+
fpm build %*
77
if errorlevel 1 exit 1
88

9-
fpm run
9+
fpm run %*
10+
if errorlevel 1 exit 1
11+
12+
fpm run %* -- --help
13+
if errorlevel 1 exit 1
14+
15+
fpm run %* -- --version
1016
if errorlevel 1 exit 1
1117

1218
rmdir fpm_scratch_* /s /q
13-
fpm test
19+
fpm test %*
1420
if errorlevel 1 exit 1
1521
rmdir fpm_scratch_* /s /q
1622

17-
for /f %%i in ('where /r build fpm.exe') do set fpm_path=%%i
23+
for /f %%i in ('fpm run %* --runner echo') do set fpm_path=%%i
24+
echo %fpm_path%
1825

1926
%fpm_path%
2027
if errorlevel 1 exit 1
2128

2229
cd ..\example_packages\hello_world
2330
if errorlevel 1 exit 1
2431

32+
del /q /f build
2533
%fpm_path% build
2634
if errorlevel 1 exit 1
2735

@@ -32,6 +40,7 @@ if errorlevel 1 exit 1
3240
cd ..\hello_fpm
3341
if errorlevel 1 exit 1
3442

43+
del /q /f build
3544
%fpm_path% build
3645
if errorlevel 1 exit 1
3746

@@ -42,20 +51,23 @@ if errorlevel 1 exit 1
4251
cd ..\circular_test
4352
if errorlevel 1 exit 1
4453

54+
del /q /f build
4555
%fpm_path% build
4656
if errorlevel 1 exit 1
4757

4858

4959
cd ..\circular_example
5060
if errorlevel 1 exit 1
5161

62+
del /q /f build
5263
%fpm_path% build
5364
if errorlevel 1 exit 1
5465

5566

5667
cd ..\hello_complex
5768
if errorlevel 1 exit 1
5869

70+
del /q /f build
5971
%fpm_path% build
6072
if errorlevel 1 exit 1
6173

@@ -75,6 +87,7 @@ if errorlevel 1 exit 1
7587
cd ..\hello_complex_2
7688
if errorlevel 1 exit 1
7789

90+
del /q /f build
7891
%fpm_path% build
7992
if errorlevel 1 exit 1
8093

@@ -93,6 +106,7 @@ if errorlevel 1 exit 1
93106
cd ..\auto_discovery_off
94107
if errorlevel 1 exit 1
95108

109+
del /q /f build
96110
%fpm_path% build
97111
if errorlevel 1 exit 1
98112

@@ -110,6 +124,7 @@ if exist .\build\gfortran_debug\test\unused_test exit /B 1
110124
cd ..\with_c
111125
if errorlevel 1 exit 1
112126

127+
del /q /f build
113128
%fpm_path% build
114129
if errorlevel 1 exit 1
115130

@@ -120,13 +135,15 @@ if errorlevel 1 exit 1
120135
cd ..\submodules
121136
if errorlevel 1 exit 1
122137

138+
del /q /f build
123139
%fpm_path% build
124140
if errorlevel 1 exit 1
125141

126142

127143
cd ..\program_with_module
128144
if errorlevel 1 exit 1
129145

146+
del /q /f build
130147
%fpm_path% build
131148
if errorlevel 1 exit 1
132149

@@ -137,8 +154,11 @@ if errorlevel 1 exit 1
137154
cd ..\link_executable
138155
if errorlevel 1 exit 1
139156

157+
del /q /f build
140158
%fpm_path% build
141159
if errorlevel 1 exit 1
142160

143161
.\build\gfortran_debug\app\gomp_test
144162
if errorlevel 1 exit 1
163+
164+
cd ..\..

ci/run_tests.sh

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,26 @@
11
#!/bin/bash
2+
set -ex
23

3-
get_abs_filename() {
4-
# $1 : relative filename
5-
filename=$1
6-
parentdir=$(dirname "${filename}")
4+
cd $(dirname $0)/../fpm
75

8-
if [ -d "${filename}" ]; then
9-
echo "$(cd "${filename}" && pwd)"
10-
elif [ -d "${parentdir}" ]; then
11-
echo "$(cd "${parentdir}" && pwd)/$(basename "${filename}")"
12-
fi
13-
}
6+
fpm build $@
147

15-
set -ex
8+
# Run fpm executable
9+
fpm run $@
10+
fpm run $@ -- --version
11+
fpm run $@ -- --help
1612

17-
cd fpm
18-
fpm build
19-
fpm run
13+
# Run tests
2014
rm -rf fpm_scratch_*/
21-
fpm test
15+
fpm test $@
2216
rm -rf fpm_scratch_*/
2317

24-
f_fpm_path="$(get_abs_filename $(find build -regex 'build/.*/app/fpm'))"
25-
"${f_fpm_path}"
18+
# Build example packages
19+
f_fpm_path="$(fpm run $@ --runner echo)"
20+
cd ../example_packages/
21+
rm -rf ./*/build
2622

27-
cd ../example_packages/hello_world
23+
cd hello_world
2824
"${f_fpm_path}" build
2925
./build/gfortran_debug/app/hello_world
3026

@@ -77,3 +73,6 @@ cd ../link_external
7773
cd ../link_executable
7874
"${f_fpm_path}" build
7975
./build/gfortran_debug/app/gomp_test
76+
77+
# Cleanup
78+
rm -rf ./*/build

0 commit comments

Comments
 (0)