mirror of
https://github.com/DeterminateSystems/magic-nix-cache-action.git
synced 2024-12-23 13:32:03 +01:00
Add shellcheck checks to CI
This commit is contained in:
parent
455b918565
commit
2c553b21e6
3 changed files with 14 additions and 11 deletions
18
.github/workflows/cache-test.sh
vendored
18
.github/workflows/cache-test.sh
vendored
|
@ -5,26 +5,26 @@ set -ux
|
||||||
|
|
||||||
seed=$(date)
|
seed=$(date)
|
||||||
|
|
||||||
log=$MAGIC_NIX_CACHE_DAEMONDIR/daemon.log
|
log="${MAGIC_NIX_CACHE_DAEMONDIR}/daemon.log"
|
||||||
|
|
||||||
binary_cache=https://cache.flakehub.com
|
binary_cache=https://cache.flakehub.com
|
||||||
|
|
||||||
# Check that the action initialized correctly.
|
# Check that the action initialized correctly.
|
||||||
grep 'FlakeHub cache is enabled' $log
|
grep 'FlakeHub cache is enabled' "${log}"
|
||||||
grep 'Using cache' $log
|
grep 'Using cache' "${log}"
|
||||||
grep 'GitHub Action cache is enabled' $log
|
grep 'GitHub Action cache is enabled' "${log}"
|
||||||
|
|
||||||
# Build something.
|
# Build something.
|
||||||
outpath=$(nix-build .github/workflows/cache-tester.nix --argstr seed "$seed")
|
outpath=$(nix-build .github/workflows/cache-tester.nix --argstr seed "$seed")
|
||||||
|
|
||||||
# Check that the path was enqueued to be pushed to the cache.
|
# Check that the path was enqueued to be pushed to the cache.
|
||||||
grep "Enqueueing.*$outpath" $log
|
grep "Enqueueing.*${outpath}" "${log}"
|
||||||
|
|
||||||
# Wait until it has been pushed succesfully.
|
# Wait until it has been pushed succesfully.
|
||||||
found=
|
found=
|
||||||
for ((i = 0; i < 60; i++)); do
|
for ((i = 0; i < 60; i++)); do
|
||||||
sleep 1
|
sleep 1
|
||||||
if grep "✅ $(basename $outpath)" $log; then
|
if grep "✅ $(basename "${outpath}")" "${log}"; then
|
||||||
found=1
|
found=1
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
@ -35,13 +35,13 @@ if [[ -z $found ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check the FlakeHub binary cache to see if the path is really there.
|
# Check the FlakeHub binary cache to see if the path is really there.
|
||||||
nix path-info --store "$binary_cache" $outpath
|
nix path-info --store "${binary_cache}" "${outpath}"
|
||||||
|
|
||||||
# FIXME: remove this once the daemon also uploads to GHA automatically.
|
# FIXME: remove this once the daemon also uploads to GHA automatically.
|
||||||
nix copy --to 'http://127.0.0.1:37515' "$outpath"
|
nix copy --to 'http://127.0.0.1:37515' "${outpath}"
|
||||||
|
|
||||||
rm ./result
|
rm ./result
|
||||||
nix store delete "$outpath"
|
nix store delete "${outpath}"
|
||||||
if [ -f "$outpath" ]; then
|
if [ -f "$outpath" ]; then
|
||||||
echo "$outpath still exists? can't test"
|
echo "$outpath still exists? can't test"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
5
.github/workflows/ci.yml
vendored
5
.github/workflows/ci.yml
vendored
|
@ -16,9 +16,12 @@ jobs:
|
||||||
- name: Record existing bundle hash
|
- name: Record existing bundle hash
|
||||||
run: |
|
run: |
|
||||||
echo "BUNDLE_HASH=$(sha256sum <dist/index.js | sed 's/ -//')" >>$GITHUB_ENV
|
echo "BUNDLE_HASH=$(sha256sum <dist/index.js | sed 's/ -//')" >>$GITHUB_ENV
|
||||||
|
- name: Check shell scripts
|
||||||
|
run: |
|
||||||
|
nix develop --command shellcheck ./.github/workflows/cache-test.sh
|
||||||
- name: Build action
|
- name: Build action
|
||||||
run: |
|
run: |
|
||||||
nix develop --command -- just build
|
nix develop --command just build
|
||||||
- name: Check bundle consistency
|
- name: Check bundle consistency
|
||||||
run: |
|
run: |
|
||||||
NEW_BUNDLE_HASH=$(sha256sum <dist/index.js | sed 's/ -//')
|
NEW_BUNDLE_HASH=$(sha256sum <dist/index.js | sed 's/ -//')
|
||||||
|
|
|
@ -19,10 +19,10 @@
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
bun
|
bun
|
||||||
nodejs
|
|
||||||
jq
|
jq
|
||||||
act
|
act
|
||||||
just
|
just
|
||||||
|
shellcheck
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue