Publish workflow (graphistry/graph-app-kit)
The Publish workflow from graphistry/graph-app-kit, explained and optimized by Latchkey.
CI health: C - fair
Point runs-on at Latchkey and get run de-duplication, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Publish workflow from the graphistry/graph-app-kit repository, a real project running GitHub Actions. It is shown here with attribution under its BSD-3-Clause license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: Publish
on:
#Merge
push:
branches:
- master
#Label
pull_request:
types: [labeled]
#Enable UI-driven branch testing
workflow_dispatch:
#Test main bidaily @ 1a
schedule:
- cron: '0 1 1-31/2 * *'
jobs:
stub_mt:
name: Always-succeed step to prevent appearing as a failure
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Do nothing
run: echo "Do nothing"
publish:
name: Upload to Amazon S3
if: github.event.action != 'labeled' || github.event.label.name == 'publish'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.S3_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.S3_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.S3_AWS_REGION_PUBLIC }}
- name: Copy CloudFormation templates
run: |
aws s3 cp src/bootstraps/core/graphistry.yml "s3://${{ secrets.AWS_S3_BUCKET_PUBLIC}}/templates/latest/core/graphistry.yml"
aws s3 cp src/bootstraps/core/minimal.yml "s3://${{ secrets.AWS_S3_BUCKET_PUBLIC}}/templates/latest/core/minimal.yml"
aws s3 cp src/bootstraps/neptune/graphistry.yml "s3://${{ secrets.AWS_S3_BUCKET_PUBLIC}}/templates/latest/neptune/graphistry.yml"
aws s3 cp src/bootstraps/neptune/minimal.yml "s3://${{ secrets.AWS_S3_BUCKET_PUBLIC}}/templates/latest/neptune/minimal.yml"
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Publish on: #Merge push: branches: - master #Label pull_request: types: [labeled] #Enable UI-driven branch testing workflow_dispatch: #Test main bidaily @ 1a schedule: - cron: '0 1 1-31/2 * *' concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: stub_mt: name: Always-succeed step to prevent appearing as a failure runs-on: latchkey-small timeout-minutes: 10 steps: - name: Do nothing run: echo "Do nothing" publish: timeout-minutes: 30 name: Upload to Amazon S3 if: github.event.action != 'labeled' || github.event.label.name == 'publish' runs-on: latchkey-small steps: - name: Checkout uses: actions/checkout@v3 - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 with: aws-access-key-id: ${{ secrets.S3_AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.S3_AWS_SECRET_ACCESS_KEY }} aws-region: ${{ secrets.S3_AWS_REGION_PUBLIC }} - name: Copy CloudFormation templates run: | aws s3 cp src/bootstraps/core/graphistry.yml "s3://${{ secrets.AWS_S3_BUCKET_PUBLIC}}/templates/latest/core/graphistry.yml" aws s3 cp src/bootstraps/core/minimal.yml "s3://${{ secrets.AWS_S3_BUCKET_PUBLIC}}/templates/latest/core/minimal.yml" aws s3 cp src/bootstraps/neptune/graphistry.yml "s3://${{ secrets.AWS_S3_BUCKET_PUBLIC}}/templates/latest/neptune/graphistry.yml" aws s3 cp src/bootstraps/neptune/minimal.yml "s3://${{ secrets.AWS_S3_BUCKET_PUBLIC}}/templates/latest/neptune/minimal.yml"
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Cancel superseded runs when a branch or PR gets a newer push.
- Add a job timeout so a hung step cannot burn hours of runner time.
1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.
This workflow runs 2 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.