-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
auto-config
and build
inputs.
`auto-config` allows users to specify if `lean-action` should use the Lake workspace to automatically decide which CI features to run. `build` allows users to specify if `lean-action` should run `lake build`. By default, `auto-config: true`. The `test` and `build` (and soon `lint`, see #46) inputs allow users to override the automatically configured behavior or configure `lean-action` when `auto-config: false`. `auto-config: true` is close to the previous default behavior, however there is a difference in the outcome of the `lake test` step. When users set `test: true` manually, `lean-action` must find tests with `lake check-test` and run `lake test` or it will fail (this was the previous behavior). However with `auto-config: true`, if `lake check-test` fails, `lean-action` will not run `lake test` and this won't cause `lean-action` to fail.
- Loading branch information
1 parent
52906d4
commit 7698a08
Showing
10 changed files
with
365 additions
and
18 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,97 @@ | ||
name: 'Auto Config False Functional Test' | ||
description: | | ||
Run `lean-action` with `auto-config: false` and no feature inputs. | ||
Verify that build and test steps do not run. | ||
Run `lean-action` with `auto-config: false` and `lean4checker: true`. | ||
Verify that build and tests steps do not run and action succeeds. | ||
runs: | ||
using: 'composite' | ||
steps: | ||
# TODO: once `lean-action` supports just setup, use it here | ||
- name: install elan | ||
run: | | ||
set -o pipefail | ||
curl -sSfL https://github.com/leanprover/elan/releases/download/v3.1.1/elan-x86_64-unknown-linux-gnu.tar.gz | tar xz | ||
./elan-init -y --default-toolchain leanprover/lean4:v4.8.0-rc1 | ||
echo "$HOME/.elan/bin" >> "$GITHUB_PATH" | ||
shell: bash | ||
|
||
- name: create lake package | ||
run: | | ||
lake init autoconfigtest | ||
shell: bash | ||
|
||
- name: create successful dummy test | ||
run: | | ||
{ | ||
echo "@[test_runner]" | ||
echo "script dummy_test do" | ||
echo " println! \"Running fake tests...\"" | ||
echo " println! \"Fake tests passed!\"" | ||
echo " return 0" | ||
} >> lakefile.lean | ||
shell: bash | ||
|
||
- name: "run `lean-action` with `auto-config: false`" | ||
id: lean-action | ||
uses: ./ | ||
with: | ||
auto-config: false | ||
use-github-cache: false | ||
|
||
- name: verify `lean-action` outcome success | ||
env: | ||
OUTPUT_NAME: "lean-action.outcome" | ||
EXPECTED_VALUE: "success" | ||
ACTUAL_VALUE: ${{ steps.lean-action.outcome }} | ||
run: .github/functional_tests/test_helpers/verify_action_output.sh | ||
shell: bash | ||
|
||
- name: verify `lake build` not run | ||
env: | ||
OUTPUT_NAME: "build-status" | ||
EXPECTED_VALUE: "NOT_RUN" | ||
ACTUAL_VALUE: ${{ steps.lean-action.outputs.build-status }} | ||
run: .github/functional_tests/test_helpers/verify_action_output.sh | ||
shell: bash | ||
|
||
- name: verify `lake test` not run | ||
env: | ||
OUTPUT_NAME: "test-status" | ||
EXPECTED_VALUE: "NOT_RUN" | ||
ACTUAL_VALUE: ${{ steps.lean-action.outputs.test-status }} | ||
run: .github/functional_tests/test_helpers/verify_action_output.sh | ||
shell: bash | ||
|
||
|
||
- name: "run `lean-action` with `auto-config: false` and `lean4checker: true`" | ||
id: lean-action-lean4checker | ||
uses: ./ | ||
with: | ||
auto-config: false | ||
lean4checker: true | ||
use-github-cache: false | ||
|
||
- name: verify `lean-action` outcome success | ||
env: | ||
OUTPUT_NAME: "lean-action.outcome" | ||
EXPECTED_VALUE: "success" | ||
ACTUAL_VALUE: ${{ steps.lean-action-lean4checker.outcome }} | ||
run: .github/functional_tests/test_helpers/verify_action_output.sh | ||
shell: bash | ||
|
||
- name: verify `lake build` not run | ||
env: | ||
OUTPUT_NAME: "build-status" | ||
EXPECTED_VALUE: "NOT_RUN" | ||
ACTUAL_VALUE: ${{ steps.lean-action-lean4checker.outputs.build-status }} | ||
run: .github/functional_tests/test_helpers/verify_action_output.sh | ||
shell: bash | ||
|
||
- name: verify `lake test` not run | ||
env: | ||
OUTPUT_NAME: "test-status" | ||
EXPECTED_VALUE: "NOT_RUN" | ||
ACTUAL_VALUE: ${{ steps.lean-action-lean4checker.outputs.test-status }} | ||
run: .github/functional_tests/test_helpers/verify_action_output.sh | ||
shell: bash |
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,63 @@ | ||
name: 'Auto Config True Functional Test' | ||
description: | | ||
Run `lean-action` with `auto-config: true` and no feature inputs | ||
on a package generated with `lake init` and a dummy test runner added. | ||
Verify `lake build` and `lake test` run successfully. | ||
runs: | ||
using: 'composite' | ||
steps: | ||
# TODO: once `lean-action` supports just setup, use it here | ||
- name: install elan | ||
run: | | ||
set -o pipefail | ||
curl -sSfL https://github.com/leanprover/elan/releases/download/v3.1.1/elan-x86_64-unknown-linux-gnu.tar.gz | tar xz | ||
./elan-init -y --default-toolchain leanprover/lean4:v4.8.0-rc1 | ||
echo "$HOME/.elan/bin" >> "$GITHUB_PATH" | ||
shell: bash | ||
|
||
- name: create lake package | ||
run: | | ||
lake init autoconfigtest | ||
shell: bash | ||
|
||
- name: create successful dummy test | ||
run: | | ||
{ | ||
echo "@[test_runner]" | ||
echo "script dummy_test do" | ||
echo " println! \"Running fake tests...\"" | ||
echo " println! \"Fake tests passed!\"" | ||
echo " return 0" | ||
} >> lakefile.lean | ||
shell: bash | ||
|
||
- name: "run `lean-action` with `lake test`" | ||
id: lean-action | ||
uses: ./ | ||
with: | ||
auto-config: true | ||
use-github-cache: false | ||
|
||
- name: verify `lean-action` outcome success | ||
env: | ||
OUTPUT_NAME: "lean-action.outcome" | ||
EXPECTED_VALUE: "success" | ||
ACTUAL_VALUE: ${{ steps.lean-action.outcome }} | ||
run: .github/functional_tests/test_helpers/verify_action_output.sh | ||
shell: bash | ||
|
||
- name: verify `lake build` success | ||
env: | ||
OUTPUT_NAME: "build-status" | ||
EXPECTED_VALUE: "SUCCESS" | ||
ACTUAL_VALUE: ${{ steps.lean-action.outputs.build-status }} | ||
run: .github/functional_tests/test_helpers/verify_action_output.sh | ||
shell: bash | ||
|
||
- name: verify `lake test` success | ||
env: | ||
OUTPUT_NAME: "test-status" | ||
EXPECTED_VALUE: "SUCCESS" | ||
ACTUAL_VALUE: ${{ steps.lean-action.outputs.test-status }} | ||
run: .github/functional_tests/test_helpers/verify_action_output.sh | ||
shell: bash |
52 changes: 52 additions & 0 deletions
52
.github/functional_tests/lake_check_test_failure/action.yml
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,52 @@ | ||
name: 'Lake Check Test Failure' | ||
description: | | ||
Run `lean-action` with `test: true` without a test_driver in the Lake workspace. | ||
Verify `lean-action` fails and `lake build` and `lake test` are not run. | ||
runs: | ||
using: 'composite' | ||
steps: | ||
# TODO: once `lean-action` supports just setup, use it here | ||
- name: install elan | ||
run: | | ||
set -o pipefail | ||
curl -sSfL https://github.com/leanprover/elan/releases/download/v3.1.1/elan-x86_64-unknown-linux-gnu.tar.gz | tar xz | ||
./elan-init -y --default-toolchain leanprover/lean4:v4.8.0-rc1 | ||
echo "$HOME/.elan/bin" >> "$GITHUB_PATH" | ||
shell: bash | ||
|
||
- name: create lake package | ||
run: | | ||
lake init dummytest | ||
shell: bash | ||
|
||
- name: "run `lean-action` with `test: true`" | ||
id: lean-action | ||
uses: ./ | ||
continue-on-error: true # required so that the action failure does not fail the workflow | ||
with: | ||
test: true | ||
use-github-cache: false | ||
|
||
- name: verify `lean-action` outcome failure | ||
env: | ||
OUTPUT_NAME: "lean-action.outcome" | ||
EXPECTED_VALUE: "failure" | ||
ACTUAL_VALUE: ${{ steps.lean-action.outcome }} | ||
run: .github/functional_tests/test_helpers/verify_action_output.sh | ||
shell: bash | ||
|
||
- name: verify `lake build` not run | ||
env: | ||
OUTPUT_NAME: "build-status" | ||
EXPECTED_VALUE: "NOT_RUN" | ||
ACTUAL_VALUE: ${{ steps.lean-action.outputs.build-status }} | ||
run: .github/functional_tests/test_helpers/verify_action_output.sh | ||
shell: bash | ||
|
||
- name: verify `lake test` not run | ||
env: | ||
OUTPUT_NAME: "test-status" | ||
EXPECTED_VALUE: "NOT_RUN" | ||
ACTUAL_VALUE: ${{ steps.lean-action.outputs.test-status }} | ||
run: .github/functional_tests/test_helpers/verify_action_output.sh | ||
shell: bash |
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
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
Oops, something went wrong.