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 62d9ccf
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 52 deletions.
43 changes: 23 additions & 20 deletions .github/workflows/buildjet-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ jobs:
with:
submodules: true

- uses: nixbuild/nix-quick-install-action@v27
- uses: deemp/nix-quick-install-action@v27
with:
nix_archives_url: https://github.com/deemp/nix-quick-install-action/releases/download/v27
nix_version: 2.21.0

- name: Restore and save Nix store
uses: ./.
Expand Down Expand Up @@ -100,7 +103,10 @@ 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_archives_url: https://github.com/deemp/nix-quick-install-action/releases/download/v27
nix_version: 2.21.0

- name: Restore and save Nix store - ${{ matrix.id }}
uses: ./.
Expand Down Expand Up @@ -159,7 +165,10 @@ 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_archives_url: https://github.com/deemp/nix-quick-install-action/releases/download/v27
nix_version: 2.21.0

- name: Restore and save Nix store
uses: ./.
Expand Down Expand Up @@ -195,13 +204,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 +220,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 +244,10 @@ 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_archives_url: https://github.com/deemp/nix-quick-install-action/releases/download/v27
nix_version: 2.21.0

- name: Restore Nix store
uses: ./restore
Expand All @@ -264,13 +270,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 +313,10 @@ 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_archives_url: https://github.com/deemp/nix-quick-install-action/releases/download/v27
nix_version: 2.21.0

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

- uses: nixbuild/nix-quick-install-action@v27
- uses: deemp/nix-quick-install-action@v27
with:
nix_archives_url: https://github.com/deemp/nix-quick-install-action/releases/download/v27
nix_version: 2.21.0

- name: Restore and save Nix store
uses: ./.
Expand Down Expand Up @@ -108,7 +111,10 @@ 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_archives_url: https://github.com/deemp/nix-quick-install-action/releases/download/v27
nix_version: 2.21.0

- name: Restore and save Nix store - ${{ matrix.id }}
uses: ./.
Expand Down Expand Up @@ -165,7 +171,10 @@ 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_archives_url: https://github.com/deemp/nix-quick-install-action/releases/download/v27
nix_version: 2.21.0

- name: Restore and save Nix store
uses: ./.
Expand Down Expand Up @@ -199,13 +208,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 +224,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 +248,10 @@ 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_archives_url: https://github.com/deemp/nix-quick-install-action/releases/download/v27
nix_version: 2.21.0

- name: Restore Nix store
uses: ./restore
Expand All @@ -265,13 +271,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 +314,10 @@ 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_archives_url: https://github.com/deemp/nix-quick-install-action/releases/download/v27
nix_version: 2.21.0

- name: Restore and save Nix store
if: ${{ matrix.do-cache }}
Expand Down
25 changes: 13 additions & 12 deletions nix/ci.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ 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_archives_url: https://github.com/deemp/nix-quick-install-action/releases/download/v27
nix_version: 2.21.0
'';
in
''
name: Nix CI ${name}
Expand All @@ -67,7 +74,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 +144,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 +188,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 +208,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 +248,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 +294,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 62d9ccf

Please sign in to comment.