Skip to content

Commit

Permalink
Many more tests!
Browse files Browse the repository at this point in the history
Type: chore
  • Loading branch information
nicknovitski committed Oct 29, 2024
1 parent c2bcf90 commit 1c99270
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 8 deletions.
34 changes: 26 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,29 @@ on:
- main
- 'releases/*'
jobs:
test:
list-determinate-shells:
runs-on: ubuntu-22.04
outputs:
shells: ${{ steps.shells.outputs.shells }}
steps:
- uses: cachix/install-nix-action@v30
- id: shells
run: |
echo "shells=$(nix eval github:DeterminateSystems/zero-to-nix#devShells.x86_64-linux --apply builtins.attrNames --json)" >> "$GITHUB_OUTPUT"
test-determinate-shells:
needs:
- list-determinate-shells
runs-on: ubuntu-22.04
strategy:
matrix:
shell: ${{ fromJSON(needs.list-determinate-shells.outputs.shells) }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
- uses: ./
with:
arguments: github:DeterminateSystems/zero-to-nix#${{ matrix.shell }}
test-self:
strategy:
matrix:
runs-on:
Expand All @@ -16,9 +38,7 @@ jobs:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
- uses: ./
- run: actionlint
- run: shellcheck nix-develop-gha.sh
test-determinate:
check:
strategy:
matrix:
runs-on:
Expand All @@ -27,7 +47,5 @@ jobs:
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: ./
- run: actionlint
- run: shellcheck nix-develop-gha.sh
- uses: cachix/install-nix-action@v30
- run: nix flake check --keep-going --print-build-logs --show-trace
30 changes: 30 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,35 @@
packages = [pkgs.shfmt pkgs.shellcheck pkgs.actionlint];
};
});
checks = eachSystem ({
pkgs,
system,
...
}: {
package = self.packages.${system}.default;
actionlint = let
fs = pkgs.lib.fileset;
in
pkgs.runCommand "lint-actions" {
nativeBuildInputs = [
pkgs.actionlint
pkgs.git
pkgs.shellcheck # actionlint uses this to check `run:` stanzas
];
src = fs.toSource {
root = ./.;
fileset = fs.unions [./.github/workflows];
};
}
''
set -euo pipefail
cp -R $src src-copy
chmod -R +w src-copy
cd src-copy
git init --quiet
actionlint -color
touch $out
'';
});
};
}

0 comments on commit 1c99270

Please sign in to comment.