Atlas CI Public workflow (ent/ent)
The Atlas CI Public workflow from ent/ent, 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 Atlas CI Public workflow from the ent/ent repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: Atlas CI Public
on:
# Run whenever code is changed in the master branch,
# change this to your root branch.
push:
branches:
- master
paths:
- 'examples/migration/ent/migrate/migrations/*'
pull_request:
paths:
- 'examples/migration/ent/migrate/migrations/*'
jobs:
sync:
permissions:
contents: read
id-token: write
needs: lint
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ariga/atlas-sync-action@v0
with:
dir: 'examples/migration/ent/migrate/migrations'
driver: mysql # or: postgres | sqlite
cloud-public: true
lint:
permissions:
contents: read
id-token: write
pull-requests: write
services:
# Spin up a mysql:8.0.29 container to be used as the dev-database for analysis.
mysql:
image: mysql:8.0.29
env:
MYSQL_ROOT_PASSWORD: pass
MYSQL_DATABASE: dev
ports:
- "3306:3306"
options: >-
--health-cmd "mysqladmin ping -ppass"
--health-interval 10s
--health-start-period 10s
--health-timeout 5s
--health-retries 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Mandatory unless "latest" is set below.
- uses: ariga/atlas-action@v0
with:
dir: 'examples/migration/ent/migrate/migrations'
dev-url: mysql://root:pass@localhost:3306/dev
cloud-public: true
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Atlas CI Public on: # Run whenever code is changed in the master branch, # change this to your root branch. push: branches: - master paths: - 'examples/migration/ent/migrate/migrations/*' pull_request: paths: - 'examples/migration/ent/migrate/migrations/*' concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: sync: timeout-minutes: 30 permissions: contents: read id-token: write needs: lint if: github.ref == 'refs/heads/master' runs-on: latchkey-small steps: - uses: actions/checkout@v4 - uses: ariga/atlas-sync-action@v0 with: dir: 'examples/migration/ent/migrate/migrations' driver: mysql # or: postgres | sqlite cloud-public: true lint: timeout-minutes: 30 permissions: contents: read id-token: write pull-requests: write services: # Spin up a mysql:8.0.29 container to be used as the dev-database for analysis. mysql: image: mysql:8.0.29 env: MYSQL_ROOT_PASSWORD: pass MYSQL_DATABASE: dev ports: - "3306:3306" options: >- --health-cmd "mysqladmin ping -ppass" --health-interval 10s --health-start-period 10s --health-timeout 5s --health-retries 10 runs-on: latchkey-small steps: - uses: actions/checkout@v4 with: fetch-depth: 0 # Mandatory unless "latest" is set below. - uses: ariga/atlas-action@v0 with: dir: 'examples/migration/ent/migrate/migrations' dev-url: mysql://root:pass@localhost:3306/dev cloud-public: true
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.
2 third-party actions are referenced by a movable tag. Pin them 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.