-
Notifications
You must be signed in to change notification settings - Fork 92
136 lines (129 loc) · 4.79 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: "Run test suite"
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- 'master'
- 'ci*' # Allow testing CI fixes without opening a PR
permissions:
contents: read
jobs:
tests-pass:
name: all systems go
runs-on: ubuntu-latest
if: ${{ always() && contains(needs.*.result, 'failure') }}
steps:
- run: exit 1
needs:
- check-dead-code
- check-fmt
- examples-darwin
- examples-linux
- tests
tests:
strategy:
# Allow other jobs to finish building and cache properly before bailing
fail-fast: false
matrix:
include:
# Latest and greatest release of Nix
- install_url: https://nixos.org/nix/install
# The 24.11 branch ships with Nix 2.24.10
- install_url: https://releases.nixos.org/nix/nix-2.24.10/install
nixpkgs-override: "--override-input nixpkgs $(./ci/ref-from-lock.sh ./test#nixpkgs-latest-release)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
with:
install_url: ${{ matrix.install_url }}
- uses: cachix/cachix-action@v15
with:
name: crane
authToken: ${{ github.ref == 'refs/heads/master' && secrets.CACHIX_AUTH_TOKEN || '' }}
- name: flake checks
run: nix develop --accept-flake-config --command ./ci/fast-flake-check.sh . ${{ matrix.nixpkgs-override }}
- name: extra tests
run: nix develop --accept-flake-config --command ./extra-tests/test.sh
examples-linux:
strategy:
# Allow other jobs to finish building and cache properly before bailing
fail-fast: false
matrix:
example:
- alt-registry
- build-std
- cross-musl
- cross-rust-overlay
- cross-windows
- custom-toolchain
- end-to-end-testing
- quick-start
- quick-start-simple
- quick-start-workspace
- sqlx
- trunk-workspace
- trunk
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
- uses: cachix/cachix-action@v15
with:
name: crane
authToken: ${{ github.ref == 'refs/heads/master' && secrets.CACHIX_AUTH_TOKEN || '' }}
- name: validate examples
# Nix won't write a lockfile when --override-input is used (which is good because it will
# complain that the lock file is .gitignored), but nix-eval-jobs doesn't, so we'll have to
# "opt-out" of our lockfile .gitignore
run: |
rm ./examples/.gitignore
nix develop .# --accept-flake-config --command ./ci/check-example.sh ./examples/${{ matrix.example }} "./test#nixpkgs"
examples-darwin:
strategy:
# Allow other jobs to finish building and cache properly before bailing
fail-fast: false
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
- uses: cachix/cachix-action@v15
with:
name: crane
authToken: ${{ github.ref == 'refs/heads/master' && secrets.CACHIX_AUTH_TOKEN || '' }}
- name: validate examples
# Nix won't write a lockfile when --override-input is used (which is good because it will
# complain that the lock file is .gitignored), but nix-eval-jobs doesn't, so we'll have to
# "opt-out" of our lockfile .gitignore
run: |
rm ./examples/.gitignore
nix develop .# --accept-flake-config --command bash -c '
set -euo pipefail
for f in $(find ./examples -maxdepth 1 -mindepth 1 -type d -not -name build-std -not -name cross-musl -not -name cross-rust-overlay | sort -u); do
# NB: nix-eval-jobs appears broken on darwin atm?
# /nix/store/2419grj384lg233jqchamm73il9iyjxg-libcxx-16.0.6-dev/include/c++/v1/optional:962: assertion this->has_value() failed: optional operator* called on a disengaged valueerror: error: while checking worker process, evaluation worker got killed by signal 6 (Abort trap: 6)
nix flake check \
--accept-flake-config \
--print-build-logs \
--reference-lock-file ./test/flake.lock \
--override-input crane ./. \
"${f}"
done
'
check-dead-code:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: check for dead code
run: nix run github:astro/deadnix -- .
check-fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: check formatting
run: nix fmt --accept-flake-config -- --check .