From be9c0dc17018f798ea20448124ea39ef626aa757 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sun, 12 Jan 2025 20:24:02 +0100 Subject: [PATCH] workflows/nixpkgs-review: init --- .github/workflows/nixpkgs-review.yml | 90 ++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 .github/workflows/nixpkgs-review.yml diff --git a/.github/workflows/nixpkgs-review.yml b/.github/workflows/nixpkgs-review.yml new file mode 100644 index 00000000000000..6ce88498f1553e --- /dev/null +++ b/.github/workflows/nixpkgs-review.yml @@ -0,0 +1,90 @@ +# This workflow allows a contributor to run nixpkgs-review in their own fork, using +# their own allocated Github Actions runners. +# To get started, make sure that the master branch of your fork contains this workflow. +# Then: +# - Go to Actions -> A run of nixpkgs-review +# - Click "Run workflow" +# - Enter the upstream pull request number +# - Click "Run workflow" + +# Note, this begins with "A" on purpose, to make it appear at the top of the list +# of workflows for convenience. +name: "A run of nixpkgs-review" + +on: + workflow_dispatch: + inputs: + pr: + description: Nixpkgs PR Number + required: true + +run-name: "nixpkgs-review for #${{ inputs.pr }}" + +permissions: {} + +jobs: + nixpkgs-review: + strategy: + fail-fast: false + matrix: + include: + - runner: macos-14 + system: aarch64-darwin + - runner: ubuntu-24.04-arm + system: aarch64-linux + - runner: macos-13 + system: x86_64-darwin + - runner: ubuntu-24.04 + system: x86_64-linux + + name: "#${{ inputs.pr }} @ ${{ matrix.system }}" + runs-on: ${{ matrix.runner }} + env: + PR_NUMBER: ${{ inputs.pr }} + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - uses: cachix/install-nix-action@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30 + + - name: Collect debug info + run: | + find + ls -al /home/runneradmin + echo Running nixpkgs-review version: + # Using nixpkgs channel instead of local checkout to avoid having to keep + # a the fork's master branch up to date. + nix run 'nixpkgs#nixpkgs-review' -- --version + + - name: Run nixpkgs-review + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + mkdir report-${{ matrix.system }} + nix run 'nixpkgs#nixpkgs-review' -- \ + pr --print-result \ + --run 'mv logs report.json report.md "${{ github.workspace }}"/report-${{ matrix.system }}' \ + --systems current \ + "$PR_NUMBER" + + - name: Upload report + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 + with: + name: report-${{ matrix.system }} + path: report-${{ matrix.system }} + + summary: + name: "#${{ inputs.pr }} summary" + needs: nixpkgs-review + runs-on: ubuntu-24.04 + steps: + - name: Download reports + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + + - name: Post step summary + run: | + for folder in report-*; do + csplit --prefix="$folder-" -n1 "$folder/report.md" "/---/" + echo >> "$folder-1" + done + cat report-x86_64-linux-0 >> "$GITHUB_STEP_SUMMARY" + cat report-*-1 >> "$GITHUB_STEP_SUMMARY"