-
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.
Add an expected failure test to ensure things fail if they need to
- Loading branch information
Showing
6 changed files
with
133 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,40 @@ | ||
# 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)}} | ||
JQ_FAIL_PROGRAM: > | ||
.lints.outputs["_internal_build_result"] == "failure" | ||
run: > | ||
echo "did_fail=$(echo "$NEEDS_JSON" | jq -r "$JQ_FAIL_PROGRAM")" | tee -a $GITHUB_OUTPUT | ||
- name: expect failure | ||
run: exit 1 | ||
if: steps.expected_failure.outputs.did_fail != 'true' |
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
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.