46
46
DEVBOX_DEBUG : 1
47
47
48
48
jobs :
49
+ build-devbox :
50
+ strategy :
51
+ matrix :
52
+ os : [ubuntu-latest, macos-latest]
53
+ runs-on : ${{ matrix.os }}
54
+ steps :
55
+ - uses : actions/checkout@v3
56
+ - uses : actions/setup-go@v4
57
+ with :
58
+ go-version-file : ./go.mod
59
+ - name : Mount golang cache
60
+ uses : actions/cache@v3
61
+ with :
62
+ path : |
63
+ ~/.cache/go-build
64
+ ~/go/pkg
65
+ key : go-devbox-build-${{ runner.os }}-${{ hashFiles('go.sum') }}
66
+ - name : Build devbox
67
+ run : go build -o dist/devbox ./cmd/devbox
68
+ - name : Upload devbox artifact
69
+ uses : actions/upload-artifact@v3
70
+ with :
71
+ name : devbox-${{ runner.os }}-${{ runner.arch }}
72
+ path : ./dist/devbox
73
+ retention-days : 7
74
+
49
75
typos :
50
76
name : Spell Check with Typos
51
77
if : github.ref != 'refs/heads/main'
55
81
-
uses :
crate-ci/[email protected]
56
82
57
83
golangci-lint :
84
+ needs : build-devbox
58
85
strategy :
59
86
matrix :
60
87
os : [ubuntu-latest, macos-latest]
70
97
cache : false
71
98
72
99
# This can be reanabled once released version supports runx
100
+ # and we can remove needs: build-devbox
73
101
# - name: Install devbox
74
102
# uses: jetpack-io/[email protected]
75
103
# with:
@@ -84,16 +112,19 @@ jobs:
84
112
~/go/pkg
85
113
key : go-${{ runner.os }}-${{ hashFiles('go.sum') }}
86
114
87
- # Use main devbox for now to ensure it supports runx
88
- - run : go run ./cmd/devbox run fmt
89
-
90
- - name : golangci-lint
91
-
115
+ - name : Download devbox
116
+ uses : actions/download-artifact@v3
92
117
with :
93
- args : " --out-${NO_FUTURE}format colored-line-number --timeout=10m"
94
- skip-cache : true
118
+ name : devbox-${{ runner.os }}-${{ runner.arch }}
119
+ - name : Add devbox to path
120
+ run : |
121
+ chmod +x ./devbox
122
+ sudo mv ./devbox /usr/local/bin/
123
+
124
+ - run : devbox run lint
95
125
96
126
test :
127
+ needs : build-devbox
97
128
strategy :
98
129
matrix :
99
130
is-main :
@@ -117,7 +148,7 @@ jobs:
117
148
os : macos-latest
118
149
119
150
runs-on : ${{ matrix.os }}
120
- timeout-minutes : ${{ (github.ref == 'refs/heads/main' || inputs.run-mac-tests) && 37 || 25 }}
151
+ timeout-minutes : 37
121
152
steps :
122
153
- name : Maximize build disk space
123
154
uses : easimon/maximize-build-space@v8
@@ -133,8 +164,13 @@ jobs:
133
164
- uses : actions/setup-go@v4
134
165
with :
135
166
go-version-file : ./go.mod
136
- - name : Build devbox
137
- run : go install ./cmd/devbox
167
+ - name : Mount golang cache
168
+ uses : actions/cache@v3
169
+ with :
170
+ path : |
171
+ ~/.cache/go-build
172
+ ~/go/pkg
173
+ key : go-devbox-tests-${{ runner.os }}-${{ hashFiles('go.sum') }}
138
174
- name : Install additional shells (dash, zsh)
139
175
run : |
140
176
if [ "$RUNNER_OS" == "Linux" ]; then
@@ -171,17 +207,21 @@ jobs:
171
207
go test -v -timeout $DEVBOX_GOLANG_TEST_TIMEOUT ./...
172
208
173
209
auto-nix-install : # ensure Devbox installs nix and works properly after installation.
210
+ needs : build-devbox
174
211
strategy :
175
212
matrix :
176
213
os : [ubuntu-latest, macos-latest]
177
214
runs-on : ${{ matrix.os }}
178
215
steps :
179
216
- uses : actions/checkout@v3
180
- - uses : actions/setup-go@v4
217
+ - name : Download devbox
218
+ uses : actions/download-artifact@v3
181
219
with :
182
- go-version-file : ./go.mod
183
- - name : Build devbox
184
- run : go install ./cmd/devbox
220
+ name : devbox-${{ runner.os }}-${{ runner.arch }}
221
+ - name : Add devbox to path
222
+ run : |
223
+ chmod +x ./devbox
224
+ sudo mv ./devbox /usr/local/bin/
185
225
- name : Install nix and devbox packages
186
226
run : |
187
227
export NIX_INSTALLER_NO_CHANNEL_ADD=1
@@ -198,18 +238,22 @@ jobs:
198
238
# Run a sanity test to make sure Devbox can install and remove packages with
199
239
# the last 3 Nix releases.
200
240
test-nix-versions :
241
+ needs : build-devbox
201
242
strategy :
202
243
matrix :
203
244
os : [ubuntu-latest, macos-latest]
204
245
nix-version : [2.15.1, 2.16.1, 2.17.0, 2.18.0]
205
246
runs-on : ${{ matrix.os }}
206
247
steps :
207
248
- uses : actions/checkout@v3
208
- - uses : actions/setup-go@v4
249
+ - name : Download devbox
250
+ uses : actions/download-artifact@v3
209
251
with :
210
- go-version-file : ./go.mod
211
- - name : Build devbox
212
- run : go install ./cmd/devbox
252
+ name : devbox-${{ runner.os }}-${{ runner.arch }}
253
+ - name : Add devbox to path
254
+ run : |
255
+ chmod +x ./devbox
256
+ sudo mv ./devbox /usr/local/bin/
213
257
- name : Install Nix
214
258
uses : DeterminateSystems/nix-installer-action@v4
215
259
with :
0 commit comments