diff --git a/.github/workflows/ci-reports.yaml b/.github/workflows/ci-reports.yaml new file mode 100644 index 00000000..233d7c32 --- /dev/null +++ b/.github/workflows/ci-reports.yaml @@ -0,0 +1,30 @@ +name: "PR Reports" +on: + workflow_run: + workflows: ["CI"] + types: + - completed + +jobs: + report: + name: "Report" + runs-on: ubuntu-latest + steps: + - name: Get PR issue number + id: get-pr + uses: octokit/request-action@v2.x + with: + route: GET /repos/${{ github.event.workflow_run.repository.full_name }}/actions/runs/${{ github.event.workflow_run.id }} + - name: Extract PR number + run: | + ${{ steps.get-pr.outputs.data }} + + # Extract the PR number from the 'head_branch' field + pr_number=$(echo '${{ steps.get-pr.outputs.data }}' | jq -r '.head_branch' | grep -oP 'pull/\K\d+') + + # Check if the workflow run was for a PR + if [ -z "$pr_number" ]; then + echo "This workflow run was not for a PR." + else + echo "This workflow run was for PR #$pr_number." + fi diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d6287c95..3a21aa01 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -93,12 +93,12 @@ jobs: exit ${result} - - name: "Publish test results" - uses: EnricoMi/publish-unit-test-result-action@v2 - if: always() - with: - files: | - test-results-*.xml + # - name: "Publish test results" + # uses: EnricoMi/publish-unit-test-result-action@v2 + # if: always() + # with: + # files: | + # test-results-*.xml - name: "Generate code coverage report" uses: clearlyip/code-coverage-report-action@v4 @@ -108,12 +108,24 @@ jobs: artifact_download_workflow_names: "CI" filename: "codecov.xml" - - name: "Publish code coverage data to PR" - uses: marocchino/sticky-pull-request-comment@v2 - if: ${{ github.actor != 'dependabot[bot]' && steps.code_coverage_report.outputs.file != '' && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') }} + - name: "Upload code coverage report" + uses: actions/upload-artifact@v4 with: + name: pr-reports path: code-coverage-results.md + - name: "Upload event file" + uses: actions/upload-artifact@v4 + with: + name: event-file + path: ${{ github.event_path }} + + # - name: "Publish code coverage data to PR" + # uses: marocchino/sticky-pull-request-comment@v2 + # if: ${{ github.actor != 'dependabot[bot]' && steps.code_coverage_report.outputs.file != '' && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') }} + # with: + # path: code-coverage-results.md + check: name: "Source code checks" runs-on: ubuntu-latest @@ -189,17 +201,25 @@ jobs: run: cargo bench --workspace -- --output-format bencher | tee benchmarks.txt working-directory: main - - name: Compare benchmark results - uses: openpgpjs/github-action-pull-request-benchmark@v1 - if: ${{ github.actor != 'dependabot[bot]' }} + - name: Upload performance results + uses: actions/upload-artifact@v4 with: - name: "Time benchmark" - tool: "cargo" - pr-benchmark-file-path: pr/benchmarks.txt - base-benchmark-file-path: main/benchmarks.txt - comment-always: true - alert-threshold: "130%" - fail-on-alert: false - fail-threshold: "150%" - # A token is needed to leave commit comments - github-token: ${{ secrets.GITHUB_TOKEN }} + name: pr-reports + path: | + pr/benchmarks.txt + main/benchmarks.txt + + # - name: Compare benchmark results + # uses: openpgpjs/github-action-pull-request-benchmark@v1 + # if: ${{ github.actor != 'dependabot[bot]' }} + # with: + # name: "Time benchmark" + # tool: "cargo" + # pr-benchmark-file-path: pr/benchmarks.txt + # base-benchmark-file-path: main/benchmarks.txt + # comment-always: true + # alert-threshold: "130%" + # fail-on-alert: false + # fail-threshold: "150%" + # # A token is needed to leave commit comments + # github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/devcontainer.yaml b/.github/workflows/devcontainer.yaml index f289833e..ac43b11b 100644 --- a/.github/workflows/devcontainer.yaml +++ b/.github/workflows/devcontainer.yaml @@ -5,12 +5,40 @@ on: - main pull_request: paths: - - '.devcontainer/**' + - ".devcontainer/**" jobs: build: - name: "Build and publish" + name: "Build devcontainer" runs-on: ubuntu-latest + permissions: + contents: read + packages: read + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Pre-build dev container image + uses: devcontainers/ci@v0.3 + with: + imageName: ghcr.io/reubeno/brush/devcontainer + imageTag: latest + cacheFrom: ghcr.io/reubeno/brush/devcontainer + push: never + + build_and_publish: + name: "Build and publish devcontainer" + runs-on: ubuntu-latest + permissions: + contents: read + packages: write steps: - name: Checkout sources uses: actions/checkout@v4