ci: Use matrix strategy to build with stack
This commit is contained in:
committed by
Wolfgang Walther
parent
b7c261f520
commit
d5afdc7c53
+48
-63
@@ -90,7 +90,7 @@ jobs:
|
|||||||
- name: Run memory tests
|
- name: Run memory tests
|
||||||
run: postgrest-test-memory
|
run: postgrest-test-memory
|
||||||
|
|
||||||
Build-Linux-Nix:
|
Build-Nix:
|
||||||
name: Build Linux static (Nix)
|
name: Build Linux static (Nix)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -125,80 +125,67 @@ jobs:
|
|||||||
nix-env -f default.nix -iA devTools
|
nix-env -f default.nix -iA devTools
|
||||||
postgrest-push-cachix
|
postgrest-push-cachix
|
||||||
|
|
||||||
Build-Linux-Stack:
|
Build-Stack:
|
||||||
name: Build Ubuntu & test (Stack)
|
strategy:
|
||||||
runs-on: ubuntu-latest
|
matrix:
|
||||||
|
os:
|
||||||
|
- name: Linux & test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
cache: |
|
||||||
|
~/.stack
|
||||||
|
.stack-work
|
||||||
|
test: true
|
||||||
|
pgdir: /usr/lib/postgresql
|
||||||
|
artifact: postgrest-ubuntu-x64
|
||||||
|
|
||||||
|
- name: MacOS & test
|
||||||
|
runs-on: macos-latest
|
||||||
|
cache: |
|
||||||
|
~/.stack
|
||||||
|
.stack-work
|
||||||
|
test: true
|
||||||
|
pgdir: /usr/local/Cellar/postgresql
|
||||||
|
artifact: postgrest-macos-x64
|
||||||
|
|
||||||
|
- name: Windows
|
||||||
|
runs-on: windows-latest
|
||||||
|
cache: |
|
||||||
|
~\AppData\Roaming\stack
|
||||||
|
~\AppData\Local\Programs\stack
|
||||||
|
.stack-work
|
||||||
|
deps: |
|
||||||
|
stack exec -- pacman -S mingw64/mingw-w64-x86_64-postgresql --noconfirm
|
||||||
|
# We'd need to make test/with_tmp_db run on Windows first
|
||||||
|
# test: true
|
||||||
|
artifact: postgrest-windows-x64
|
||||||
|
|
||||||
|
name: Build ${{ matrix.os.name }} (Stack)
|
||||||
|
runs-on: ${{ matrix.os.runs-on }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.4.0
|
- uses: actions/checkout@v2.4.0
|
||||||
- name: Stack working files cache
|
- name: Stack working files cache
|
||||||
uses: actions/cache@v2.1.6
|
uses: actions/cache@v2.1.6
|
||||||
with:
|
with:
|
||||||
path: |
|
path: ${{ matrix.os.cache }}
|
||||||
~/.stack
|
|
||||||
.stack-work
|
|
||||||
key: ${{ runner.os }}-${{ hashFiles('stack.yaml.lock') }}
|
key: ${{ runner.os }}-${{ hashFiles('stack.yaml.lock') }}
|
||||||
|
- name: Install dependencies
|
||||||
|
if: ${{ matrix.os.deps }}
|
||||||
|
run: ${{ matrix.os.deps }}
|
||||||
- name: Build with Stack
|
- name: Build with Stack
|
||||||
run: stack build --local-bin-path result --copy-bins
|
run: stack build --local-bin-path result --copy-bins
|
||||||
- name: Run Spec tests with Stack
|
- name: Run Spec tests with Stack
|
||||||
|
if: ${{ matrix.os.test }}
|
||||||
run: |
|
run: |
|
||||||
postgresql_bin="$(find /usr/lib/postgresql -maxdepth 2 -type d -name bin | head -n 1)"
|
postgresql_bin="$(find ${{ matrix.os.pgdir }} -maxdepth 2 -type d -name bin | head -n 1)"
|
||||||
echo "Using PostgreSQL binaries at $postgresql_bin ..."
|
echo "Using PostgreSQL binaries at $postgresql_bin ..."
|
||||||
PATH="$postgresql_bin:$PATH" test/with_tmp_db stack test
|
PATH="$postgresql_bin:$PATH" test/with_tmp_db stack test
|
||||||
- name: Save built executable as artifact
|
- name: Save built executable as artifact
|
||||||
uses: actions/upload-artifact@v2.2.4
|
uses: actions/upload-artifact@v2.2.4
|
||||||
with:
|
with:
|
||||||
name: postgrest-ubuntu-x64
|
name: ${{ matrix.os.artifact }}
|
||||||
path: result/postgrest
|
|
||||||
if-no-files-found: error
|
|
||||||
|
|
||||||
Build-MacOS-Stack:
|
|
||||||
name: Build MacOS & test (Stack)
|
|
||||||
runs-on: macos-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Stack working files cache
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: |
|
path: |
|
||||||
~/.stack
|
result/postgrest
|
||||||
.stack-work
|
result/postgrest.exe
|
||||||
key: ${{ runner.os }}-${{ hashFiles('stack.yaml.lock') }}
|
|
||||||
- name: Build with Stack
|
|
||||||
run: stack build --local-bin-path result --copy-bins
|
|
||||||
- name: Run Spec tests with Stack
|
|
||||||
run: |
|
|
||||||
postgresql_bin="$(find /usr/local/Cellar/postgresql -maxdepth 2 -type d -name bin | head -n 1)"
|
|
||||||
echo "Using PostgreSQL binaries at $postgresql_bin ..."
|
|
||||||
PATH="$postgresql_bin:$PATH" test/with_tmp_db stack test
|
|
||||||
- name: Save built executable as artifact
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: postgrest-macos-x64
|
|
||||||
path: result/postgrest
|
|
||||||
if-no-files-found: error
|
|
||||||
|
|
||||||
Build-Windows-Stack:
|
|
||||||
name: Build Windows (Stack)
|
|
||||||
runs-on: windows-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Stack working files cache
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~\AppData\Roaming\stack
|
|
||||||
~\AppData\Local\Programs\stack
|
|
||||||
.stack-work
|
|
||||||
key: ${{ runner.os }}-${{ hashFiles('stack.yaml.lock') }}
|
|
||||||
- name: Install dependencies
|
|
||||||
run: stack exec -- pacman -S mingw64/mingw-w64-x86_64-postgresql --noconfirm
|
|
||||||
- name: Build with Stack
|
|
||||||
run: stack build --local-bin-path result --copy-bins
|
|
||||||
- name: Save built executable as artifact
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: postgrest-windows-x64
|
|
||||||
path: result/postgrest.exe
|
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
Get-FreeBSD-CirrusCI:
|
Get-FreeBSD-CirrusCI:
|
||||||
@@ -226,10 +213,8 @@ jobs:
|
|||||||
- Lint-Style
|
- Lint-Style
|
||||||
- Test-Nix
|
- Test-Nix
|
||||||
- Test-Memory-Nix
|
- Test-Memory-Nix
|
||||||
- Build-Linux-Nix
|
- Build-Nix
|
||||||
- Build-Linux-Stack
|
- Build-Stack
|
||||||
- Build-MacOS-Stack
|
|
||||||
- Build-Windows-Stack
|
|
||||||
- Get-FreeBSD-CirrusCI
|
- Get-FreeBSD-CirrusCI
|
||||||
outputs:
|
outputs:
|
||||||
version: ${{ steps.Identify-Version.outputs.version }}
|
version: ${{ steps.Identify-Version.outputs.version }}
|
||||||
|
|||||||
Reference in New Issue
Block a user