From fc687f102324ffa32aaba8968c822e379c555fb2 Mon Sep 17 00:00:00 2001 From: lucasew Date: Sun, 22 Dec 2024 21:22:51 -0300 Subject: [PATCH] actions: post all results at once Signed-off-by: lucasew --- .github/workflows/nixpkgs-review.yml | 49 +++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/.github/workflows/nixpkgs-review.yml b/.github/workflows/nixpkgs-review.yml index 15c63a0..eb4ffba 100644 --- a/.github/workflows/nixpkgs-review.yml +++ b/.github/workflows/nixpkgs-review.yml @@ -47,7 +47,7 @@ concurrency: cancel-in-progress: true jobs: - comment: + pre-run: runs-on: ubuntu-latest steps: - uses: actions/github-script@v7 @@ -75,6 +75,32 @@ jobs: repo: 'nixpkgs', body: process.env.MESSAGE }) + post-run: + runs-on: ubuntu-latest + needs: + - build-x86_64-linux + - build-aarch64-darwin + - build-x86_64-darwin + if: ${{ always() }} + steps: + - name: Fetch reports from runners + uses: actions/download-artifact@v4 + with: + path: reports + pattern: report-* + - name: Join reports + run: cat reports/**/*.md > report.md + - uses: actions/github-script@v7 + with: + script: | + const fs = require('node:fs'); + github.rest.issues.createComment({ + issue_number: process.env.PR, + owner: 'NixOS', + repo: 'nixpkgs', + body: fs.readFileSync("report.md") + }) + build-x86_64-linux: name: 'x86_64-linux' if: ${{ github.event.inputs.x86_64-linux == 'true' }} @@ -115,7 +141,7 @@ jobs: git config --global user.email "user@example.com" git config --global user.name "user" cd $GITHUB_WORKSPACE/nixpkgs - nix run nixpkgs#nixpkgs-review -- pr $PR --print-result --post-result --no-shell $EXTRA_ARGS + nix run nixpkgs#nixpkgs-review -- pr $PR --print-result --no-shell $EXTRA_ARGS - uses: actions/upload-artifact@v4 if: always() with: @@ -124,6 +150,11 @@ jobs: ~/.cache/nixpkgs-review/*/logs /nix/var/log/nix/drvs include-hidden-files: true + - uses: actions/upload-artifact@v4 + if: always() + with: + name: report-x86_64-linux + path: ~/.cache/nixpkgs-review/*/report.md build-aarch64-darwin: name: 'aarch64-darwin' @@ -155,7 +186,7 @@ jobs: git config --global user.email "user@example.com" git config --global user.name "user" cd $GITHUB_WORKSPACE/nixpkgs - nix run nixpkgs#nixpkgs-review -- pr $PR --print-result --post-result --no-shell $EXTRA_ARGS + nix run nixpkgs#nixpkgs-review -- pr $PR --print-result --no-shell $EXTRA_ARGS - uses: actions/upload-artifact@v4 if: always() with: @@ -164,6 +195,11 @@ jobs: /nix/var/log/nix/drvs ~/.cache/nixpkgs-review/*/logs include-hidden-files: true + - uses: actions/upload-artifact@v4 + if: always() + with: + name: report-aarch64-darwin + path: ~/.cache/nixpkgs-review/*/report.md build-x86_64-darwin: name: 'x86_64-darwin' @@ -195,7 +231,7 @@ jobs: git config --global user.email "user@example.com" git config --global user.name "user" cd $GITHUB_WORKSPACE/nixpkgs - nix run nixpkgs#nixpkgs-review -- pr $PR --print-result --post-result --no-shell $EXTRA_ARGS + nix run nixpkgs#nixpkgs-review -- pr $PR --print-result --no-shell $EXTRA_ARGS - uses: actions/upload-artifact@v4 if: always() with: @@ -204,3 +240,8 @@ jobs: /nix/var/log/nix/drvs ~/.cache/nixpkgs-review/*/logs include-hidden-files: true + - uses: actions/upload-artifact@v4 + if: always() + with: + name: report-x86_64-darwin + path: ~/.cache/nixpkgs-review/*/report.md