Skip to content

Commit 89198af

Browse files
authored
Merge pull request #260 from LKedward/fix-release-testing
Fix CI to test release build
2 parents eb3f799 + cbd7555 commit 89198af

File tree

6 files changed

+60
-39
lines changed

6 files changed

+60
-39
lines changed

.github/workflows/CI.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,33 +27,39 @@ jobs:
2727
- os: ubuntu-latest
2828
STACK_CACHE: "/home/runner/.stack/"
2929
STACK_CACHE_VERSION: ""
30+
TEST_SCRIPT: ci/run_tests.sh
3031
GET_VERSION_CMD: echo ${{ github.ref }} | cut -dv -f2
3132
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"
33+
RELEASE_CMD: "cp -- fpm-v$(cat fpm_version)-linux-x86_64"
3334
BOOTSTRAP_RELEASE_CMD: cp /home/runner/.local/bin/fpm fpm-bootstrap-v$(cat fpm_version)-linux-x86_64
3435
HASH_CMD: ls fpm-*|xargs -i{} sh -c 'sha256sum $1 > $1.sha256' -- {}
36+
RELEASE_FLAGS: --flag --static --flag -g --flag -fbacktrace --flag -O3
3537

3638
- os: macos-latest
3739
STACK_CACHE: |
3840
/Users/runner/.stack/snapshots
3941
/Users/runner/.stack/setup-exe-src
4042
STACK_CACHE_VERSION: "v2"
43+
TEST_SCRIPT: ci/run_tests.sh
4144
GET_VERSION_CMD: echo ${{ github.ref }} | cut -dv -f2
4245
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"
46+
RELEASE_CMD: "cp -- fpm-v$(cat fpm_version)-macos-x86_64"
4447
BOOTSTRAP_RELEASE_CMD: cp /Users/runner/.local/bin/fpm fpm-bootstrap-v$(cat fpm_version)-macos-x86_64
4548
HASH_CMD: ls fpm-*|xargs -I{} sh -c 'shasum -a 256 $1 > $1.sha256' -- {}
49+
RELEASE_FLAGS: --flag -g --flag -fbacktrace --flag -O3
4650

4751
- os: windows-latest
4852
STACK_CACHE: |
4953
C:\Users\runneradmin\AppData\Roaming\stack
5054
C:\Users\runneradmin\AppData\Local\Programs\stack
5155
STACK_CACHE_VERSION: "v2"
56+
TEST_SCRIPT: ci\run_tests.bat
5257
GET_VERSION_CMD: ("${{ github.ref }}" -Split "v")[1]
5358
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"))
59+
RELEASE_CMD: copy -- (-join("fpm-v",(Get-Content fpm_version),"-windows-x86_64.exe"))
5560
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"))
5661
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"))}
62+
RELEASE_FLAGS: --flag --static --flag -g --flag -fbacktrace --flag -O3
5763

5864
env:
5965
FC: gfortran
@@ -116,15 +122,11 @@ jobs:
116122
cd bootstrap
117123
stack test
118124
119-
- name: Build and run Fortran fpm (Linux / macOS)
120-
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos')
121-
run: |
122-
ci/run_tests.sh
125+
- name: Build and test Fortran fpm
126+
run: ${{ matrix.TEST_SCRIPT }}
123127

124-
- name: Build and run Fortran fpm (Windows)
125-
if: contains(matrix.os, 'windows')
126-
run: |
127-
ci\run_tests.bat
128+
- name: Build and test Fortran fpm (release version)
129+
run: ${{ matrix.TEST_SCRIPT }} ${{ matrix.RELEASE_FLAGS }}
128130

129131
# ----- Upload binaries if creating a release -----
130132
- name: Check that fpm --version matches release tag
@@ -138,7 +140,7 @@ jobs:
138140
if: github.event_name == 'release'
139141
run: |
140142
cd fpm
141-
${{ matrix.RELEASE_CMD }}
143+
fpm run ${{ matrix.RELEASE_FLAGS }} --runner ${{ matrix.RELEASE_CMD }}
142144
${{ matrix.BOOTSTRAP_RELEASE_CMD }}
143145
${{ matrix.HASH_CMD }}
144146
@@ -150,4 +152,4 @@ jobs:
150152
file: fpm/fpm-*
151153
file_glob: true
152154
tag: ${{ github.ref }}
153-
overwrite: true
155+
overwrite: true

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

fpm/fpm.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name = "fpm"
2-
version = "0.1.0"
2+
version = "0.1.1"
33
license = "MIT"
44
author = "fpm maintainers"
55
maintainer = ""
@@ -12,7 +12,7 @@ tag = "v0.2.1"
1212

1313
[dependencies.M_CLI2]
1414
git = "https://github.com/urbanjost/M_CLI2.git"
15-
rev = "893cac0ce374bf07a70ffb9556439c7390e58131"
15+
rev = "e59fb2bfcf36199f1af506f937b3849180454a0f"
1616

1717
[[test]]
1818
name = "cli-test"

fpm/src/fpm_command_line.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ subroutine get_command_line_settings(cmd_settings)
8383
case default ; os_type = "OS Type: UNKNOWN"
8484
end select
8585
version_text = [character(len=80) :: &
86-
& 'Version: 0.1.0, Pre-alpha', &
86+
& 'Version: 0.1.1, alpha', &
8787
& 'Program: fpm(1)', &
8888
& 'Description: A Fortran package manager and build system', &
8989
& 'Home Page: https://github.com/fortran-lang/fpm', &

fpm/src/fpm_strings.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ subroutine split(input_line,array,delimiters,order,nulls)
155155

156156
select case (ilen)
157157

158-
case (:0) ! command was totally blank
158+
case (0) ! command was totally blank
159159

160160
case default ! there is at least one non-delimiter in INPUT_LINE if get here
161161
icol=1 ! initialize pointer into input line

0 commit comments

Comments
 (0)