Skip to content

CI

CI #548

Workflow file for this run

on:
push:
pull_request:
merge_group:
name: CI
jobs:
test-software:
if: ${{ !(github.event_name == 'push' && github.repository == 'GlasgowEmbedded/glasgow' && github.event.ref != 'refs/heads/main') }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- '3.9'
- '3.10'
- '3.11'
- 'pypy-3.9'
- 'pypy-3.10'
allow-failure:
- false
include:
- python-version: '3.12-dev'
allow-failure: true
continue-on-error: '${{ matrix.allow-failure }}'
name: 'test-software (${{ matrix.python-version }})'
steps:
- name: Preserve caches
uses: actions/cache@v3
with:
path: |
~/.cache/wasmtime
~/.cache/YoWASP
~/.cache/GlasgowEmbedded
key: ${{ runner.os }}
- name: Check out source code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check for changed files
id: changed-files
uses: tj-actions/changed-files@v39
with:
files: software/**
- if: github.event_name == 'merge_group' || steps.changed-files.outputs.any_modified == 'true'
name: Set up PDM
uses: pdm-project/setup-pdm@v3
with:
python-version: ${{ matrix.python-version }}
- if: github.event_name == 'merge_group' || steps.changed-files.outputs.any_modified == 'true'
name: Install dependencies
working-directory: ./software
run: pdm install -G :all
- if: github.event_name == 'merge_group' || steps.changed-files.outputs.any_modified == 'true'
name: Run tests
working-directory: ./software
run: |
pdm run glasgow --help
pdm run glasgow build --rev C3 uart
pdm run test
build-firmware:
if: ${{ !(github.event_name == 'push' && github.repository == 'GlasgowEmbedded/glasgow' && github.event.ref != 'refs/heads/main') }}
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install sdcc
- name: Build libfx2
working-directory: ./vendor/libfx2/firmware
run: make
- name: Build firmware
working-directory: ./firmware
run: make
build-manual:
if: ${{ !(github.event_name == 'push' && github.repository == 'GlasgowEmbedded/glasgow' && github.event.ref != 'refs/heads/main') }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: docs/manual
steps:
- name: Check out source code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up PDM
uses: pdm-project/setup-pdm@v3
- name: Install dependencies
run: |
pdm install
- 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@v3
with:
name: docs
path: docs/manual/out
required: # group all required workflows into one to avoid reconfiguring this in Actions settings
needs:
- test-software
- build-firmware
- build-manual
runs-on: ubuntu-latest
steps:
- run: |
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@v3
- if: github.repository == 'GlasgowEmbedded/glasgow' && github.event.ref == 'refs/heads/main'
name: Inject documentation from artifact under latest/
uses: actions/download-artifact@v3
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&hellip;</title>
<link rel="canonical" href="latest/">
<script>location="latest/"</script>
<meta http-equiv="refresh" content="0; url=latest/">
<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&hellip;</h1>
<a href="latest/">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@v3
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