-
-
Notifications
You must be signed in to change notification settings - Fork 455
103 lines (89 loc) · 3.12 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
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
name: CI
on:
pull_request:
merge_group:
concurrency:
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
sort-build-systems:
runs-on: ubuntu-22.04
steps:
- uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: actions/checkout@v4
- name: Check format
run: nix-shell --packages jq diffutils --run "diff --unified overrides/build-systems.json <(jq --from-file overrides/sort-build-systems.jq --raw-output --sort-keys < overrides/build-systems.json)"
nix-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v23
- id: set-matrix
name: Generate Nix Matrix
run: |
set -Eeu
echo "matrix=$(nix eval --json '.#githubActions.matrix')" >> "$GITHUB_OUTPUT"
nix-build:
needs: nix-matrix
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.nix-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v23
- uses: cachix/cachix-action@v12
with:
name: poetry2nix
signingKey: "VhaWuN3IyJVpWg+aZvTocVB+W8ziZKKRGLKR53Pkld3YRZxYOUfXZf0fvqF+LkqVW0eA60trVd5vsqNONpX9Hw=="
- run: nix build -L ".#${{ matrix.attr }}" --keep-going
test-template:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v23
- uses: cachix/cachix-action@v12
with:
name: poetry2nix
signingKey: "VhaWuN3IyJVpWg+aZvTocVB+W8ziZKKRGLKR53Pkld3YRZxYOUfXZf0fvqF+LkqVW0eA60trVd5vsqNONpX9Hw=="
- name: create flake template test directory
run: echo "TESTDIR=$(mktemp -d)" >> "$GITHUB_ENV"
- name: initialize flake from poetry2nix template
working-directory: ${{ env.TESTDIR }}
run: nix flake init --template "$GITHUB_WORKSPACE"
- name: force flake to our poetry2nix version
working-directory: ${{ env.TESTDIR }}
run: nix flake lock --override-input poetry2nix "$GITHUB_WORKSPACE"
- name: generate pyproject.toml
working-directory: ${{ env.TESTDIR }}
run: nix develop -c poetry init --name=poetry2nix-template-test --quiet
- name: generate poetry.lock
working-directory: ${{ env.TESTDIR }}
run: nix develop -c poetry lock --no-update
- name: create a minimal python package
working-directory: ${{ env.TESTDIR }}
run: |
touch README.md
mkdir poetry2nix_template_test
touch poetry2nix_template_test/__init__.py
- name: build the flake
working-directory: ${{ env.TESTDIR }}
run: nix build --keep-going -L --show-trace
collect:
runs-on: ubuntu-latest
needs:
- nix-build
- sort-build-systems
- test-template
steps:
- run: exit 0