simplified regex (manually constructed) (#27) #89
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
name: Parse Test | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
env: | |
# Don't make dotnet so needy | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
jobs: | |
parse-verify: | |
name: "Check Benchmark Syntax" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Update Environment | |
run: | | |
echo "DOTNET_ROOT=${HOME}/.dotnet" >> $GITHUB_ENV | |
echo "${HOME}/.dotnet/tools" >> $GITHUB_PATH | |
- uses: actions/checkout@v2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 6.0.x | |
- name: Install Parser | |
run: dotnet tool install --global Semgus.Parser.Tool # Grab the most recent version | |
- name: Get Changed Files | |
id: changed_files | |
uses: jitterbit/get-changed-files@v1 | |
with: | |
format: json | |
- name: Check Benchmarks | |
run: | | |
failed=0 | |
readarray -t changed_files <<<"$(jq -r '.[]' <<<'${{ steps.changed_files.outputs.all }}')" | |
for changed_file in ${changed_files[@]}; do | |
if [ ! -f "${changed_file}" ]; then | |
echo "File doesn't exist - must have been deleted: ${changed_file}" | |
continue | |
fi | |
case "${changed_file}" in | |
*.sem|*.sy|*.sl) | |
echo "Checking benchmark: ${changed_file}" | |
# Disable fail-fast, so we can collect/report errors | |
set +e | |
grep -F '(check-synth)' "${changed_file}" | |
if [ $? -ne 0 ]; then | |
echo "${changed_file}: error: missing '(check-synth)' command" >&2 | |
failed=1 | |
fi | |
semgus-parser --format verify -- "${changed_file}" | |
if [ $? -ne 0 ]; then | |
echo "${changed_file}: error: failed to parse" >&2 | |
failed=1 | |
fi | |
# Re-enable fail-fast | |
set -e | |
;; | |
*) | |
echo "Skipping: ${changed_file}. Not a benchmark file." | |
;; | |
esac | |
done | |
exit $failed |