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

fix: false feature inputs with auto-config: true #111

Merged
merged 3 commits into from
Nov 23, 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
39 changes: 38 additions & 1 deletion .github/functional_tests/auto_config_true/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ 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.

Run `lean-action` with `auto-config:true` and false feature inputs.
Verify `lake build` and `lake test` did not run.
inputs:
toolchain:
description: 'Toolchain to use for the test'
Expand Down Expand Up @@ -46,7 +49,7 @@ runs:
} >> lakefile.lean
shell: bash

- name: "run `lean-action` with `lake test`"
- name: "run `lean-action` with auto-config: true"
id: lean-action
uses: ./
with:
Expand Down Expand Up @@ -84,3 +87,37 @@ runs:
ACTUAL_VALUE: ${{ steps.lean-action.outputs.lint-status }}
run: .github/functional_tests/test_helpers/verify_action_output.sh
shell: bash


- name: "run `lean-action` with auto-config: true and false feature inputs"
id: lean-action-false-feature-inputs
uses: ./
with:
auto-config: true
build: false
test: false
lint: false
use-github-cache: false
- name: verify `lake build` did not run
env:
OUTPUT_NAME: "build-status"
EXPECTED_VALUE: ""
ACTUAL_VALUE: ${{ steps.lean-action-false-feature-inputs.outputs.build-status }}
run: .github/functional_tests/test_helpers/verify_action_output.sh
shell: bash

- name: verify `lake test` did not run
env:
OUTPUT_NAME: "test-status"
EXPECTED_VALUE: ""
ACTUAL_VALUE: ${{ steps.lean-action-false-feature-inputs.outputs.test-status }}
run: .github/functional_tests/test_helpers/verify_action_output.sh
shell: bash

- name: verify `lake lint` did not run
env:
OUTPUT_NAME: "lint-status"
EXPECTED_VALUE: ""
ACTUAL_VALUE: ${{ steps.lean-action-false-feature-inputs.outputs.lint-status }}
run: .github/functional_tests/test_helpers/verify_action_output.sh
shell: bash
30 changes: 22 additions & 8 deletions scripts/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,35 @@ if [ "$LINT" = "true" ]; then
fi

if [ "$AUTO_CONFIG" = "true" ]; then
# always run `lake build` with `auto-config: true`
echo "auto-config: true"
echo " -> will run lake build"
run_lake_build="true"
if [ "$BUILD" = "false" ]; then
# If the user specifies `build: false`, then do not run `lake build`.
echo "build: false -> will not run lake build"
run_lake_build="false"
else
# `build` input is not `false` and `auto-config: true`
echo "auto-config: true"
echo " -> will run lake build"
run_lake_build="true"
fi

# only run `lake test` with `auto-config: true` if `lake check-test` returns true
if lake check-test; then
if [ "$TEST" = "false" ]; then
# If the user specifies `test: false`, then do not run `lake test`.
echo "test: false -> will not run lake test"
run_lake_test="false"
elif lake check-test; then
# only run `lake test` with `auto-config: true` if `lake check-test` returns true
echo "lake check-test succeeded -> will run lake test"
run_lake_test="true"
else
echo "lake check-test failed -> will not run lake test"
fi

# only run `lake lint` with `auto-config: true` if `lake check-lint` returns true
if lake check-lint; then
if [ "$LINT" = "false" ]; then
# If the user specifies `lint: false`, then do not run `lake lint`.
echo "lint: false -> will not run lake lint"
run_lake_lint="false"
elif lake check-lint; then
# only run `lake lint` with `auto-config: true` if `lake check-lint` returns true
echo "lake check-lint succeeded -> will run lake lint"
run_lake_lint="true"
else
Expand Down
Loading