@@ -31,6 +31,12 @@ permissions:
31
31
contents : read
32
32
pull-requests : read
33
33
34
+ defaults :
35
+ run :
36
+ # Explicitly setting the shell to bash runs commands with
37
+ # `bash --noprofile --norc -eo pipefail` instead of `bash -e`.
38
+ shell : bash
39
+
34
40
env :
35
41
HOMEBREW_GITHUB_API_TOKEN : ${{ secrets.GITHUB_TOKEN }}"
36
42
HOMEBREW_NO_ANALYTICS : 1
@@ -102,10 +108,10 @@ jobs:
102
108
brew install dash zsh
103
109
fi
104
110
- name : Install Nix
105
- uses : DeterminateSystems/nix-installer-action@v1
111
+ uses : DeterminateSystems/nix-installer-action@v4
106
112
with :
107
113
logger : pretty
108
- nix-build-user-count : 4
114
+ extra-conf : experimental-features = ca-derivations fetch-closure
109
115
- name : Run tests
110
116
env :
111
117
# For devbox.json tests, we default to non-debug mode since the debug output is less useful than for unit testscripts.
@@ -115,6 +121,15 @@ jobs:
115
121
# Used in `go test -timeout` flag. Needs a value that time.ParseDuration can parse.
116
122
DEVBOX_GOLANG_TEST_TIMEOUT : " ${{ (github.ref == 'refs/heads/main' || inputs.run-mac-tests) && '35m' || '20m' }}"
117
123
run : |
124
+ echo "::group::Nix version"
125
+ nix --version
126
+ echo "::endgroup::"
127
+ echo "::group::Contents of /etc/nix/nix.conf"
128
+ cat /etc/nix/nix.conf || true
129
+ echo "::endgroup::"
130
+ echo "::group::Resolved Nix config"
131
+ nix show-config
132
+ echo "::endgroup::"
118
133
go test -v -timeout $DEVBOX_GOLANG_TEST_TIMEOUT ./...
119
134
120
135
auto-nix-install : # ensure Devbox installs nix and works properly after installation.
@@ -141,12 +156,14 @@ jobs:
141
156
devbox run echo "Installing packages..."
142
157
- name : Test removing package
143
158
run : devbox rm go
144
-
145
- test-with-old-nix-version :
159
+
160
+ # Run a sanity test to make sure Devbox can install and remove packages with
161
+ # the last 3 Nix releases.
162
+ test-nix-versions :
146
163
strategy :
147
164
matrix :
148
165
os : [ubuntu-latest, macos-latest]
149
- version : [2.15.1]
166
+ version : [2.15.1, 2.16.1, 2.17.0 ]
150
167
runs-on : ${{ matrix.os }}
151
168
steps :
152
169
- uses : actions/checkout@v3
@@ -155,15 +172,23 @@ jobs:
155
172
go-version-file : ./go.mod
156
173
- name : Build devbox
157
174
run : go install ./cmd/devbox
158
- - name : Install nix
159
- run : sh <(curl -L https://releases.nixos.org/nix/nix-${{ matrix.version }}/install) --daemon
160
- - name : Install devbox packages
175
+ - name : Install Nix
176
+ uses : DeterminateSystems/nix-installer-action@v4
177
+ with :
178
+ logger : pretty
179
+ extra-conf : experimental-features = ca-derivations fetch-closure
180
+ nix-package-url : https://releases.nixos.org/nix/nix-${{ matrix.version }}/nix-${{ matrix.version }}-${{ runner.arch == 'X64' && 'x86_64' || 'aarch64' }}-${{ runner.os == 'macOS' && 'darwin' || 'linux' }}.tar.xz
181
+ - name : Run devbox install, devbox run, devbox rm
161
182
run : |
162
- # Setup github authentication to ensure Github's rate limits are not hit.
163
- # If this works, we can consider refactoring this into a reusable github action helper.
164
- mkdir -p ~/.config/nix
165
- echo "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" > ~/.config/nix/nix.conf
166
-
167
- devbox run echo "Installing packages..."
168
- - name : Test removing package
169
- run : devbox rm go
183
+ echo "::group::Nix version"
184
+ nix --version
185
+ echo "::endgroup::"
186
+ echo "::group::Contents of /etc/nix/nix.conf"
187
+ cat /etc/nix/nix.conf || true
188
+ echo "::endgroup::"
189
+ echo "::group::Resolved Nix config"
190
+ nix show-config
191
+ echo "::endgroup::"
192
+ devbox install
193
+ devbox run -- echo "Hello from devbox!"
194
+ devbox rm go
0 commit comments