Skip to content

Commit

Permalink
feat: add lake check-test check before running lake test
Browse files Browse the repository at this point in the history
  • Loading branch information
austinletson committed May 18, 2024
1 parent aa36d3b commit dd672a2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
4 changes: 1 addition & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ runs:
- name: test ${{ github.repository }}
if: ${{ inputs.test == 'true' }}
run: |
echo "::group::Lake Test"
lake test
echo "::endgroup::"
${{ github.action_path }}/scripts/lake_test.sh
shell: bash

- name: lint ${{ github.repository }}
Expand Down
17 changes: 17 additions & 0 deletions scripts/lake_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

echo "::group::Lake Test"
# Get the directory of the script
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"

# use `lake check-test` to determine if the project has a test runner available
# TODO: add a more helpful error message once the test frame work matures
if ! lake check-test; then
echo "::error::lake check-test failed: could not find a test runner"
cat "$SCRIPT_DIR"/step_summaries/lake_check_error.md >> "$GITHUB_STEP_SUMMARY"
exit 1
fi

lake test

echo "::endgroup::"
2 changes: 2 additions & 0 deletions scripts/step_summaries/lake_check_error.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
### `lake check-test` failed
`lake check-test` could not find a test runner. Add script or lean_exe tagged `@[test_runner]` in the workspace's root package.

0 comments on commit dd672a2

Please sign in to comment.