Skip to content

Commit

Permalink
fix(ci):
Browse files Browse the repository at this point in the history
- use nix 2.21 because it has a new profile format
- use custom nix-quick-install action because it supports nix 2.21
- fix indentation
  • Loading branch information
deemp committed Apr 30, 2024
1 parent e2b263e commit 9b49a95
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 52 deletions.
38 changes: 18 additions & 20 deletions .github/workflows/buildjet-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ jobs:
with:
submodules: true

- uses: nixbuild/nix-quick-install-action@v27
- uses: deemp/nix-quick-install-action@v27
with:
nix_version: 2.21.0

- name: Restore and save Nix store
uses: ./.
Expand Down Expand Up @@ -100,7 +102,9 @@ jobs:
|| format('git pull --rebase origin {0}', github.ref_name)
}}
- uses: nixbuild/nix-quick-install-action@v27
- uses: deemp/nix-quick-install-action@v27
with:
nix_version: 2.21.0

- name: Restore and save Nix store - ${{ matrix.id }}
uses: ./.
Expand Down Expand Up @@ -159,7 +163,9 @@ jobs:
|| format('git pull --rebase origin {0}', github.ref_name)
}}
- uses: nixbuild/nix-quick-install-action@v27
- uses: deemp/nix-quick-install-action@v27
with:
nix_version: 2.21.0

- name: Restore and save Nix store
uses: ./.
Expand Down Expand Up @@ -195,13 +201,7 @@ jobs:
- name: Check that the profile doesn't have anything apart from `nix`
shell: bash
run: |
nix profile list --json \
| jq '
.elements
| keys
| map(select(. != "nix"))
| if . != [] then error(.) else . end
'
[[ "$(nix profile list --json | jq -rc '.elements | keys.[]')" == "nix" ]]
- name: Install nixpkgs#poetry
run: nix profile install nixpkgs#poetry
Expand All @@ -217,7 +217,7 @@ jobs:

# Check that the `common` cache is restored correctly
merge-similar-caches-check:
name: Merge similar caches
name: Ensure a `common` cache is restored correctly
needs: merge-similar-caches
permissions:
actions: write
Expand All @@ -241,7 +241,9 @@ jobs:
|| format('git pull --rebase origin {0}', github.ref_name)
}}
- uses: nixbuild/nix-quick-install-action@v27
- uses: deemp/nix-quick-install-action@v27
with:
nix_version: 2.21.0

- name: Restore Nix store
uses: ./restore
Expand All @@ -264,13 +266,7 @@ jobs:
- name: Check that the profile doesn't have anything apart from `nix`
shell: bash
run: |
nix profile list --json \
| jq '
.elements
| keys
| map(select(. != "nix"))
| if . != [] then error(.) else . end
'
[[ "$(nix profile list --json | jq -rc '.elements | keys.[]')" == "nix" ]]
- name: Install nixpkgs#poetry
run: nix profile install nixpkgs#poetry
Expand Down Expand Up @@ -313,7 +309,9 @@ jobs:
|| format('git pull --rebase origin {0}', github.ref_name)
}}
- uses: nixbuild/nix-quick-install-action@v27
- uses: deemp/nix-quick-install-action@v27
with:
nix_version: 2.21.0

- name: Restore and save Nix store
if: ${{ matrix.do-cache }}
Expand Down
38 changes: 18 additions & 20 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ jobs:
with:
submodules: true

- uses: nixbuild/nix-quick-install-action@v27
- uses: deemp/nix-quick-install-action@v27
with:
nix_version: 2.21.0

- name: Restore and save Nix store
uses: ./.
Expand Down Expand Up @@ -108,7 +110,9 @@ jobs:
|| format('git pull --rebase origin {0}', github.ref_name)
}}
- uses: nixbuild/nix-quick-install-action@v27
- uses: deemp/nix-quick-install-action@v27
with:
nix_version: 2.21.0

- name: Restore and save Nix store - ${{ matrix.id }}
uses: ./.
Expand Down Expand Up @@ -165,7 +169,9 @@ jobs:
|| format('git pull --rebase origin {0}', github.ref_name)
}}
- uses: nixbuild/nix-quick-install-action@v27
- uses: deemp/nix-quick-install-action@v27
with:
nix_version: 2.21.0

- name: Restore and save Nix store
uses: ./.
Expand Down Expand Up @@ -199,13 +205,7 @@ jobs:
- name: Check that the profile doesn't have anything apart from `nix`
shell: bash
run: |
nix profile list --json \
| jq '
.elements
| keys
| map(select(. != "nix"))
| if . != [] then error(.) else . end
'
[[ "$(nix profile list --json | jq -rc '.elements | keys.[]')" == "nix" ]]
- name: Install nixpkgs#poetry
run: nix profile install nixpkgs#poetry
Expand All @@ -221,7 +221,7 @@ jobs:

# Check that the `common` cache is restored correctly
merge-similar-caches-check:
name: Merge similar caches
name: Ensure a `common` cache is restored correctly
needs: merge-similar-caches
permissions:
actions: write
Expand All @@ -245,7 +245,9 @@ jobs:
|| format('git pull --rebase origin {0}', github.ref_name)
}}
- uses: nixbuild/nix-quick-install-action@v27
- uses: deemp/nix-quick-install-action@v27
with:
nix_version: 2.21.0

- name: Restore Nix store
uses: ./restore
Expand All @@ -265,13 +267,7 @@ jobs:
- name: Check that the profile doesn't have anything apart from `nix`
shell: bash
run: |
nix profile list --json \
| jq '
.elements
| keys
| map(select(. != "nix"))
| if . != [] then error(.) else . end
'
[[ "$(nix profile list --json | jq -rc '.elements | keys.[]')" == "nix" ]]
- name: Install nixpkgs#poetry
run: nix profile install nixpkgs#poetry
Expand Down Expand Up @@ -314,7 +310,9 @@ jobs:
|| format('git pull --rebase origin {0}', github.ref_name)
}}
- uses: nixbuild/nix-quick-install-action@v27
- uses: deemp/nix-quick-install-action@v27
with:
nix_version: 2.21.0

- name: Restore and save Nix store
if: ${{ matrix.do-cache }}
Expand Down
24 changes: 12 additions & 12 deletions nix/ci.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ let
&& format('gh pr checkout {0}', github.event.pull_request.number)
|| format('git pull --rebase origin {0}', github.ref_name)
}}'';

nix-quick-install-action = ''
- uses: deemp/nix-quick-install-action@v27
with:
nix_version: 2.21.0
'';
in
''
name: Nix CI ${name}
Expand All @@ -67,7 +73,7 @@ in
with:
submodules: true
- uses: nixbuild/nix-quick-install-action@v27
${indent 6 nix-quick-install-action}
- name: Restore and save Nix store
uses: ./.
Expand Down Expand Up @@ -137,7 +143,7 @@ in
run: |
${ git_pull }
- uses: nixbuild/nix-quick-install-action@v27
${indent 6 nix-quick-install-action}
- name: Restore and save Nix store - ''${{ matrix.id }}
uses: ./.
Expand Down Expand Up @@ -181,7 +187,7 @@ in
# Purge `individual` caches and old `common` caches
# Save new `common` caches''}
merge-similar-caches${choose "-check" ""}:
name: Merge similar caches
name: ${choose "Ensure a `common` cache is restored correctly" "Merge similar caches"}
needs: ${choose "merge-similar-caches" "make-similar-caches"}
permissions:
actions: write
Expand All @@ -201,7 +207,7 @@ in
run: |
${ git_pull }
- uses: nixbuild/nix-quick-install-action@v27
${indent 4 nix-quick-install-action}
- name: Restore${choose "" " and save"} Nix store
uses: ./${if check then "restore" else "."}
Expand Down Expand Up @@ -241,13 +247,7 @@ in
- name: Check that the profile doesn't have anything apart from `nix`
shell: bash
run: |
nix profile list --json \
| jq '
.elements
| keys
| map(select(. != "nix"))
| if . != [] then error(.) else . end
'
[[ "$(nix profile list --json | jq -rc '.elements | keys.[]')" == "nix" ]]
- name: Install nixpkgs#poetry
run: nix profile install nixpkgs#poetry
Expand Down Expand Up @@ -293,7 +293,7 @@ in
run: |
${ git_pull }
- uses: nixbuild/nix-quick-install-action@v27
${indent 6 nix-quick-install-action}
- name: Restore and save Nix store
if: ''${{ matrix.do-cache }}
Expand Down

0 comments on commit 9b49a95

Please sign in to comment.