-
Notifications
You must be signed in to change notification settings - Fork 1
176 lines (148 loc) · 4.31 KB
/
main.yaml
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: 'CI'
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build-nix:
name: Build Nix package
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v26
with:
extra_nix_config: |
experimental-features = nix-command flakes recursive-nix
- name: Verify flake.lock is up-to-date
run: |
nix flake lock --no-update-lock-file
- name: Build package
run: |
nix build -L
check:
name: Run our Action
runs-on: ubuntu-latest
strategy:
matrix:
fetch-depth:
- 0 # all history
- 1 # shallow clone
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: ${{ matrix.fetch-depth }}
- name: Install Nix
uses: cachix/install-nix-action@v26
with:
extra_nix_config: |
experimental-features = nix-command flakes recursive-nix
- name: 'Setup Cachix'
uses: cachix/cachix-action@v14
with:
name: wurzelpfropf
authToken: '${{ secrets.CACHIX_AUTH_TOKEN_PUBLIC }}'
- name: Run Action (packages)
uses: ./
with:
packages: 'hello'
- name: Run hello
run: |
hello
- name: Run Action (expr)
uses: ./
with:
expr: 'pkgs.figlet'
- name: Run Action (packages + expr)
uses: ./
with:
packages: 'cowsay'
expr: 'pkgs.ponysay'
- name: Run `cowsay` and `ponysay`
run: |
cowsay "Muhhhh"
ponysay "Hüüühhhhh"
- name: Run Action (GitHub Flake with default package)
uses: ./
with:
packages: 'github:yaxitech/ragenix'
- name: Run `ragenix`
run: |
ragenix --help
- name: Run Action (package with inputs-from)
uses: ./
id: 'inputs-from-jq'
with:
packages: 'jq'
inputs-from: 'github:yaxitech/ragenix'
- name: Verify `nixpkgs` from `github:yaxitech/ragenix`
run: |
nix profile list --profile '${{ steps.inputs-from-jq.outputs.nix_profile_path }}'
rev=$(nix flake metadata --json "github:yaxitech/ragenix" | jq -r .locks.nodes.nixpkgs.locked.rev)
nix profile list --profile '${{ steps.inputs-from-jq.outputs.nix_profile_path }}' --json | jq -r '.elements.jq.url' | grep -q "$rev"
- name: List installed packages
run:
nix profile list --profile "$STATE_NIX_PROFILE_TMPDIR"/.nix-profile
- name: Run figlet
run: |
figlet WURZELPFROPF
build:
name: Build bundled action
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# We need a full checkout for a Git diff
fetch-depth: 0
- name: Install Nix
uses: cachix/install-nix-action@v26
with:
extra_nix_config: |
experimental-features = nix-command flakes recursive-nix
- name: Install job dependencies
uses: ./
with:
expr: 'pkgs.python3.withPackages (ps: [ps.GitPython])'
- name: Build action
run: |
python .github/steps/build_action.py
coverage:
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# We need a full checkout for the tests
fetch-depth: 0
- name: Install Nix
uses: cachix/install-nix-action@v26
with:
extra_nix_config: |
experimental-features = nix-command flakes recursive-nix
- name: Run tests with coverage
run: |
nix develop -c npm install
nix develop -c npm run coverage
- name: Install job dependencies
if: github.ref == 'refs/heads/main'
uses: ./
with:
expr: |
pkgs.python3.withPackages (ps: with ps; [ ghp-import ])
- name: Push badge
if: github.ref == 'refs/heads/main'
run: |
python .github/steps/push_badge.py