Skip to content
Latchkey

CI workflow (ory/oathkeeper)

The CI workflow from ory/oathkeeper, explained and optimized by Latchkey.

B

CI health: B - good

Point runs-on at Latchkey and get job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: ory/oathkeeper.github/workflows/ci.ymlLicense Apache-2.0View source

What it does

This is the CI workflow from the ory/oathkeeper 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

workflow (.yml)
name: CI
on:
  push:
    branches:
      - master
    tags:
      - "*"
  pull_request:

# Cancel in-progress runs in current workflow.
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

env:
  CGO_ENABLED: "0"

jobs:
  validate:
    name: Run tests and lints
    runs-on: ubuntu-latest
    steps:
      - uses: ory/ci/checkout@master
      - uses: actions/setup-go@v6
        with:
          check-latest: true
          go-version-file: go.mod
      - run: go list -json > go.list
      - name: Run nancy
        uses: sonatype-nexus-community/nancy-github-action@v1.0.3
      - name: Run golangci-lint
        if: ${{ github.ref_type != 'tag' }}
        uses: golangci/golangci-lint-action@v9
        env:
          GOGC: 100
        with:
          args: --timeout 10m0s
          version: latest
          only-new-issues: "true"
      - name: Run go tests
        run: |
          go test -coverprofile coverage.out ./... -- -failfast -timeout=20m
      - name: Submit to Codecov
        run: |
          bash <(curl -s https://codecov.io/bash)

  test:
    runs-on: ubuntu-latest
    name: Run tests
    strategy:
      matrix:
        name: ["reload", "e2e", "forwarded-header", "bearer-token"]
    steps:
      - uses: ory/ci/checkout@master
      - uses: actions/setup-go@v6
        with:
          check-latest: true
          go-version-file: go.mod
      - run: |
          ./test/${{ matrix.name }}/run.sh

  docs-cli:
    runs-on: ubuntu-latest
    name: Build CLI docs
    needs:
      - test
    steps:
      - uses: ory/ci/checkout@master
      - uses: ory/ci/docs/cli-next@master
        with:
          token: ${{ secrets.ORY_BOT_PAT }}
          output-dir: docs/oathkeeper/cli
      - uses: actions/setup-go@v6
        with:
          check-latest: true
          go-version-file: go.mod

  release:
    name: Generate release
    runs-on: ubuntu-latest
    if: ${{ github.ref_type == 'tag' }}
    needs:
      - test
      - validate
    steps:
      - uses: ory/ci/releaser@master
        with:
          token: ${{ secrets.ORY_BOT_PAT }}
          goreleaser_key: ${{ secrets.GORELEASER_KEY }}
          cosign_pwd: ${{ secrets.COSIGN_PWD }}
          docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
          docker_password: ${{ secrets.DOCKERHUB_PASSWORD }}

  newsletter-draft:
    name: Draft newsletter
    runs-on: ubuntu-latest
    if: ${{ github.ref_type == 'tag' }}
    needs:
      - release
    steps:
      - uses: ory/ci/newsletter@master
        with:
          mailchimp_list_id: f605a41b53
          mailchmip_segment_id: 6479485
          mailchimp_api_key: ${{ secrets.MAILCHIMP_API_KEY }}
          draft: "true"
          ssh_key: ${{ secrets.ORY_BOT_SSH_KEY }}

  slack-approval-notification:
    name: Pending approval Slack notification
    runs-on: ubuntu-latest
    if: ${{ github.ref_type == 'tag' }}
    needs:
      - newsletter-draft
    steps:
      - uses: ory/ci/newsletter/slack-notify@master
        with:
          slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}

  newsletter-send:
    name: Send newsletter
    runs-on: ubuntu-latest
    needs:
      - newsletter-draft
    if: ${{ github.ref_type == 'tag' }}
    environment: production
    steps:
      - uses: ory/ci/newsletter@master
        with:
          mailchimp_list_id: f605a41b53
          mailchmip_segment_id: 6479485
          mailchimp_api_key: ${{ secrets.MAILCHIMP_API_KEY }}
          draft: "false"
          ssh_key: ${{ secrets.ORY_BOT_SSH_KEY }}

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: CI
on:
  push:
    branches:
      - master
    tags:
      - "*"
  pull_request:
 
# Cancel in-progress runs in current workflow.
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
env:
  CGO_ENABLED: "0"
 
jobs:
  validate:
    timeout-minutes: 30
    name: Run tests and lints
    runs-on: latchkey-small
    steps:
      - uses: ory/ci/checkout@master
      - uses: actions/setup-go@v6
        with:
          check-latest: true
          go-version-file: go.mod
      - run: go list -json > go.list
      - name: Run nancy
        uses: sonatype-nexus-community/nancy-github-action@v1.0.3
      - name: Run golangci-lint
        if: ${{ github.ref_type != 'tag' }}
        uses: golangci/golangci-lint-action@v9
        env:
          GOGC: 100
        with:
          args: --timeout 10m0s
          version: latest
          only-new-issues: "true"
      - name: Run go tests
        run: |
          go test -coverprofile coverage.out ./... -- -failfast -timeout=20m
      - name: Submit to Codecov
        run: |
          bash <(curl -s https://codecov.io/bash)
 
  test:
    timeout-minutes: 30
    runs-on: latchkey-small
    name: Run tests
    strategy:
      matrix:
        name: ["reload", "e2e", "forwarded-header", "bearer-token"]
    steps:
      - uses: ory/ci/checkout@master
      - uses: actions/setup-go@v6
        with:
          check-latest: true
          go-version-file: go.mod
      - run: |
          ./test/${{ matrix.name }}/run.sh
 
  docs-cli:
    timeout-minutes: 30
    runs-on: latchkey-small
    name: Build CLI docs
    needs:
      - test
    steps:
      - uses: ory/ci/checkout@master
      - uses: ory/ci/docs/cli-next@master
        with:
          token: ${{ secrets.ORY_BOT_PAT }}
          output-dir: docs/oathkeeper/cli
      - uses: actions/setup-go@v6
        with:
          check-latest: true
          go-version-file: go.mod
 
  release:
    timeout-minutes: 30
    name: Generate release
    runs-on: latchkey-small
    if: ${{ github.ref_type == 'tag' }}
    needs:
      - test
      - validate
    steps:
      - uses: ory/ci/releaser@master
        with:
          token: ${{ secrets.ORY_BOT_PAT }}
          goreleaser_key: ${{ secrets.GORELEASER_KEY }}
          cosign_pwd: ${{ secrets.COSIGN_PWD }}
          docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
          docker_password: ${{ secrets.DOCKERHUB_PASSWORD }}
 
  newsletter-draft:
    timeout-minutes: 30
    name: Draft newsletter
    runs-on: latchkey-small
    if: ${{ github.ref_type == 'tag' }}
    needs:
      - release
    steps:
      - uses: ory/ci/newsletter@master
        with:
          mailchimp_list_id: f605a41b53
          mailchmip_segment_id: 6479485
          mailchimp_api_key: ${{ secrets.MAILCHIMP_API_KEY }}
          draft: "true"
          ssh_key: ${{ secrets.ORY_BOT_SSH_KEY }}
 
  slack-approval-notification:
    timeout-minutes: 30
    name: Pending approval Slack notification
    runs-on: latchkey-small
    if: ${{ github.ref_type == 'tag' }}
    needs:
      - newsletter-draft
    steps:
      - uses: ory/ci/newsletter/slack-notify@master
        with:
          slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
 
  newsletter-send:
    timeout-minutes: 30
    name: Send newsletter
    runs-on: latchkey-small
    needs:
      - newsletter-draft
    if: ${{ github.ref_type == 'tag' }}
    environment: production
    steps:
      - uses: ory/ci/newsletter@master
        with:
          mailchimp_list_id: f605a41b53
          mailchmip_segment_id: 6479485
          mailchimp_api_key: ${{ secrets.MAILCHIMP_API_KEY }}
          draft: "false"
          ssh_key: ${{ secrets.ORY_BOT_SSH_KEY }}
 

What changed

3 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.

What Latchkey heals here

This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:

This workflow runs 7 jobs (10 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow