ci-experimental workflow (terramate-io/terramate)
The ci-experimental workflow from terramate-io/terramate, explained and optimized by Latchkey.
A
CI health: A - excellent
Run this on Latchkey for self-healing, caching, and up to 58% lower cost.
Grade your own workflow free or run it on Latchkey →What it does
This is the ci-experimental workflow from the terramate-io/terramate repository, a real project running GitHub Actions. It is shown here with attribution under its MPL-2.0 license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
workflow (.yml)
# Copyright 2023 Terramate GmbH
# SPDX-License-Identifier: MPL-2.0
name: ci-experimental
on:
pull_request:
jobs:
build_test:
name: Build and Test
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
matrix:
os: [ "windows-2022" ]
steps:
- name: configure git
run: git config --global core.autocrlf input
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # pin@v5
with:
go-version-file: 'go.mod'
check-latest: true
- uses: opentofu/setup-opentofu@592200bd4b9bbf4772ace78f887668b1aee8f716 # pin@v1.0.5
with:
tofu_version: 1.6.2
tofu_wrapper: false
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: make build
run: make build
- name: make generate
run: make generate && git diff
- name: make test
run: make test
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
# Copyright 2023 Terramate GmbH # SPDX-License-Identifier: MPL-2.0 name: ci-experimental on: pull_request: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: build_test: name: Build and Test runs-on: ${{ matrix.os }} timeout-minutes: 30 strategy: matrix: os: [ "windows-2022" ] steps: - name: configure git run: git config --global core.autocrlf input - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4 - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # pin@v5 with: go-version-file: 'go.mod' check-latest: true - uses: opentofu/setup-opentofu@592200bd4b9bbf4772ace78f887668b1aee8f716 # pin@v1.0.5 with: tofu_version: 1.6.2 tofu_wrapper: false github_token: ${{ secrets.GITHUB_TOKEN }} - name: make build run: make build - name: make generate run: make generate && git diff - name: make test run: make test
What changed
- Cancel superseded runs when a branch or PR gets a newer push.
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.