CI #2007
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
pull_request: | |
merge_group: | |
name: CI | |
jobs: | |
test-software: | |
strategy: | |
matrix: | |
os-version: | |
- ubuntu-20.04 | |
python-version: | |
- '3.9.5' # shipped with 20.04 LTS | |
- '3.9.x' # latest in the 3.9.x branch | |
- '3.10.x' | |
- '3.11.x' | |
- '3.12.x' | |
- 'pypy-3.9' | |
- 'pypy-3.10' | |
dep-versions: | |
- minimal | |
- latest | |
allow-failure: | |
- false | |
include: | |
- os-version: ubuntu-20.04 | |
python-version: '3.13-dev' | |
dep-versions: minimal | |
allow-failure: true | |
- os-version: ubuntu-20.04 | |
python-version: '3.13-dev' | |
dep-versions: latest | |
allow-failure: true | |
continue-on-error: ${{ matrix.allow-failure }} | |
runs-on: ${{ matrix.os-version }} | |
name: 'test-software (${{ matrix.python-version }}, deps: ${{ matrix.dep-versions }})' | |
env: | |
PDM_LOCKFILE: ${{ matrix.dep-versions == 'minimal' && 'pdm.min.lock' || 'pdm.lock' }} | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache Glasgow build products | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/GlasgowEmbedded | |
key: Glasgow-${{ matrix.python-version }}-${{ matrix.dep-versions }}-${{ hashFiles('./software/**') }} | |
restore-keys: | | |
Glasgow-${{ matrix.python-version }}-${{ matrix.dep-versions }}- | |
Glasgow-${{ matrix.python-version }}- | |
Glasgow- | |
- name: Set up PDM | |
uses: pdm-project/setup-pdm@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Generate lockfile | |
working-directory: ./software | |
run: pdm lock --group :all ${{ matrix.dep-versions == 'minimal' && '--strategy direct_minimal_versions' || '' }} | |
- name: Verify lockfile matches checked-in version | |
if: matrix.dep-versions == 'minimal' | |
working-directory: ./software | |
run: git diff --exit-code pdm.min.lock | |
- name: Install dependencies | |
working-directory: ./software | |
run: pdm sync | |
- name: Cache YoWASP build products | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/YoWASP | |
key: YoWASP-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.dep-versions }}-${{ hashFiles('./software/.venv/**/*.wasm') }} | |
restore-keys: | | |
YoWASP-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.dep-versions }}- | |
YoWASP-${{ runner.os }}-${{ matrix.python-version }}- | |
YoWASP-${{ runner.os }}- | |
- name: Run tests | |
working-directory: ./software | |
run: | | |
pdm run glasgow --help | |
pdm run glasgow build --rev C3 uart | |
pdm run test | |
build-firmware: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Build and deploy firmware | |
working-directory: ./software | |
run: | | |
./deploy-firmware.sh | |
- name: Check if the checked-in firmware is modified | |
id: is_modified | |
uses: tj-actions/changed-files@v44 | |
with: | |
files: | | |
software/glasgow/device/firmware.ihex | |
- name: Verify firmware matches checked-in version | |
if: steps.is_modified.outputs.any_changed == 'true' | |
run: git diff --exit-code --text software/glasgow/device/firmware.ihex | |
build-manual: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: docs/manual | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up PDM | |
uses: pdm-project/setup-pdm@v4 | |
- name: Install dependencies | |
run: pdm install | |
- name: Check for dead links | |
run: pdm run check | |
- name: Build documentation | |
env: | |
DOCS_IS_PRODUCTION: ${{ (github.repository == 'GlasgowEmbedded/glasgow' && github.event.ref == 'refs/heads/main') && 'yes' || 'no' }} | |
run: pdm run build | |
- name: Upload documentation archive | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docs | |
path: docs/manual/build | |
required: # group all required workflows into one to avoid reconfiguring this in Actions settings | |
needs: | |
- test-software | |
- build-firmware | |
- build-manual | |
if: ${{ always() && !contains(needs.*.result, 'cancelled') }} | |
runs-on: ubuntu-latest | |
steps: | |
- run: ${{ contains(needs.*.result, 'failure') && 'false' || 'true' }} | |
publish-manual: | |
needs: build-manual | |
if: ${{ (github.repository == 'GlasgowEmbedded/glasgow' && github.event.ref == 'refs/heads/main') || github.repository != 'GlasgowEmbedded/glasgow' }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
- if: ${{ github.repository == 'GlasgowEmbedded/glasgow' && github.event.ref == 'refs/heads/main' }} | |
name: Inject documentation from artifact under latest/ | |
uses: actions/download-artifact@v4 | |
with: | |
name: docs | |
path: pages/latest/ | |
- if: ${{ github.repository == 'GlasgowEmbedded/glasgow' && github.event.ref == 'refs/heads/main' }} | |
name: Add CNAME and redirect from the root to latest/ | |
run: | | |
echo >pages/CNAME 'glasgow-embedded.org' | |
cat >pages/index.html <<END | |
<!DOCTYPE html> | |
<html lang="en-US"> | |
<meta charset="utf-8"> | |
<title>Redirecting…</title> | |
<link rel="canonical" href="latest/intro.html"> | |
<script>location="latest/intro.html"</script> | |
<meta http-equiv="refresh" content="0; url=latest/intro.html"> | |
<meta content="Glasgow Interface Explorer" name="og:title" /> | |
<meta content="website" name="og:type" /> | |
<meta content="https://glasgow-embedded.org/" name="og:url" /> | |
<meta content="A highly capable and extremely flexible open source multitool for digital electronics" name="og:description" /> | |
<meta content="https://www.crowdsupply.com/img/f9a9/glasgow-revc2_jpg_open-graph.jpg" name="og:image" /> | |
<meta content="A Glasgow Interface Explorer PCB, without a case" name="og:image:alt" /> | |
<meta content="Glasgow Interface Explorer" name="twitter:title" /> | |
<meta content="summary_large_image" name="twitter:card" /> | |
<meta content="A highly capable and extremely flexible open source multitool for digital electronics" name="twitter:description" /> | |
<meta content="https://www.crowdsupply.com/img/f9a9/glasgow-revc2_jpg_project-main.jpg" name="twitter:image" /> | |
<meta content="A Glasgow Interface Explorer PCB, without a case" name="twitter:image:alt" /> | |
<h1>Redirecting…</h1> | |
<a href="latest/intro.html">Click here if you are not redirected.</a> | |
</html> | |
END | |
- if: ${{ github.repository != 'GlasgowEmbedded/glasgow' }} | |
name: Inject documentation from artifact under {branch}/ | |
uses: actions/download-artifact@v4 | |
with: | |
name: docs | |
path: pages/${{ github.ref_name }}/ | |
- name: Disable Jekyll | |
run: touch pages/.nojekyll | |
- name: Publish documentation for a branch | |
uses: JamesIves/github-pages-deploy-action@releases/v4 | |
with: | |
folder: pages/ | |
clean: ${{ github.repository == 'GlasgowEmbedded/glasgow' && github.event.ref == 'refs/heads/main' }} | |
single-commit: true |