-
Notifications
You must be signed in to change notification settings - Fork 5
41 lines (35 loc) · 1.37 KB
/
ci.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
name: CI
on:
push:
branches:
- main
pull_request:
jobs:
ci:
runs-on: ubuntu-latest
steps:
# This step should be a no-op on actual GitHub Actions, but it is necessary when using the "Micro" image with
# https://github.com/nektos/act. See https://github.com/nektos/act/issues/107 and
# https://github.com/nektos/act/issues/269.
#
# We use `sudo --version` to selectively run the install only when not on GitHub Actions.
- run: sudo --version || (apt update && apt install -y curl git sudo xz-utils)
- uses: "cachix/install-nix-action@v22"
with:
extra_nix_config: experimental-features = nix-command flakes
nix_path: nixpkgs=channel:nixos-unstable
- name: nix-info
run: "nix-shell -p nix-info --run 'nix-info -m'"
- name: Checkout
uses: actions/checkout@v4
- name: Lint
run: "nix develop --command ruff check ."
- name: Format
run: "nix develop --command ruff format --diff ."
# `nix build` also runs pytest, but it does so in a restrictive sandbox that disallows network. This means that we
# can't run any tests that download weights. Running outside of the nix build environment allows us to run those
# tests as well.
- name: pytest
run: "nix develop --command pytest"
- name: Build
run: "nix build"