-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from boinkor-net/nix-flake-linter
New lint step that guards against presence of "path" inputs
- Loading branch information
Showing
8 changed files
with
235 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# This workflow calls the reusable test workflow and ensures that the | ||
# tests do not pass. | ||
# | ||
# Please don't use this as a reusable workflow, because it is very | ||
# much not. | ||
|
||
name: Internal job invocation that expects a lint failure result | ||
on: | ||
workflow_call: | ||
inputs: | ||
root: | ||
description: "Directory containing the go.mod of the codebase under test" | ||
type: string | ||
default: "." | ||
failing_job: | ||
description: "Job that is intended to fail" | ||
type: "string" | ||
|
||
jobs: | ||
lints: | ||
uses: "./.github/workflows/lints.yml" | ||
with: | ||
root: ${{inputs.root}} | ||
_internal_continue_on_error: ${{inputs.failing_job}} | ||
|
||
expect_lint_failure: | ||
runs-on: ubuntu-latest | ||
needs: lints | ||
steps: | ||
- name: transform expected failure | ||
id: expected_failure | ||
env: | ||
NEEDS_JSON: ${{toJSON(needs)}} | ||
NEEDS_OUTPUT: ${{fromJSON(needs.lints.outputs._internal_lint_result)[inputs.failing_job]}} | ||
run: > | ||
echo "status=$NEEDS_OUTPUT" | tee -a $GITHUB_OUTPUT | ||
- name: expect failure | ||
run: exit 1 | ||
if: steps.expected_failure.outputs.status != 'failure' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: "Tests for this repo" | ||
on: | ||
workflow_call: | ||
pull_request: | ||
|
||
jobs: | ||
success_build: | ||
uses: "./.github/workflows/build.yml" | ||
with: | ||
root: "./tests/success" | ||
|
||
success_lint: | ||
uses: "./.github/workflows/lints.yml" | ||
with: | ||
root: "./tests/success" | ||
|
||
success_test: | ||
uses: "./.github/workflows/tests.yml" | ||
with: | ||
root: "./tests/success" | ||
|
||
fail_on_path_inputs: | ||
uses: "./.github/workflows/_internal_lint_failure.yml" | ||
with: | ||
root: "./tests/fail-safety-check" | ||
failing_job: "flake_safety" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
description = "a flake that should successfully pass the baseline-nix tests"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; | ||
some_input = { | ||
url = "path:./some_input"; | ||
flake = false; | ||
}; | ||
}; | ||
|
||
outputs = {nixpkgs, ...}: let | ||
systems = [ | ||
"aarch64-darwin" | ||
"aarch64-linux" | ||
"riscv64-linux" | ||
"x86_64-darwin" | ||
"x86_64-linux" | ||
]; | ||
eachSystem = f: | ||
nixpkgs.lib.genAttrs systems ( | ||
system: | ||
f rec { | ||
inherit system; | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
} | ||
); | ||
in { | ||
formatter = eachSystem ({pkgs, ...}: pkgs.alejandra); | ||
packages = eachSystem ({pkgs, ...}: {default = pkgs.hello;}); | ||
}; | ||
} |
Empty file.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
description = "a flake that should successfully pass the baseline-nix tests"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; | ||
}; | ||
|
||
outputs = {nixpkgs, ...}: let | ||
systems = [ | ||
"aarch64-darwin" | ||
"aarch64-linux" | ||
"riscv64-linux" | ||
"x86_64-darwin" | ||
"x86_64-linux" | ||
]; | ||
eachSystem = f: | ||
nixpkgs.lib.genAttrs systems ( | ||
system: | ||
f rec { | ||
inherit system; | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
} | ||
); | ||
in { | ||
formatter = eachSystem ({pkgs, ...}: pkgs.alejandra); | ||
packages = eachSystem ({pkgs, ...}: {default = pkgs.hello;}); | ||
}; | ||
} |