Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Many more tests! #21

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
'';
});
};
}