-
Notifications
You must be signed in to change notification settings - Fork 44
85 lines (85 loc) · 3.2 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: "Tests"
env:
CACHE_NAME: marlowe-temp
ALLOWED_URIS: "https://github.com https://api.github.com"
TRUSTED_PUBLIC_KEYS: "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= marlowe-temp.cachix.org-1:1gPjVFpu4QjaAT3tRurCioX+BC23V7mjvFwpP5bV0Ec="
SUBSTITUTERS: "https://cache.nixos.org/ https://cache.iog.io https://marlowe-temp.cachix.org"
on:
pull_request:
branches:
- main
workflow_call:
jobs:
integration:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_HOST_AUTH_METHOD: trust
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout the code
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v26
with:
nix_path: nixpkgs=channel:nixos-unstable
install_url: https://releases.nixos.org/nix/nix-2.20.3/install
extra_nix_config: |
allowed-uris = ${{ env.ALLOWED_URIS }}
trusted-public-keys = ${{ env.TRUSTED_PUBLIC_KEYS }}
substituters = ${{ env.SUBSTITUTERS }}
experimental-features = nix-command flakes
- name: Setup Cachix
uses: cachix/cachix-action@v14
with:
name: ${{ env.CACHE_NAME }}
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Evaluate test derivation
run: |
nix build --dry-run --json .#integration-tests > test-store-path.json
- name: Cache test results
id: cache-results
uses: actions/cache@v4
with:
# Use run_attempt in the cache key so that explicitly re-running the
# tests will force the test to run again.
key: ${{ runner.os }}-integration-tests-${{ hashFiles('test-store-path.json') }}-${{ github.run_attempt }}
path: |
~/integration-tests.log
~/integration-tests.status
- if: ${{ steps.cache-results.outputs.cache-hit != 'true' }}
name: Build tests
run: nix build .#integration-tests --show-trace
- if: ${{ steps.cache-results.outputs.cache-hit != 'true' }}
name: Run tests
run: |
set -o pipefail
result/bin/marlowe-integration-tests --strict | tee ~/integration-tests.log
echo $? > ~/integration-tests.status
exit $(cat ~/integration-tests.status)
env:
MARLOWE_RT_TEST_DB_HOST: localhost
MARLOWE_RT_TEST_CLEANUP_DATABASE: "False"
MARLOWE_RT_TEST_SUBMIT_CONFIRMATION_BLOCKS: 0
- if: ${{ failure() && steps.cache-results.outputs.cache-hit != 'true' }}
name: Upload failed test directories as artifacts
uses: actions/upload-artifact@v4
with:
name: workspaces
path: |
/tmp/workspaces
!/tmp/workspaces/**/*.socket
- if: ${{ steps.cache-results.outputs.cache-hit == 'true' }}
name: Display test results
run: |
echo "Test log:"
cat ~/integration-tests.log
exit $(cat ~/integration-tests.status)