Expand BytecodeInstructionIntegrationTest coverage (#4238) #19
This file contains hidden or 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: ParparVM Java Tests | |
| on: | |
| pull_request: | |
| paths: | |
| - 'vm/**' | |
| - '!vm/**/README.md' | |
| - '!vm/**/readme.md' | |
| - '!vm/**/docs/**' | |
| push: | |
| branches: [ master, main ] | |
| paths: | |
| - 'vm/**' | |
| - '!vm/**/README.md' | |
| - '!vm/**/readme.md' | |
| - '!vm/**/docs/**' | |
| jobs: | |
| vm-tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 8 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '8' | |
| cache: 'maven' | |
| - name: Install native build tools | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y clang | |
| - name: Run ParparVM JVM tests | |
| working-directory: vm/tests | |
| run: mvn -B test | |
| - name: Publish ByteCodeTranslator quality previews | |
| if: ${{ always() && github.server_url == 'https://github.com' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }} | |
| id: publish-bytecode-quality-previews | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| SERVER_URL: ${{ github.server_url }} | |
| REPOSITORY: ${{ github.repository }} | |
| RUN_ID: ${{ github.run_id }} | |
| RUN_ATTEMPT: ${{ github.run_attempt }} | |
| run: | | |
| set -euo pipefail | |
| if [ "${SERVER_URL}" != "https://github.com" ]; then | |
| echo "HTML previews are only published for github.com instances." | |
| exit 0 | |
| fi | |
| coverage_dir="vm/tests/target/site/jacoco" | |
| if [ ! -f "${coverage_dir}/index.html" ]; then | |
| echo "No HTML outputs detected; skipping preview publishing." | |
| exit 0 | |
| fi | |
| run_dir="runs/${RUN_ID}-${RUN_ATTEMPT}" | |
| tmp_dir=$(mktemp -d) | |
| dest_dir="${tmp_dir}/${run_dir}/coverage" | |
| mkdir -p "${dest_dir}" | |
| cp -R "${coverage_dir}/." "${dest_dir}/" | |
| printf '%s\n%s\n%s\n' \ | |
| '# Quality report previews' \ | |
| '' \ | |
| 'This branch is automatically managed by the PR CI workflow and may be force-pushed.' \ | |
| > "${tmp_dir}/README.md" | |
| git -C "${tmp_dir}" init -b previews >/dev/null | |
| git -C "${tmp_dir}" config user.name "github-actions[bot]" | |
| git -C "${tmp_dir}" config user.email "github-actions[bot]@users.noreply.github.com" | |
| git -C "${tmp_dir}" add . | |
| git -C "${tmp_dir}" commit -m "Publish quality report previews for run ${RUN_ID} (attempt ${RUN_ATTEMPT})" >/dev/null | |
| remote_url="${SERVER_URL}/${REPOSITORY}.git" | |
| token_remote_url="${remote_url/https:\/\//https://x-access-token:${GITHUB_TOKEN}@}" | |
| git -C "${tmp_dir}" push --force "${token_remote_url}" previews:quality-report-previews >/dev/null | |
| commit_sha=$(git -C "${tmp_dir}" rev-parse HEAD) | |
| raw_base="https://raw.githubusercontent.com/${REPOSITORY}/${commit_sha}/${run_dir}" | |
| preview_base="https://htmlpreview.github.io/?${raw_base}" | |
| echo "jacoco_url=${preview_base}/coverage/index.html" >> "$GITHUB_OUTPUT" | |
| - name: Generate ByteCodeTranslator quality report | |
| if: ${{ always() }} | |
| env: | |
| QUALITY_REPORT_TARGET_DIRS: vm/tests/target | |
| QUALITY_REPORT_SERVER_URL: ${{ github.server_url }} | |
| QUALITY_REPORT_REPOSITORY: ${{ github.repository }} | |
| QUALITY_REPORT_REF: ${{ github.event.pull_request.head.sha || github.sha }} | |
| QUALITY_REPORT_TITLE: "✅ ByteCodeTranslator Quality Report" | |
| JACOCO_HTML_URL: ${{ steps.publish-bytecode-quality-previews.outputs.jacoco_url }} | |
| run: python3 .github/scripts/generate-quality-report.py | |
| - name: Publish ByteCodeTranslator quality comment | |
| if: ${{ github.event_name == 'pull_request' }} | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const { publishQualityComment } = require('./.github/scripts/publish-quality-comment.js'); | |
| await publishQualityComment({ | |
| github, | |
| context, | |
| core, | |
| marker: '<!-- bytecode-quality-report -->', | |
| reportPath: 'quality-report.md', | |
| }); |