fix: isolate Spring session-scoped beans per user in multi-user tests #262
Workflow file for this run
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: Browserless Test Validation | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| types: [opened, synchronize, reopened, edited] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.head_ref || github.ref_name }} | |
| cancel-in-progress: true | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| HEAD_REF: ${{ github.head_ref }} | |
| REF_NAME: ${{ github.ref_name }} | |
| BASE_REF: ${{ github.event.pull_request.base.ref }} | |
| HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| PR_NUMBER: ${{ github.event.number }} | |
| JAVA_VERSION: 21 | |
| VAADIN_PRO_KEY: ${{ secrets.VAADIN_PRO_KEY }} | |
| jobs: | |
| format-check: | |
| name: Format Check | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ env.HEAD_SHA }} | |
| - name: Set up JDK ${{ env.JAVA_VERSION }} | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: ${{ env.JAVA_VERSION }} | |
| distribution: "temurin" | |
| - name: Cache Maven dependencies | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - name: Run spotless validation | |
| run: mvn spotless:check --batch-mode --no-transfer-progress | |
| build: | |
| name: Build Project | |
| needs: format-check | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ env.HEAD_SHA }} | |
| - name: Set up JDK ${{ env.JAVA_VERSION }} | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: ${{ env.JAVA_VERSION }} | |
| distribution: "temurin" | |
| - name: Cache Maven dependencies | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-${{ github.run_id }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - name: Clean Maven cache (if needed) | |
| if: github.event_name == 'workflow_dispatch' | |
| run: | | |
| echo "---> Clean maven cache" | |
| rm -rf ~/.m2/repository | |
| - name: Build with Maven and Generate Javadoc | |
| run: mvn clean install -DskipTests -Djavadocs -B | |
| unit-tests: | |
| name: Unit Tests | |
| needs: build | |
| if: ${{ !github.event.pull_request.head.repo.fork }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ env.HEAD_SHA }} | |
| - name: Set up JDK ${{ env.JAVA_VERSION }} | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: ${{ env.JAVA_VERSION }} | |
| distribution: "temurin" | |
| - name: Restore Maven cache | |
| uses: actions/cache/restore@v5 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-${{ github.run_id }} | |
| - name: Run unit tests | |
| run: mvn test -B | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: unit-test-results | |
| path: | | |
| **/target/surefire-reports/TEST-*.xml | |
| retention-days: 7 | |
| validation-status: | |
| name: Validation Status | |
| permissions: | |
| actions: write | |
| issues: read | |
| checks: write | |
| pull-requests: write | |
| if: ${{ always() && !github.event.pull_request.head.repo.fork }} | |
| needs: [format-check, build, unit-tests] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Remove format hint comment | |
| if: always() && needs.format-check.result == 'success' && github.event_name == 'pull_request' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number | |
| }); | |
| // Delete the validation hint comment | |
| const hintMarker = '<!-- format-check-comment -->'; | |
| const hintComment = comments.find(c => c.body.includes(hintMarker)); | |
| if (hintComment) { | |
| await github.rest.issues.deleteComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: hintComment.id | |
| }); | |
| console.log('Format hint comment removed.'); | |
| } else { | |
| console.log('No format hint comment found.'); | |
| } | |
| // Minimize format-apply comments and mark them as outdated | |
| const applyMarker = '<!-- format-apply-comment -->'; | |
| const outdatedMarker = '<!-- format-apply-comment-outdated -->'; | |
| const applyComments = comments.filter(c => c.body.includes(applyMarker)); | |
| for (const comment of applyComments) { | |
| await github.graphql(` | |
| mutation($id: ID!) { | |
| minimizeComment(input: { subjectId: $id, classifier: OUTDATED }) { | |
| minimizedComment { isMinimized } | |
| } | |
| } | |
| `, { id: comment.node_id }); | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: comment.id, | |
| body: comment.body.replace(applyMarker, outdatedMarker) | |
| }); | |
| console.log(`Minimized format-apply comment ${comment.id} as outdated.`); | |
| } | |
| - name: Post format hint comment | |
| if: always() && needs.format-check.result == 'failure' && github.event_name == 'pull_request' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const marker = '<!-- format-check-comment -->'; | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number | |
| }); | |
| if (comments.some(c => c.body.includes(marker))) { | |
| console.log('Format hint comment already exists, skipping.'); | |
| return; | |
| } | |
| const body = `${marker}\n:warning: **Formatting check failed.**\n\nReply with \`/format\` to automatically apply formatting fixes to this PR.`; | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: body | |
| }); | |
| - name: Download test results | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: unit-test-results | |
| - name: Publish test results | |
| uses: EnricoMi/publish-unit-test-result-action@v2 | |
| with: | |
| files: '**/TEST-*.xml' | |
| check_name: Test Results | |
| comment_mode: failures | |
| - name: Check all jobs status | |
| run: | | |
| echo "format-check: ${{ needs.format-check.result }}" | |
| echo "build: ${{ needs.build.result }}" | |
| echo "unit-tests: ${{ needs.unit-tests.result }}" | |
| if [ "${{ needs.format-check.result }}" != "success" ] || \ | |
| [ "${{ needs.build.result }}" != "success" ] || \ | |
| [ "${{ needs.unit-tests.result }}" != "success" ]; then | |
| echo "One or more validation jobs failed" | |
| exit 1 | |
| fi | |
| echo "All validation jobs completed successfully" |