From ed98882064003ce19b28f61184561f9982a192f6 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Wed, 13 Dec 2023 11:31:32 -0500 Subject: [PATCH 1/4] ci tweaks --- .github/scripts/get-matrix.ts | 4 ++-- .github/workflows/cd.yml | 6 ++--- .github/workflows/new-version.yml | 23 +++++--------------- .github/workflows/pkg-platform.yml | 35 ++++++++++++++++++++---------- .github/workflows/pkg.yml | 9 ++++---- 5 files changed, 39 insertions(+), 38 deletions(-) diff --git a/.github/scripts/get-matrix.ts b/.github/scripts/get-matrix.ts index 5bcf3a8df5..8363a35638 100755 --- a/.github/scripts/get-matrix.ts +++ b/.github/scripts/get-matrix.ts @@ -73,7 +73,7 @@ function get_matrix(platform: string) { container: "debian:buster-slim", "test-os": [os], "test-container": ["debian:buster-slim", "ubuntu", "archlinux"], - tinyname: "Lnx·x64" + tinyname: "*nix64" }} case 'linux/aarch64': { const os = ["self-hosted", "linux", "ARM64"] @@ -81,6 +81,6 @@ function get_matrix(platform: string) { os, name, "test-os": [os], "test-container": [null], - tinyname: "Lnx·ARM64" + tinyname: "*nix·ARM64" }}} } diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 0cb7a0ca0e..6e3e8e0667 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -11,7 +11,7 @@ concurrency: cancel-in-progress: true jobs: - get-projects: + ingest: runs-on: ubuntu-latest outputs: projects: ${{ steps.diff.outputs.diff }} @@ -29,10 +29,10 @@ jobs: done echo "diff=$RESULT" >> $GITHUB_OUTPUT - pkgit: + pkg: strategy: fail-fast: false - needs: get-projects + needs: ingest permissions: issues: write uses: ./.github/workflows/new-version.yml diff --git a/.github/workflows/new-version.yml b/.github/workflows/new-version.yml index 215df47073..3b4b870fcc 100644 --- a/.github/workflows/new-version.yml +++ b/.github/workflows/new-version.yml @@ -16,7 +16,7 @@ on: type: string jobs: - divide: + ingest: runs-on: ubuntu-latest outputs: pkgs: ${{ steps.divide.outputs.pkgs }} @@ -26,26 +26,13 @@ jobs: echo "pkgs=$var" >> $GITHUB_OUTPUT id: divide - pkgit: - needs: divide + pkg: + needs: ingest strategy: + fail-fast: false matrix: - pkg: ${{ fromJSON(needs.divide.outputs.pkgs) }} + pkg: ${{ fromJSON(needs.ingest.outputs.pkgs) }} uses: ./.github/workflows/pkg.yml with: pkg: ${{ matrix.pkg }} secrets: inherit - - complain: - needs: pkgit - if: failure() - runs-on: ubuntu-latest - strategy: - fail-fast: false - permissions: - issues: write - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/complain - with: - pkg: ${{ inputs.projects }} diff --git a/.github/workflows/pkg-platform.yml b/.github/workflows/pkg-platform.yml index 71ec0d2251..82cc2e4709 100644 --- a/.github/workflows/pkg-platform.yml +++ b/.github/workflows/pkg-platform.yml @@ -5,20 +5,21 @@ on: workflow_call: inputs: name: + description: brewkit platform unique ID + type: string + tinyname: description: > - pretty name for the workflow to make GitHub Actions matrix output - more legible - required: false + GitHub Actions has a non resizable sidebar so we need a shorter name + or it’s much harder to differentiate the different jobs. type: string + default: ${{ inputs.name }} os: - required: true type: string container: required: false type: string pkg: description: eg. `example.com@1.2.3` - required: true type: string dry-run: description: dry runs do not modify bottle storage @@ -26,14 +27,12 @@ on: default: false test-os: description: a JSON array of runner-names - required: true type: string test-container: description: > A JSON array of docker image names or `[null]`. Indeed! You cannot leave this as `null` or undefined. Sorry, GHA is not flexible enough to efficiently work around this. - required: true type: string secrets: APPLE_CERTIFICATE_P12: { required: false } @@ -48,7 +47,7 @@ on: jobs: build: - name: build (${{inputs.name}}) + name: build ${{inputs.tinyname}} runs-on: ${{ fromJSON(inputs.os) }} container: ${{ inputs.container }} outputs: @@ -85,7 +84,7 @@ jobs: - uses: pkgxdev/brewkit/upload-build-artifact@v1 test: - name: test (${{inputs.name}}) ${{ matrix.container || ''}} ${{ join(matrix.os) }} + name: test ${{inputs.tinyname}} ${{ matrix.container || ''}} ${{ matrix.container || '' }} ${{ join(matrix.os, '+') }} needs: build strategy: matrix: @@ -104,7 +103,7 @@ jobs: pkg: ${{ needs.build.outputs.pkg }} bottle: - name: bottle (${{inputs.name}}+${{matrix.compression}}) + name: bottle (${{inputs.tinyname}}.${{matrix.compression}}) needs: [build, test] strategy: matrix: @@ -168,7 +167,8 @@ jobs: id: put if: ${{ ! inputs.dry-run }} - versions: + publish: + name: publish ${{inputs.tinyname}} ${{ inputs.dry-run && '(dry-run)' }} runs-on: ubuntu-latest needs: [bottle, build] env: @@ -208,3 +208,16 @@ jobs: /$DIRNAME/versions.txt ${{ needs.bottle.outputs.paths }} if: ${{ ! inputs.dry-run }} + + complain: + needs: [build, test, bottle] + if: failure() && !inputs.dry-run + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/complain + with: + pkg: ${{ inputs.pkg }} + platform: ${{ inputs.name }} diff --git a/.github/workflows/pkg.yml b/.github/workflows/pkg.yml index b3bb4e6b45..5138de48e3 100644 --- a/.github/workflows/pkg.yml +++ b/.github/workflows/pkg.yml @@ -12,7 +12,7 @@ on: default: false jobs: - get-matrix: + plan: runs-on: ubuntu-latest outputs: matrix: ${{ steps.matrix.outputs.matrix }} @@ -22,13 +22,13 @@ jobs: - run: .github/scripts/get-matrix.ts ${{ inputs.pkg }} id: matrix - pkgit: - needs: get-matrix + pkg: + needs: plan name: ${{matrix.platform.tinyname}} strategy: fail-fast: false matrix: - platform: ${{ fromJSON(needs.get-matrix.outputs.matrix) }} + platform: ${{ fromJSON(needs.plan.outputs.matrix) }} uses: ./.github/workflows/pkg-platform.yml with: pkg: ${{ inputs.pkg }} @@ -38,4 +38,5 @@ jobs: test-os: ${{ toJSON(matrix.platform.test-os) }} test-container: ${{ toJSON(matrix.platform.test-container) }} dry-run: ${{ inputs.dry-run }} + tinyname: ${{ matrix.platform.tinyname }} secrets: inherit From 78585ce98fc0d5596eb7788164e9df55da644563 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Wed, 13 Dec 2023 11:37:32 -0500 Subject: [PATCH 2/4] wip --- .github/workflows/new-version.yml | 2 ++ .github/workflows/pkg.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/new-version.yml b/.github/workflows/new-version.yml index 3b4b870fcc..2e5afe7255 100644 --- a/.github/workflows/new-version.yml +++ b/.github/workflows/new-version.yml @@ -33,6 +33,8 @@ jobs: matrix: pkg: ${{ fromJSON(needs.ingest.outputs.pkgs) }} uses: ./.github/workflows/pkg.yml + permissions: + issues: write with: pkg: ${{ matrix.pkg }} secrets: inherit diff --git a/.github/workflows/pkg.yml b/.github/workflows/pkg.yml index 5138de48e3..29545d7b20 100644 --- a/.github/workflows/pkg.yml +++ b/.github/workflows/pkg.yml @@ -30,6 +30,8 @@ jobs: matrix: platform: ${{ fromJSON(needs.plan.outputs.matrix) }} uses: ./.github/workflows/pkg-platform.yml + permissions: + issues: write with: pkg: ${{ inputs.pkg }} name: ${{ matrix.platform.name }} From bb5ab0bd9b9f149e17724f401bb89a0ed1367fa8 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Wed, 13 Dec 2023 11:38:10 -0500 Subject: [PATCH 3/4] wip --- .github/workflows/ci-squared.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci-squared.yml b/.github/workflows/ci-squared.yml index 2336e28f08..bdc60ea924 100644 --- a/.github/workflows/ci-squared.yml +++ b/.github/workflows/ci-squared.yml @@ -22,6 +22,8 @@ jobs: pkg: - r-wos.org/gti - github.com/ggerganov/llama.cpp # has platform restrictions + permissions: + issues: write with: pkg: ${{ matrix.pkg }} dry-run: true From 14438cc8dbfc0f46c1aa33b497d7d432b0112da2 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Wed, 13 Dec 2023 11:40:04 -0500 Subject: [PATCH 4/4] wip --- .github/workflows/cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 6e3e8e0667..e6bae5df7b 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -37,5 +37,5 @@ jobs: issues: write uses: ./.github/workflows/new-version.yml with: - projects: ${{ needs.get-projects.outputs.projects }} + projects: ${{ needs.ingest.outputs.projects }} secrets: inherit