Skip to content
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
1 change: 1 addition & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Cwd
emoji
endgroup
jsoref
Linting
Expand Down
84 changes: 69 additions & 15 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,54 @@ on:
pull_request_target:

jobs:
good-file:
name: Validate Good File
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
validated: ${{ steps.validate.outcome }}
expected: success
steps:
- name: checkout-merge
if: contains(github.event_name, 'pull_request')
uses: actions/checkout@v4
with:
ref: refs/pull/${{github.event.pull_request.number}}/merge
- name: checkout
if: ${{ !contains(github.event_name, 'pull_request') }}
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: dhall-validator-files
id: validate
continue-on-error: true
uses: ./
with:
dhall-files: tests/pass.dhall
verbose: 1
validate-files:
name: Validate Files
runs-on: ubuntu-latest
continue-on-error: true
permissions:
contents: read
outputs:
validated: ${{ steps.validate.outcome }}
expected: failure
steps:
- name: checkout-merge
if: "contains(github.event_name, 'pull_request')"
if: contains(github.event_name, 'pull_request')
uses: actions/checkout@v4
with:
ref: refs/pull/${{github.event.pull_request.number}}/merge
- name: checkout
if: "!contains(github.event_name, 'pull_request')"
if: ${{ !contains(github.event_name, 'pull_request') }}
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: dhall-validator-files
id: validate
continue-on-error: true
uses: ./
with:
dhall-files: |
Expand All @@ -37,15 +67,17 @@ jobs:
validate-list:
name: Validate List
runs-on: ubuntu-latest
continue-on-error: true
outputs:
validated: ${{ steps.validate.outcome }}
expected: failure
steps:
- name: checkout-merge
if: "contains(github.event_name, 'pull_request')"
if: contains(github.event_name, 'pull_request')
uses: actions/checkout@v4
with:
ref: refs/pull/${{github.event.pull_request.number}}/merge
- name: checkout
if: "!contains(github.event_name, 'pull_request')"
if: ${{ !contains(github.event_name, 'pull_request') }}
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
Expand All @@ -60,22 +92,44 @@ jobs:
git -C dhall-lang ls-files 'tests/parser/*/unit/Bool*.dhall' -z |
perl -e '$/="\0"; while (<>) {s#^#dhall-lang/#; print}' > /tmp/dhall-files.list
- name: dhall-validator-list
id: validate
continue-on-error: true
uses: ./
with:
dhall-file-list: /tmp/dhall-files.list
collect-results:
name: Collect Results
check-results:
name: Check Results
runs-on: ubuntu-latest
needs:
- good-file
- validate-files
- validate-list
if: success() || failure()
steps:
- name: Check for failing to catch validation errors
if: needs.validate-files.outcome == 'success' || needs.validate-list.outcome == 'success'
run: |
echo "::error::Failed to catch validation errors"
exit 1
- name: Report success
- name: Report
env:
GOOD_ACTUAL: ${{ needs.good-file.outputs.validated }}
GOOD_EXPECTED: ${{ needs.good-file.outputs.expected }}
FILES_ACTUAL: ${{ needs.validate-files.outputs.validated }}
FILES_EXPECTED: ${{ needs.validate-files.outputs.expected }}
LIST_ACTUAL: ${{ needs.validate-list.outputs.validated }}
LIST_EXPECTED: ${{ needs.validate-list.outputs.expected }}
EXPECTED: ${{ needs.good-file.outputs.validated == needs.good-file.outputs.expected && needs.validate-files.outputs.validated == needs.validate-files.outputs.expected && needs.validate-list.outputs.validated == needs.validate-list.outputs.expected }}
run: |
echo "::notice::Validation properly caught errors"
: Check for failing to catch validation errors
github_results_to_emoji() {
perl -pe 's/success/:white_check_mark:/g;s/failure/:x:/g'
}
(
echo '# Results'
echo 'Test|Result|Expected'
echo '-|-|-'
echo "Good Files|$GOOD_ACTUAL|$GOOD_EXPECTED"
echo "Files|$FILES_ACTUAL|$FILES_EXPECTED"
echo "File List|$LIST_ACTUAL|$LIST_EXPECTED"
) | github_results_to_emoji >> "$GITHUB_STEP_SUMMARY"
if [ "$EXPECTED" != true ]; then
echo "::error::Failed to properly perform validation"
exit 1
fi
echo "::notice::Validation properly handled good and bad cases"
2 changes: 1 addition & 1 deletion check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ if [ -z "$LIST" ]; then
export LIST=$(mktemp)
fi
if [ -n "$FILES" ]; then
echo "$FILES" | tr "\n" "\0" >> "$LIST"
echo "$FILES" | grep . | tr "\n" "\0" >> "$LIST"
fi

if ! grep -q . "$LIST"; then
Expand Down
Loading