Check expected Nix versions using script

This commit is contained in:
Luc Perkins 2024-05-17 11:04:45 -03:00
parent 74f4d10531
commit 164c9d00dc
No known key found for this signature in database
GPG key ID: 16DB1108FB591835
3 changed files with 33 additions and 10 deletions

10
.editorconfig Normal file
View file

@ -0,0 +1,10 @@
# https://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

13
.github/verify-version.sh vendored Executable file
View file

@ -0,0 +1,13 @@
#!/usr/bin/env
EXPECTED_VERSION="${1}"
NIX_VERSION_OUTPUT=$(nix --version)
NIX_VERSION=$(echo "${NIX_VERSION_OUTPUT}" | awk '{print $NF}')
EXPECTED_OUTPUT="nix (Nix) ${EXPECTED_VERSION}"
if [ "${NIX_VERSION_OUTPUT}" != "${EXPECTED_OUTPUT}" ]; then
echo "Nix version ${NIX_VERSION} didn't match expected version ${EXPECTED_VERSION}"
exit 1
else
echo "Success! Nix version ${NIX_VERSION} installed as expected"
fi

View file

@ -222,37 +222,37 @@ jobs:
uses: ./ uses: ./
with: with:
source-url: https://github.com/DeterminateSystems/nix-installer/releases/download/v0.18.0/nix-installer-x86_64-linux source-url: https://github.com/DeterminateSystems/nix-installer/releases/download/v0.18.0/nix-installer-x86_64-linux
- name: Ensure that Nix is installed via alternative source-url - name: Ensure that the expected Nix version is installed via alternative source-url
run: nix --version run: .github/verify-version.sh 2.18.0
- name: Install with alternative source-pr - name: Install with alternative source-pr
uses: ./ uses: ./
with: with:
# https://github.com/DeterminateSystems/nix-installer/pull/938 # https://github.com/DeterminateSystems/nix-installer/pull/938
source-pr: "938" source-pr: "938"
- name: Ensure that Nix is installed via alternative source-pr - name: Ensure that the expected Nix version is installed via alternative source-pr
run: nix --version run: .github/verify-version.sh 2.21.2
- name: Install with alternative source-revision - name: Install with alternative source-revision
uses: ./ uses: ./
with: with:
# https://github.com/DeterminateSystems/nix-installer/tree/ccf1d39a83099657ad324e7927676432435431e1 # https://github.com/DeterminateSystems/nix-installer/tree/ccf1d39a83099657ad324e7927676432435431e1
source-revision: "ccf1d39a83099657ad324e7927676432435431e1" source-revision: "ccf1d39a83099657ad324e7927676432435431e1"
- name: Ensure that Nix is installed via alternative source-revision - name: Ensure that the expected Nix version is installed via alternative source-revision
run: nix --version run: .github/verify-version.sh 2.21.2
- name: Install with alternative source-branch - name: Install with alternative source-branch
uses: ./ uses: ./
with: with:
# https://github.com/DeterminateSystems/nix-installer/tree/lazy-trees # https://github.com/DeterminateSystems/nix-installer/tree/lazy-trees
source-revision: "lazy-trees" source-revision: "lazy-trees"
- name: Ensure that Nix is installed via alternative source-branch - name: Ensure that the expected Nix version is installed via alternative source-branch
run: nix --version run: .github/verify-version.sh 2.21.2
- name: Install with alternative source-tag - name: Install with alternative source-tag
uses: ./ uses: ./
with: with:
# https://github.com/DeterminateSystems/nix-installer/tree/v0.14.0 # https://github.com/DeterminateSystems/nix-installer/tree/v0.14.0
source-tag: "v0.14.0" source-tag: "v0.14.0"
- name: Ensure that Nix is installed via alternative source-tag - name: Ensure that the expected Nix version is installed via alternative source-tag
run: nix --version run: .github/verify-version.sh 2.18.0