aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLKedward <laurence.kedward@bristol.ac.uk>2020-11-30 14:58:58 +0000
committerLKedward <laurence.kedward@bristol.ac.uk>2020-11-30 14:58:58 +0000
commit240060f49ac937b3582d91f13f6e6d66422ebcd6 (patch)
tree3ea212429ab9a0509dc4880c5733b4f99773f92b
parent105644ca8bce711b407e1a15f8f456693f60ff43 (diff)
downloadfpm-240060f49ac937b3582d91f13f6e6d66422ebcd6.tar.gz
fpm-240060f49ac937b3582d91f13f6e6d66422ebcd6.zip
Update: CI to also test release version
-rw-r--r--.github/workflows/CI.yml9
-rwxr-xr-xci/run_tests.bat28
-rwxr-xr-xci/run_tests.sh35
3 files changed, 47 insertions, 25 deletions
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
index 8165ded..2b3b6bf 100644
--- a/.github/workflows/CI.yml
+++ b/.github/workflows/CI.yml
@@ -29,7 +29,7 @@ jobs:
STACK_CACHE_VERSION: ""
GET_VERSION_CMD: echo ${{ github.ref }} | cut -dv -f2
CHECK_VERSION_CMD: grep $(cat fpm_version)
- RELEASE_CMD: "fpm run --flag --static --flag -g --flag -fbacktrace --flag -O3 --runner cp -- fpm-v$(cat fpm_version)-linux-x86_64"
+ RELEASE_CMD: "fpm run ${{ env.RELEASE_FLAGS }} --runner cp -- fpm-v$(cat fpm_version)-linux-x86_64"
BOOTSTRAP_RELEASE_CMD: cp /home/runner/.local/bin/fpm fpm-bootstrap-v$(cat fpm_version)-linux-x86_64
HASH_CMD: ls fpm-*|xargs -i{} sh -c 'sha256sum $1 > $1.sha256' -- {}
@@ -40,7 +40,7 @@ jobs:
STACK_CACHE_VERSION: "v2"
GET_VERSION_CMD: echo ${{ github.ref }} | cut -dv -f2
CHECK_VERSION_CMD: grep $(cat fpm_version)
- RELEASE_CMD: "fpm run --flag -g --flag -fbacktrace --flag -O3 --runner cp -- fpm-v$(cat fpm_version)-macos-x86_64"
+ RELEASE_CMD: "fpm run ${{ env.RELEASE_FLAGS }} --runner cp -- fpm-v$(cat fpm_version)-macos-x86_64"
BOOTSTRAP_RELEASE_CMD: cp /Users/runner/.local/bin/fpm fpm-bootstrap-v$(cat fpm_version)-macos-x86_64
HASH_CMD: ls fpm-*|xargs -I{} sh -c 'shasum -a 256 $1 > $1.sha256' -- {}
@@ -51,13 +51,14 @@ jobs:
STACK_CACHE_VERSION: "v2"
GET_VERSION_CMD: ("${{ github.ref }}" -Split "v")[1]
CHECK_VERSION_CMD: Select-String -Pattern Version | Where-Object { if ($_ -like -join("*",(Get-Content fpm_version),"*")) {echo $_} else {Throw} }
- 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"))
+ RELEASE_CMD: fpm run ${{ env.RELEASE_FLAGS }} --runner copy -- (-join("fpm-v",(Get-Content fpm_version),"-windows-x86_64.exe"))
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"))
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"))}
env:
FC: gfortran
GCC_V: ${{ matrix.gcc_v }}
+ RELEASE_FLAGS: --flag -g --flag -fbacktrace --flag -O3
steps:
- name: Checkout code
@@ -120,11 +121,13 @@ jobs:
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos')
run: |
ci/run_tests.sh
+ ci/run_tests.sh ${{ env.RELEASE_FLAGS }}
- name: Build and run Fortran fpm (Windows)
if: contains(matrix.os, 'windows')
run: |
ci\run_tests.bat
+ ci\run_tests.bat ${{ env.RELEASE_FLAGS }}
# ----- Upload binaries if creating a release -----
- name: Check that fpm --version matches release tag
diff --git a/ci/run_tests.bat b/ci/run_tests.bat
index 44f6e5c..533590d 100755
--- a/ci/run_tests.bat
+++ b/ci/run_tests.bat
@@ -3,18 +3,25 @@
cd fpm
if errorlevel 1 exit 1
-fpm build
+fpm build %*
if errorlevel 1 exit 1
-fpm run
+fpm run %*
+if errorlevel 1 exit 1
+
+fpm run %* -- --help
+if errorlevel 1 exit 1
+
+fpm run %* -- --version
if errorlevel 1 exit 1
rmdir fpm_scratch_* /s /q
-fpm test
+fpm test %*
if errorlevel 1 exit 1
rmdir fpm_scratch_* /s /q
-for /f %%i in ('where /r build fpm.exe') do set fpm_path=%%i
+for /f %%i in ('fpm run %* --runner echo') do set fpm_path=%%i
+echo %fpm_path%
%fpm_path%
if errorlevel 1 exit 1
@@ -22,6 +29,7 @@ if errorlevel 1 exit 1
cd ..\example_packages\hello_world
if errorlevel 1 exit 1
+del /q /f build
%fpm_path% build
if errorlevel 1 exit 1
@@ -32,6 +40,7 @@ if errorlevel 1 exit 1
cd ..\hello_fpm
if errorlevel 1 exit 1
+del /q /f build
%fpm_path% build
if errorlevel 1 exit 1
@@ -42,6 +51,7 @@ if errorlevel 1 exit 1
cd ..\circular_test
if errorlevel 1 exit 1
+del /q /f build
%fpm_path% build
if errorlevel 1 exit 1
@@ -49,6 +59,7 @@ if errorlevel 1 exit 1
cd ..\circular_example
if errorlevel 1 exit 1
+del /q /f build
%fpm_path% build
if errorlevel 1 exit 1
@@ -56,6 +67,7 @@ if errorlevel 1 exit 1
cd ..\hello_complex
if errorlevel 1 exit 1
+del /q /f build
%fpm_path% build
if errorlevel 1 exit 1
@@ -75,6 +87,7 @@ if errorlevel 1 exit 1
cd ..\hello_complex_2
if errorlevel 1 exit 1
+del /q /f build
%fpm_path% build
if errorlevel 1 exit 1
@@ -93,6 +106,7 @@ if errorlevel 1 exit 1
cd ..\auto_discovery_off
if errorlevel 1 exit 1
+del /q /f build
%fpm_path% build
if errorlevel 1 exit 1
@@ -110,6 +124,7 @@ if exist .\build\gfortran_debug\test\unused_test exit /B 1
cd ..\with_c
if errorlevel 1 exit 1
+del /q /f build
%fpm_path% build
if errorlevel 1 exit 1
@@ -120,6 +135,7 @@ if errorlevel 1 exit 1
cd ..\submodules
if errorlevel 1 exit 1
+del /q /f build
%fpm_path% build
if errorlevel 1 exit 1
@@ -127,6 +143,7 @@ if errorlevel 1 exit 1
cd ..\program_with_module
if errorlevel 1 exit 1
+del /q /f build
%fpm_path% build
if errorlevel 1 exit 1
@@ -137,8 +154,11 @@ if errorlevel 1 exit 1
cd ..\link_executable
if errorlevel 1 exit 1
+del /q /f build
%fpm_path% build
if errorlevel 1 exit 1
.\build\gfortran_debug\app\gomp_test
if errorlevel 1 exit 1
+
+cd ..\.. \ No newline at end of file
diff --git a/ci/run_tests.sh b/ci/run_tests.sh
index 894b1f0..3588012 100755
--- a/ci/run_tests.sh
+++ b/ci/run_tests.sh
@@ -1,30 +1,26 @@
#!/bin/bash
+set -ex
-get_abs_filename() {
- # $1 : relative filename
- filename=$1
- parentdir=$(dirname "${filename}")
+cd $(dirname $0)/../fpm
- if [ -d "${filename}" ]; then
- echo "$(cd "${filename}" && pwd)"
- elif [ -d "${parentdir}" ]; then
- echo "$(cd "${parentdir}" && pwd)/$(basename "${filename}")"
- fi
-}
+fpm build $@
-set -ex
+# Run fpm executable
+fpm run $@
+fpm run $@ -- --version
+fpm run $@ -- --help
-cd fpm
-fpm build
-fpm run
+# Run tests
rm -rf fpm_scratch_*/
-fpm test
+fpm test $@
rm -rf fpm_scratch_*/
-f_fpm_path="$(get_abs_filename $(find build -regex 'build/.*/app/fpm'))"
-"${f_fpm_path}"
+# Build example packages
+f_fpm_path="$(fpm run $@ --runner echo)"
+cd ../example_packages/
+rm -rf ./*/build
-cd ../example_packages/hello_world
+cd hello_world
"${f_fpm_path}" build
./build/gfortran_debug/app/hello_world
@@ -77,3 +73,6 @@ cd ../link_external
cd ../link_executable
"${f_fpm_path}" build
./build/gfortran_debug/app/gomp_test
+
+# Cleanup
+rm -rf ./*/build \ No newline at end of file