This repository has been archived by the owner on Dec 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (89 loc) · 3.15 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Test
on:
workflow_dispatch:
push:
branches:
- main
paths:
- '**'
- '!**/README*'
- '!**/CONTRIBUTING*'
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
all-tests:
name: Tests ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
extra_nix_config: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
substituters = https://cache.nixos.org
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
max-jobs = auto
cores = 0
substitute = true
builders-use-substitutes = true
fallback = true
connect-timeout = 5
stalled-download-timeout = 90
timeout = 0
- name: Setup
run: |
echo "# ============================================================================ #" >&2;
{ printf ' bash version: '; bash --version|head -n1; } >&2;
{ printf ' nix version: '; nix --version; } >&2;
echo "# ---------------------------------------------------------------------------- #" >&2;
echo 'Development Environment Versions:' >&2;
{
printf ' nix version ';
nix develop --no-update-lock-file --command nix --version;
} >&2;
{
printf ' CXX version ';
nix develop --no-update-lock-file --command sh -c '$CXX --version'|head -n1;
} >&2;
echo "# ============================================================================ #" >&2;
- name: Run Build
run: nix develop --no-update-lock-file --command make -j4
- name: Build Tests
run: nix develop --no-update-lock-file --command make tests -j4
- name: Nix Flake Check
run: nix flake check
# This is performed to reduce cpu/memory overhead in tests later.
# NOTE: Ensure this `rev' is aligned with `<pkgdb>/tests/setup_suite.bats'
- name: Warm Nix Eval Caches
run: |
set -eu;
set -o pipefail;
rev="e8039594435c68eb4f780f3e9bf3972a7399c4b1"
echo "Priming Eval Cache: nixpkgs/$rev" >&2;
NIX_SYSTEM="$(
nix eval --raw --impure --expr builtins.currentSystem;
)";
nix flake show --legacy "github:NixOS/nixpkgs/$rev" \
--system "$NIX_SYSTEM" >/dev/null;
- name: Run Tests
run: nix develop --no-update-lock-file --command make check -j4
# Aggregate test results
all-tests-success:
if: ${{ always() }}
runs-on: ubuntu-latest
name: Tests ( All Systems )
needs: all-tests
steps:
- if: >-
${{
contains( needs.*.result, 'failure' ) ||
contains( needs.*.result, 'cancelled' )
}}
run: exit 1