Manual validate all workflow (zefhub/zef)
The Manual validate all workflow from zefhub/zef, 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 Manual validate all workflow from the zefhub/zef 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: Manual validate all
on:
workflow_dispatch:
inputs:
linuxBuild:
description: 'Linux build'
required: true
default: true
type: boolean
macosBuild:
description: 'MacOS build'
required: true
default: true
type: boolean
windowsBuild:
description: 'Windows build'
required: true
default: true
type: boolean
targetEnvironment:
required: true
type: environment
env:
ZEFHUB_AUTH_KEY: GUEST
jobs:
check-license:
uses: ./.github/workflows/check-license.yml
linux-build:
if: inputs.linuxBuild == true
needs: check-license
runs-on: ${{ matrix.os }}
environment: ${{ inputs.targetEnvironment }}
strategy:
matrix:
os: [ubuntu-20.04]
python-version: [3.7, "3.10"]
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build
uses: ./.github/actions/build
# Windows takes forever to build so this needs to be >20min
timeout-minutes: 30
with:
python-version: ${{ matrix.python-version }}
os: ${{ matrix.os }}
test-auth-key: ${{ secrets.TEST_AUTH_KEY }}
macos-build:
if: inputs.macosBuild == true
needs: check-license
runs-on: ${{ matrix.os }}
environment: ${{ inputs.targetEnvironment }}
strategy:
matrix:
os: [macos-latest]
python-version: ["3.10"]
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build
uses: ./.github/actions/build
# Windows takes forever to build so this needs to be >20min
timeout-minutes: 30
with:
python-version: ${{ matrix.python-version }}
os: ${{ matrix.os }}
test-auth-key: ${{ secrets.TEST_AUTH_KEY }}
windows-build:
if: inputs.windowsBuild == true
needs: check-license
runs-on: ${{ matrix.os }}
environment: ${{ inputs.targetEnvironment }}
strategy:
matrix:
os: [windows-latest]
python-version: [3.7, "3.10"]
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build
uses: ./.github/actions/build
# Windows takes forever to build so this needs to be >20min
timeout-minutes: 30
with:
python-version: ${{ matrix.python-version }}
os: ${{ matrix.os }}
test-auth-key: ${{ secrets.TEST_AUTH_KEY }}The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Manual validate all on: workflow_dispatch: inputs: linuxBuild: description: 'Linux build' required: true default: true type: boolean macosBuild: description: 'MacOS build' required: true default: true type: boolean windowsBuild: description: 'Windows build' required: true default: true type: boolean targetEnvironment: required: true type: environment env: ZEFHUB_AUTH_KEY: GUEST jobs: check-license: timeout-minutes: 30 uses: ./.github/workflows/check-license.yml linux-build: timeout-minutes: 30 if: inputs.linuxBuild == true needs: check-license runs-on: ${{ matrix.os }} environment: ${{ inputs.targetEnvironment }} strategy: matrix: os: [ubuntu-20.04] python-version: [3.7, "3.10"] steps: - uses: actions/checkout@v3 with: token: ${{ secrets.GITHUB_TOKEN }} - name: Build uses: ./.github/actions/build # Windows takes forever to build so this needs to be >20min timeout-minutes: 30 with: python-version: ${{ matrix.python-version }} os: ${{ matrix.os }} test-auth-key: ${{ secrets.TEST_AUTH_KEY }} macos-build: timeout-minutes: 30 if: inputs.macosBuild == true needs: check-license runs-on: ${{ matrix.os }} environment: ${{ inputs.targetEnvironment }} strategy: matrix: os: [macos-latest] python-version: ["3.10"] steps: - uses: actions/checkout@v3 with: token: ${{ secrets.GITHUB_TOKEN }} - name: Build uses: ./.github/actions/build # Windows takes forever to build so this needs to be >20min timeout-minutes: 30 with: python-version: ${{ matrix.python-version }} os: ${{ matrix.os }} test-auth-key: ${{ secrets.TEST_AUTH_KEY }} windows-build: timeout-minutes: 30 if: inputs.windowsBuild == true needs: check-license runs-on: ${{ matrix.os }} environment: ${{ inputs.targetEnvironment }} strategy: matrix: os: [windows-latest] python-version: [3.7, "3.10"] steps: - uses: actions/checkout@v3 with: token: ${{ secrets.GITHUB_TOKEN }} - name: Build uses: ./.github/actions/build # Windows takes forever to build so this needs to be >20min timeout-minutes: 30 with: python-version: ${{ matrix.python-version }} os: ${{ matrix.os }} test-auth-key: ${{ secrets.TEST_AUTH_KEY }}
What changed
- Add a job timeout so a hung step cannot burn hours of runner time.
This workflow runs 4 jobs (6 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.