Skip to content

Commit

Permalink
feat: Nix indirect flake input
Browse files Browse the repository at this point in the history
- this also fixes a race condition with the CI lock file changes
  • Loading branch information
tegefaulkes authored and brynblack committed Sep 6, 2024
1 parent a031b1b commit 358955e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Dry run
run: nix build .#docker --dry-run
run: nix build .#docker --dry-run --no-update-lock-file --no-write-lock-file

check-build:
name: "Check / Build"
Expand Down
20 changes: 12 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Dry run
run: nix build .#docker --dry-run --no-update-lock-file
run: nix build .#docker --dry-run --no-update-lock-file --no-write-lock-file

check-build:
name: "Check / Build"
Expand Down Expand Up @@ -139,6 +139,8 @@ jobs:
--max-jobs "$(nproc)" \
--cores "$(nproc)" \
--print-out-paths \
--no-update-lock-file \
--no-write-lock-file \
.# \
)"
nix-store --export $( \
Expand All @@ -149,12 +151,14 @@ jobs:
--cores "$(nproc)" \
--print-out-paths \
--print-build-logs \
--no-update-lock-file \
--no-write-lock-file \
.# \
.#docker \
.#packages.x86_64-linux.executable \
)"
cp -r $(echo $builds | tr '\n' ' ') ./builds/
nix develop .#ci --command bash -c $'
nix develop --no-update-lock-file --no-write-lock-file .#ci --command bash -c $'
npm run build
'
- uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -196,7 +200,7 @@ jobs:
script: |
docker info
mkdir $PK_TEST_TMPDIR
nix develop .#ci --command bash -c $'
nix develop --no-update-lock-file --no-write-lock-file .#ci --command bash -c $'
image_and_tag="$(docker load --input ./builds/*docker* | cut -d\' \' -f3)"
docker tag "$image_and_tag" "polykey-cli:testtarget"
'
Expand Down Expand Up @@ -330,7 +334,7 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CI_REGISTRY_IMAGE: '015248367786.dkr.ecr.ap-southeast-2.amazonaws.com/polykey'
run: |
nix develop .#ci --command bash -c $'
nix develop --no-update-lock-file --no-write-lock-file .#ci --command bash -c $'
aws ecr get-login-password \
| skopeo login \
--username AWS \
Expand All @@ -341,7 +345,7 @@ jobs:
./scripts/deploy-image.sh "${image[0]}" \'testnet\' "$CI_REGISTRY_IMAGE"
'
echo 'Waiting for Testnet Deployment'
nix develop .#ci --command bash -c $'
nix develop --no-update-lock-file --no-write-lock-file .#ci --command bash -c $'
./scripts/wait-for-deploy.js testnet.polykey.com
'
Expand All @@ -366,7 +370,7 @@ jobs:
run: |
docker info
mkdir -p $PK_TEST_TMPDIR
nix develop .#ci --command bash -c $'
nix develop --no-update-lock-file --no-write-lock-file .#ci --command bash -c $'
image_and_tag="$(docker load --input ./builds/*docker* | cut -d\' \' -f3)"
docker tag "$image_and_tag" "polykey-cli:testtarget"
npm run test tests/integration/docker
Expand Down Expand Up @@ -403,7 +407,7 @@ jobs:
CI_REGISTRY_IMAGE: '015248367786.dkr.ecr.ap-southeast-2.amazonaws.com/polykey'
run: |
echo 'Deploying container image to ECR'
nix develop .#ci --command bash -c $'
nix develop --no-update-lock-file --no-write-lock-file .#ci --command bash -c $'
aws ecr get-login-password \
| skopeo login \
--username AWS \
Expand All @@ -414,7 +418,7 @@ jobs:
./scripts/deploy-image.sh "${image[0]}" \'mainnet\' "$CI_REGISTRY_IMAGE"
'
echo 'Waiting for Mainnet Deployment'
nix develop .#ci --command bash -c $'
nix develop --no-update-lock-file --no-write-lock-file .#ci --command bash -c $'
./scripts/wait-for-deploy.js mainnet.polykey.com
'
rm -f "$REGISTRY_AUTH_FILE"
Expand Down
5 changes: 2 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
inputs = {
nixpkgs-matrix.url = "github:MatrixAI/nixpkgs-matrix";
nixpkgs-matrix = {
type = "indirect";
id = "nixpkgs-matrix";
};
flake-utils.url = "github:numtide/flake-utils";
};

Expand Down

0 comments on commit 358955e

Please sign in to comment.