update-conformance-test-reports #36
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: Update conformance test reports | |
on: | |
repository_dispatch: | |
types: [update-conformance-test-reports] | |
workflow_dispatch: # for testing this workflow | |
permissions: write-all | |
jobs: | |
update: | |
name: Update conformance test reports | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
branch: update-conformance-test-reports | |
defaults: | |
run: | |
shell: bash --noprofile --norc -e -o pipefail -x {0} | |
working-directory: reference-checker | |
steps: | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 17 | |
- name: Check out JSpecify | |
uses: actions/checkout@v3 | |
with: | |
repository: jspecify/jspecify | |
ref: main | |
path: jspecify | |
- name: Check out the Reference Checker | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
path: reference-checker | |
- name: Create or update the Reference Checker ${{ env.branch }} branch | |
run: | | |
git config user.name 'jspecify-bot' | |
git config user.email '[email protected]' | |
if git checkout "${branch}"; then | |
git merge -X theirs origin/main | |
git push | |
else | |
git checkout -b "${branch}" | |
git config push.autoSetupRemote true | |
fi | |
- name: Run the Reference Checker conformance tests | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: conformanceTests | |
build-root-directory: reference-checker | |
env: | |
JSPECIFY_CONFORMANCE_TEST_MODE: write | |
- name: Create or update PR to update conformance test reports | |
run: | | |
if [[ -n $(git status --porcelain tests/ConformanceTest*-report.txt) ]]; then | |
git commit -m "Update conformance test reports." tests/ConformanceTest*-report.txt | |
git push | |
if [[ -z $(gh pr list --head "${branch}" --state open) ]]; then | |
gh pr create --base main --title "Update conformance test reports." --body "" | |
fi | |
fi |