Tc 3278 fix latest filtering #1791
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: scale-test | |
| on: | |
| issue_comment: | |
| types: [created] | |
| jobs: | |
| scale-test: | |
| if: github.event.comment.body == '/scale-test' && github.event.issue.pull_request != null | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Check if Commenter is a Collaborator | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| COMMENTER: ${{ github.event.comment.user.login }} | |
| REPO: ${{ github.repository }} | |
| run: | | |
| PERMISSIONS=$(gh api repos/$REPO/collaborators/$COMMENTER/permission --jq '.permission') | |
| echo "User Permission: $PERMISSIONS" | |
| if [[ "$PERMISSIONS" != "admin" && "$PERMISSIONS" != "write" && "$PERMISSIONS" != "maintain" ]]; then | |
| echo "❌ User does not have permission to trigger this action." | |
| exit 1 | |
| fi | |
| - name: Acknowledge Command | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| COMMENT_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
| gh api repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments \ | |
| -f body="🛠️ Scale test has started! Follow the progress here: [Workflow Run]($COMMENT_URL)" | |
| - name: Maximize build space | |
| run: | | |
| df -h | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /usr/local/lib/android | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf /opt/hostedtoolcache/CodeQL | |
| sudo docker image prune --all --force | |
| sudo rm -Rf ${JAVA_HOME_8_X64} | |
| sudo rm -Rf ${JAVA_HOME_11_X64} | |
| sudo rm -Rf ${JAVA_HOME_17_X64} | |
| sudo rm -Rf ${RUBY_PATH} | |
| df -h | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: "guacsec/trustify-scale-test-runs" | |
| - run: | | |
| mkdir report | |
| mkdir baseline | |
| - name: Provide baseline | |
| run: | | |
| cp publish/baseline.json baseline/ | |
| # 'rev' supports the PR number in https://github.com/guacsec/trustify-scale-test-runs/blob/main/Containerfile.trustify | |
| # the PR number is stored in 'github.event.issue.number' when managing an 'issue_comment' event as reported in | |
| # https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#issue_comment-on-issues-only-or-pull-requests-only | |
| - name: Build Containers | |
| run: | | |
| docker compose -f compose.yaml build --build-arg rev=pr/${{ github.event.issue.number }} | |
| - name: Run | |
| run: | | |
| docker compose -f compose.yaml run loadtests | |
| - if: always() | |
| run: | | |
| docker compose -f compose.yaml logs > containers.log | |
| - name: Cleanup | |
| if: always() | |
| run: | | |
| docker compose -f compose.yaml down | |
| - name: Upload container logs | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: logs | |
| path: | | |
| containers.log | |
| if-no-files-found: error | |
| - name: Upload report | |
| uses: actions/upload-artifact@v4 | |
| if: success() | |
| with: | |
| name: report | |
| path: | | |
| report/report.html | |
| report/report.json | |
| report/report.md | |
| if-no-files-found: error | |
| - name: Get Artifact Page URL | |
| id: artifact-url | |
| run: | | |
| ARTIFACT_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
| echo "artifact_url=$ARTIFACT_URL" >> $GITHUB_ENV | |
| - name: Post comment | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| COMMENT_BODY=$(cat <<__EOF__ | |
| <details><summary>Goose Report</summary> | |
| $(cat report/report.md) | |
| </details> | |
| 📄 **[Full Report](${{ env.artifact_url }})** (Go to "Artifacts" and download **report**) | |
| __EOF__ | |
| ) | |
| gh api repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments \ | |
| -f body="$COMMENT_BODY" |