SCons Build workflow (SCons/scons)
The SCons Build workflow from SCons/scons, explained and optimized by Latchkey.
CI health: C - fair
Point runs-on at Latchkey and get run de-duplication, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the SCons Build workflow from the SCons/scons repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
# This action builds SCons, mainly to make sure the docs generate.
name: SCons Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
package:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.14
uses: actions/setup-python@v5
with:
python-version: '3.14'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --progress-bar off --upgrade pip setuptools wheel
#python -m pip install flake8 pytest
if [ -f requirements-pkg.txt ]; then pip install --progress-bar off -r requirements-pkg.txt; elif [ -f requirements.txt ]; then pip install --progress-bar off -r requirements.txt; fi
sudo apt-get update
sudo apt-get -y install docbook-xml docbook-xsl xsltproc fop docbook-xsl-doc-pdf
# try to keep the texlive install as small as we can to save some time/space
sudo apt-get -y --no-install-recommends install texlive biber texmaker ghostscript texlive-latex-base texlive-latex-extra texlive-bibtex-extra texlive-font-utils latexmk
# This is disabled until the run can be configured to only
# check the code that matters, else we fail on non-essentials
# like the bench/ stuff.
#- name: Lint with flake8
# run: |
# # stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Update Doc sources (some parts are generated)
run: |
python bin/docs-update-generated.py
python bin/docs-validate.py
python bin/docs-create-example-outputs.py
- name: Build SCons packages
run: |
python scripts/scons.py
- name: Verify package
run: |
ls -l build/dist
python build/scons-local/scons.py --version
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
# This action builds SCons, mainly to make sure the docs generate. name: SCons Build on: push: branches: [ master ] pull_request: branches: [ master ] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: package: timeout-minutes: 30 runs-on: latchkey-small steps: - uses: actions/checkout@v4 - name: Set up Python 3.14 uses: actions/setup-python@v5 with: python-version: '3.14' cache: 'pip' - name: Install dependencies run: | python -m pip install --progress-bar off --upgrade pip setuptools wheel #python -m pip install flake8 pytest if [ -f requirements-pkg.txt ]; then pip install --progress-bar off -r requirements-pkg.txt; elif [ -f requirements.txt ]; then pip install --progress-bar off -r requirements.txt; fi sudo apt-get update sudo apt-get -y install docbook-xml docbook-xsl xsltproc fop docbook-xsl-doc-pdf # try to keep the texlive install as small as we can to save some time/space sudo apt-get -y --no-install-recommends install texlive biber texmaker ghostscript texlive-latex-base texlive-latex-extra texlive-bibtex-extra texlive-font-utils latexmk # This is disabled until the run can be configured to only # check the code that matters, else we fail on non-essentials # like the bench/ stuff. #- name: Lint with flake8 # run: | # # stop the build if there are Python syntax errors or undefined names # flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide # flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Update Doc sources (some parts are generated) run: | python bin/docs-update-generated.py python bin/docs-validate.py python bin/docs-create-example-outputs.py - name: Build SCons packages run: | python scripts/scons.py - name: Verify package run: | ls -l build/dist python build/scons-local/scons.py --version
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.
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:
- Dependency installs
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.