-
Notifications
You must be signed in to change notification settings - Fork 110
98 lines (82 loc) · 2.98 KB
/
continuous-integration.yml
File metadata and controls
98 lines (82 loc) · 2.98 KB
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
name: Continuous integration
on:
push:
branches:
- master
pull_request:
merge_group:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-test:
strategy:
matrix:
include:
- os: ubuntu-24.04
name: linux
- os: macos-15
name: macos
name: build-and-test (${{ matrix.name }})
runs-on: ${{ matrix.os }}
steps:
- name: Checking out the repository
uses: actions/checkout@v6
with:
fetch-depth: 0
# Last I checked, the ubuntu runners have a root filesystem with 23G free
# and a /mnt with 66G free. Putting /nix in /mnt seems to stop us from
# running out of disk space. (There are also actions available that do
# more drastic things.)
- name: Loop mount
if: runner.os == 'Linux'
run: |
sudo mkdir /mnt/nix
sudo mkdir /nix
sudo mount --bind /mnt/nix /nix
- name: Install Nix
uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
experimental-features = nix-command flakes
accept-flake-config = true
keep-outputs = true
keep-derivations = true
- name: Nix cache
uses: nix-community/cache-nix-action@v7
with:
primary-key: ci-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}
restore-prefixes-first-match: ci-${{ runner.os }}-
purge: true
# This was the only way I could figure out to stop cache-nix-action from
# purging the cache that it just created. The "purge: true" above makes
# it purge the old cache just before trying to save a new one. This line
# makes it not purge anything after saving.
purge-prefixes: non-existent-prefix-
- name: Run all checks
run: |
# This is basically `nix flake check`, except that it creates extra GC
# roots. Then we run a GC to get rid of anything that's unlikely to be
# useful to cache.
SYSTEM=$(nix eval --impure --raw --expr builtins.currentSystem)
nix eval .#checks.${SYSTEM} --apply builtins.attrNames --json \
| jq -r '.[]' \
| xargs -I {} nix build .#checks.${SYSTEM}.{} --out-link .check-{} --print-build-logs
nix store gc
# FIXME: this is broken right now: we don't have nickel installed. And I think
# maybe we'd prefer to use the nickel we just built? Anyway, it was already broken
# so we'll fix it later.
- name: Typecheck benchmarks
run: find core/benches -type f -name "*.ncl" -exec nickel typecheck '{}' \;
build-and-test-windows:
name: "build-and-test (windows-latest)"
runs-on: windows-latest
continue-on-error: true
steps:
- uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Build
run: cargo build --all-targets --package nickel-lang-*
- name: Test
run: cargo test --package nickel-lang-*