GHA gardening (#1299)

This commit is contained in:
Max Howell 2023-04-09 08:26:48 -04:00 committed by GitHub
parent c84784be07
commit e36f971356
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 116 additions and 150 deletions

66
.github/actions/complain/action.yml vendored Normal file
View file

@ -0,0 +1,66 @@
name: tea/pantry/complain
description: creates an issue for failure conditions
inputs:
projects:
description: projects to complain about
required: true
platform:
description: platform key
required: true
token:
required: true
default: ${{ github.token }}
slack-webhook:
required: false
slack-channel:
required: false
runs:
using: composite
steps:
- name: Find Issue
uses: actions-cool/issues-helper@v3
id: find
with:
actions: 'find-issues'
token: ${{ inputs.token }}
issue-state: 'open'
title-includes: "❌ build issues: ${{ inputs.projects }}"
labels: 'build-failure'
- name: Create Issue
uses: actions-cool/issues-helper@v3
id: create
if: ${{ steps.find.outputs.issues == '[]' }}
with:
actions: 'create-issue'
token: ${{ inputs.token }}
title: "❌ build issues: ${{ inputs.projects }}"
body: "Running log of build failures for ${{ inputs.projects }}"
labels: 'build-failure'
assignees: 'jhheider'
- name: Log Comment
uses: actions-cool/issues-helper@v3
with:
actions: 'create-comment'
token: ${{ inputs.token }}
issue-number: ${{ steps.create.outputs.issue-number || fromJSON(steps.find.outputs.issues)[0].number }}
body: |
# Build failure
## ${{ inputs.projects }}
### ${{ inputs.platform }}
logs: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- uses: martialonline/workflow-status@v3
id: status
- uses: rtCamp/action-slack-notify@v2
if: ${{ inputs.slack-webhook != '' }}
env:
SLACK_WEBHOOK: ${{ inputs.slack-webhook }}
SLACK_CHANNEL: ${{ inputs.slack-channel }}
SLACK_MESSAGE: new-version:${{ inputs.projects }} (${{ inputs.platform }}) ${{ steps.status.outputs.status }}
SLACK_COLOR: ${{ steps.status.outputs.status }}

View file

@ -155,12 +155,3 @@ jobs:
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
complain:
needs: [upload]
if: inputs.new-version == 'true' && failure()
uses: ./.github/workflows/complain.yml
with:
projects: ${{ inputs.projects }}
platform: ${{ inputs.platform }}
secrets: inherit

View file

@ -9,10 +9,6 @@ on:
platform:
required: true
type: string
new-version:
type: boolean
required: false
default: false
jobs:
get-platform:
@ -140,24 +136,6 @@ jobs:
env:
HAS_SECRETS: ${{ secrets.AWS_S3_CACHE != null }}
bottle:
needs: [test]
if: inputs.new-version == true
uses: ./.github/workflows/bottle.yml
with:
new-version: ${{ inputs.new-version }}
platform: ${{ inputs.platform }}
secrets: inherit
complain:
needs: [test]
if: inputs.new-version == true && failure()
uses: ./.github/workflows/complain.yml
with:
projects: ${{ inputs.projects }}
platform: ${{ inputs.platform }}
secrets: inherit
stage:
needs: [test]
# this only works for PRs from our team to our repo (security! :( )

View file

@ -12,6 +12,7 @@ jobs:
has-artifacts: ${{ steps.has-artifacts.outputs.has-artifacts }}
steps:
- uses: actions/checkout@v3
# ^^ NOTE probably no longer required but I dont dare try to remove it
- uses: teaxyz/brewkit/actions/setup-brewkit@v0

View file

@ -1,20 +0,0 @@
name: ci·scripts
on:
pull_request:
paths:
- .github/**.ts
jobs:
typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: teaxyz/setup@v0
with:
srcroot: .github
- uses: teaxyz/brewkit/actions/cache@v0
with:
cache-name: ci-scripts
- run: deno check --unstable **/*.ts
working-directory: .github

View file

@ -4,7 +4,7 @@ run-name: 'ci: ${{ github.event.pull_request.title }}'
on: pull_request
jobs:
get-diff:
get-projects:
runs-on: ubuntu-latest
outputs:
diff: ${{ steps.diff.outputs.diff }}
@ -21,7 +21,7 @@ jobs:
RESULT="$RESULT $y"
done
echo "diff=$RESULT" >> $GITHUB_OUTPUT
ci:
build:
strategy:
fail-fast: false
matrix:
@ -30,9 +30,9 @@ jobs:
- linux+x86-64
- darwin+aarch64
- linux+aarch64
needs: [get-diff]
needs: [get-projects]
uses: ./.github/workflows/build.yml
with:
projects: ${{ needs.get-diff.outputs.diff || 'zlib.net^1.2' }}
projects: ${{ needs.get-projects.outputs.diff || 'zlib.net^1.2' }}
platform: ${{ matrix.platform }}
secrets: inherit

View file

@ -1,64 +0,0 @@
name: complain
on:
workflow_call:
inputs:
projects:
required: true
type: string
platform:
required: true
type: string
permissions:
issues: write
jobs:
complain:
runs-on: ubuntu-latest
steps:
- name: Find issue
uses: actions-cool/issues-helper@v3
id: find
with:
actions: 'find-issues'
token: ${{ secrets.GITHUB_TOKEN }}
issue-state: 'open'
title-includes: "❌ build issues: ${{ inputs.projects }}"
labels: 'build-failure'
- name: Create issue
uses: actions-cool/issues-helper@v3
id: create
if: ${{ steps.find.outputs.issues == '[]' }}
with:
actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }}
title: "❌ build issues: ${{ inputs.projects }}"
body: "Running log of build failures for ${{ inputs.projects }}"
labels: 'build-failure'
assignees: 'jhheider'
- name: Log comment
uses: actions-cool/issues-helper@v3
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ steps.create.outputs.issue-number || fromJSON(steps.find.outputs.issues)[0].number }}
body: |
# Build failure
## ${{ inputs.projects }}
### ${{ inputs.platform }}
logs: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- uses: martialonline/workflow-status@v3
id: status
- uses: rtCamp/action-slack-notify@v2
if: ${{ env.SLACK_WEBHOOK != '' }}
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
SLACK_MESSAGE: new-version:${{ inputs.projects }} (${{ inputs.platform }}) ${{ steps.status.outputs.status }}
SLACK_COLOR: ${{ steps.status.outputs.status }}

View file

@ -1,26 +0,0 @@
name: index-data
on:
workflow_call:
inputs:
projects:
required: true
type: string
jobs:
queue-detail-ingestion:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: teaxyz/setup@v0
with:
srcroot: null
- uses: teaxyz/brewkit/actions/cache@v0
# TODO: convert to teaxyz/brewkit/actions/index-packages
- run: ./.github/scripts/index-packages.ts ${{ inputs.projects }}
env:
TEA_PANTRY_PATH: ${{ github.workspace }}
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SQS_GENERATE_PACKAGE_DETAILS_URL: ${{ secrets.SQS_GENERATE_PACKAGE_DETAILS_URL }}

View file

@ -1,5 +1,6 @@
name: new-version
run-name: building ${{ inputs.projects }}
on:
workflow_dispatch:
inputs:
@ -20,15 +21,54 @@ jobs:
- linux+aarch64
uses: ./.github/workflows/build.yml
with:
new-version: true
projects: ${{ inputs.projects }}
platform: ${{ matrix.platform }}
secrets: inherit
index_data:
bottle:
strategy:
fail-fast: false
matrix:
platform:
- darwin+x86-64
- linux+x86-64
- darwin+aarch64
- linux+aarch64
needs: [build]
if: success()
uses: ./.github/workflows/index-data.yml
uses: ./.github/workflows/bottle.yml
with:
projects: ${{ inputs.projects }}
new-version: true
platform: ${{ matrix.platform }}
secrets: inherit
complain:
needs: [build, bottle]
if: failure()
permissions:
issues: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/complain.yml
with:
projects: ${{ inputs.projects }}
platform: ${{ inputs.platform }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
slack-channel: ${{ secrets.SLACK_CHANNEL }}
index_data:
needs: [bottle]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: teaxyz/setup@v0
with:
srcroot: null
- uses: teaxyz/brewkit/actions/cache@v0
- run: ./.github/scripts/index-packages.ts ${{ inputs.projects }}
env:
TEA_PANTRY_PATH: ${{ github.workspace }}
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SQS_GENERATE_PACKAGE_DETAILS_URL: ${{ secrets.SQS_GENERATE_PACKAGE_DETAILS_URL }}