Bump actions/upload-artifact from 5 to 6 #521
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: tests | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| unit: | |
| name: unit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v6 | |
| - name: unit tests | |
| run: make test | |
| integration: | |
| name: integration-${{ matrix.storage }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| storage: [memory, postgres, nginx, dnsmasq, cluster-valkey] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Start bridge | |
| run: docker compose -f docker/docker-compose.${{ matrix.storage }}.yml up --build -d bridge | |
| - name: Run bridge-sdk tests | |
| id: bridge_sdk_tests | |
| run: | | |
| docker compose -f docker/docker-compose.${{ matrix.storage }}.yml run --rm integration || rc=$? | |
| rc=${rc:-0} | |
| echo "sdk_rc=$rc" >> $GITHUB_OUTPUT | |
| if [ $rc -ne 0 ]; then | |
| echo "Bridge SDK tests failed with exit code $rc" | |
| fi | |
| - name: Run go-integration tests | |
| id: go_integration_tests | |
| run: | | |
| docker compose -f docker/docker-compose.${{ matrix.storage }}.yml run --rm gointegration || rc=$? | |
| rc=${rc:-0} | |
| echo "go_rc=$rc" >> $GITHUB_OUTPUT | |
| if [ $rc -ne 0 ]; then | |
| echo "Go integration tests failed with exit code $rc" | |
| fi | |
| - name: Get performance metrics | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| ./scripts/pr-metrics.sh "${{ matrix.storage }}" > metrics-${{ matrix.storage }}.md | |
| - name: Update PR comment with current metrics | |
| if: github.event_name == 'pull_request' | |
| continue-on-error: true | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const metrics = fs.readFileSync('metrics-${{ matrix.storage }}.md', 'utf8'); | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const marker = '<!-- metrics-${{ matrix.storage }} -->'; | |
| const botComment = comments.find(c => c.user.type === 'Bot' && c.body.includes(marker)); | |
| if (botComment) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: botComment.id, | |
| body: `${marker}\n# 📊 Performance Metrics\n\n${metrics}` | |
| }); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: `${marker}\n# 📊 Performance Metrics\n\n${metrics}` | |
| }); | |
| } | |
| - name: Upload metrics artifact | |
| if: github.event_name == 'pull_request' | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: metrics-${{ matrix.storage }} | |
| path: metrics-${{ matrix.storage }}.md | |
| retention-days: 1 | |
| - name: Clean up containers | |
| if: always() | |
| run: docker compose -f docker/docker-compose.${{ matrix.storage }}.yml down -v | |
| - name: Fail job if any tests failed | |
| if: ${{ fromJSON(steps.bridge_sdk_tests.outputs.sdk_rc) != 0 || fromJSON(steps.go_integration_tests.outputs.go_rc) != 0 }} | |
| run: | | |
| echo "Test failures detected:" | |
| echo " Bridge SDK tests: exit code ${{ steps.bridge_sdk_tests.outputs.sdk_rc }}" | |
| echo " Go integration tests: exit code ${{ steps.go_integration_tests.outputs.go_rc }}" | |
| exit 1 |