migrate from hslibdeps to nhm-tool [ci-skip] #49
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [master] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
continue-on-error: ${{ matrix.experimental }} | |
strategy: | |
matrix: | |
ghc: [8.0.2, 8.2.2, 8.4.4, 8.6.5, 8.8.4, 8.10.7, 9.0.2] | |
cabal: [3.6.2.0] | |
nginx: [1.18.0] | |
nginx-haskell-module: [3.1.3] | |
experimental: [false] | |
include: | |
- ghc: 9.6.2 | |
cabal: 3.10.1.0 | |
nginx: 1.22.1 | |
nginx-haskell-module: head | |
experimental: false | |
- ghc: 9.6.2 | |
cabal: 3.10.1.0 | |
nginx: head | |
nginx-haskell-module: head | |
experimental: true | |
- ghc: 9.4.5 | |
cabal: 3.8.1.0 | |
nginx: 1.22.0 | |
nginx-haskell-module: head | |
experimental: false | |
- ghc: 9.4.5 | |
cabal: 3.8.1.0 | |
nginx: head | |
nginx-haskell-module: head | |
experimental: true | |
- ghc: 9.2.8 | |
cabal: 3.6.2.0 | |
nginx: 1.20.2 | |
nginx-haskell-module: head | |
experimental: false | |
- ghc: 9.2.8 | |
cabal: 3.6.2.0 | |
nginx: head | |
nginx-haskell-module: head | |
experimental: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install GHC and Cabal | |
uses: haskell/actions/setup@v2 | |
with: | |
ghc-version: ${{ matrix.ghc }} | |
cabal-version: ${{ matrix.cabal }} | |
- name: Install prove | |
uses: perl-actions/install-with-cpanm@v1 | |
with: | |
install: "Test::Nginx" | |
tests: false | |
- name: Install and test | |
env: | |
GHCVER: ${{ matrix.ghc }} | |
NGXVER: ${{ matrix.nginx }} | |
CABALVER: ${{ matrix.cabal }} | |
NGXHMVER: ${{ matrix.nginx-haskell-module }} | |
run: | | |
set -e | |
cabal --version | |
echo "$(ghc --version) "` | |
`"[$(ghc --print-project-git-commit-id 2>/dev/null || echo '?')]" | |
if echo "$CABALVER" | grep -q '^3\.[0-5]\.' | |
then | |
cabal v1-update | |
else | |
cabal v2-update | |
fi | |
cabal v1-install ngx-export-tools | |
if [ "$NGXVER" == head ] | |
then | |
git clone https://github.com/nginx/nginx.git nginx-head | |
else | |
wget http://nginx.org/download/nginx-${NGXVER}.tar.gz && | |
tar xzvf nginx-${NGXVER}.tar.gz | |
fi | |
if [ "$NGXHMVER" == head ] | |
then | |
git clone https://github.com/lyokha/nginx-haskell-module.git \ | |
nginx-haskell-module-head | |
else | |
wget "https://github.com/lyokha/nginx-haskell-module/"` | |
`"archive/refs/tags/${NGXHMVER}.tar.gz" \ | |
-O nginx-haskell-module-${NGXHMVER}.tar.gz && | |
tar xzvf nginx-haskell-module-${NGXHMVER}.tar.gz | |
fi | |
git clone https://github.com/openresty/echo-nginx-module.git | |
cd nginx-${NGXVER}/ | |
if [ "$NGXVER" == head ] | |
then | |
NGX_CONFIGURE=./auto/configure | |
else | |
NGX_CONFIGURE=./configure | |
fi | |
$NGX_CONFIGURE --add-module=../nginx-haskell-module-${NGXHMVER} \ | |
--add-module=../echo-nginx-module \ | |
--add-dynamic-module=.. \ | |
--add-dynamic-module=../module | |
make -j2 | |
cp objs/ngx_log_plugin.so objs/libngx_log_plugin.so | |
export NGX_MODULE_PATH="$(pwd)/objs" | |
export PATH="$NGX_MODULE_PATH:$PATH" | |
export TEST_NGINX_LOAD_MODULES="$NGX_MODULE_PATH/ngx_log_plugin_module.so" | |
cd - | |
cabal v1-configure | |
cabal v1-build -v --ghc-options=-ddump-splices | |
cabal v2-sdist --builddir=dist | |
SRC_TGZ=$(cabal info . | awk '{print $2; exit}').tar.gz && | |
(cd dist/sdist && cabal v1-install --force-reinstalls "$SRC_TGZ") | |
if echo "$GHCVER" | grep -q '^[0-8]\.' | |
then | |
GHC_FLINKRTS=-lHSrts_thr-ghc"$(ghc --numeric-version)" | |
else | |
GHC_FLINKRTS="-flink-rts -threaded" | |
fi | |
cd simple | |
ghc -Wall -O2 -dynamic -shared -fPIC $GHC_FLINKRTS \ | |
-L"$NGX_MODULE_PATH" -lngx_log_plugin -ddump-splices \ | |
ngx_log.hs -o ngx_log.so -fforce-recomp | |
export TEST_NGINX_LLIB_DIR="$(pwd)" | |
cd - | |
cd test | |
LD_LIBRARY_PATH="$NGX_MODULE_PATH" prove -r t | |
cd - | |
set +e | |