mirror of
https://github.com/MoHadiShibli/Control4Free.git
synced 2026-10-24 17:01:24 +02:00
94 lines
4.4 KiB
YAML
94 lines
4.4 KiB
YAML
name: build
|
|
|
|
# Builds both toolchain images, the payload, the installable package and its
|
|
# diagnostic version, and runs every host test. On a vX.Y.Z tag it also
|
|
# publishes the release.
|
|
on:
|
|
push:
|
|
branches: [main, next]
|
|
tags: ['v*']
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write # the release step needs it; nothing else writes
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Build the toolchain images
|
|
run: |
|
|
docker build -t control4free-build -f docker/Dockerfile docker
|
|
docker build -t control4free-launcher-build -f docker/Dockerfile.launcher docker
|
|
|
|
- name: Build the payload, the package and the diagnostic package
|
|
run: |
|
|
docker run --rm --network none -v "$PWD:/src" -w /src \
|
|
control4free-launcher-build bash -lc 'make && make -C launcher && make C4F_DIAG=1 && make -C launcher C4F_DIAG=1'
|
|
|
|
- name: Host tests
|
|
run: |
|
|
docker run --rm --network none -v "$PWD:/src" -w /src \
|
|
control4free-launcher-build python3 -B tests/run.py
|
|
|
|
- name: Browser editor checks
|
|
run: |
|
|
docker run --rm -v "$PWD:/src" -w /src mcr.microsoft.com/playwright:v1.63.0-noble \
|
|
bash -lc 'mkdir -p /tmp/c4f-browser; cd /tmp/c4f-browser; npm init -y >/dev/null; npm install playwright@1.63.0; cd /src; NODE_PATH=/tmp/c4f-browser/node_modules node tests/browser_test.cjs'
|
|
|
|
- name: Emulated gamepad checks
|
|
run: |
|
|
docker run --rm -v "$PWD:/src" -w /src mcr.microsoft.com/playwright:v1.63.0-noble \
|
|
bash -lc 'mkdir -p /tmp/c4f-browser; cd /tmp/c4f-browser; npm init -y >/dev/null; npm install playwright@1.63.0; cd /src; NODE_PATH=/tmp/c4f-browser/node_modules node tests/fake_gamepads_test.cjs'
|
|
|
|
- name: Experimental feature checks
|
|
run: |
|
|
docker run --rm -v "$PWD:/src" -w /src mcr.microsoft.com/playwright:v1.63.0-noble \
|
|
bash -lc 'mkdir -p /tmp/c4f-browser; cd /tmp/c4f-browser; npm init -y >/dev/null; npm install playwright@1.63.0; cd /src; NODE_PATH=/tmp/c4f-browser/node_modules node tests/experimental_test.cjs'
|
|
|
|
- name: WebRTC browser and input recovery checks
|
|
run: |
|
|
docker run --rm -v "$PWD:/src" -w /src mcr.microsoft.com/playwright:v1.63.0-noble \
|
|
bash -lc 'mkdir -p /tmp/c4f-browser; cd /tmp/c4f-browser; npm init -y >/dev/null; npm install playwright@1.63.0; cd /src; NODE_PATH=/tmp/c4f-browser/node_modules node tests/rtc_e2e.cjs && NODE_PATH=/tmp/c4f-browser/node_modules node tests/rtc_input_e2e.cjs'
|
|
|
|
- name: Collect what was built
|
|
run: |
|
|
version=$(cat VERSION)
|
|
mkdir -p artifacts
|
|
cp build/control4free.elf "build/Control4Free-$version.pkg" artifacts/
|
|
# GitHub sorts assets by name. Keep the diagnostic download below the
|
|
# normal installer, payload and checksums, with its purpose in the name.
|
|
cp "build/Control4Free-$version-diag.pkg" "artifacts/troubleshooting-Control4Free-$version-diag.pkg"
|
|
cd artifacts && sha256sum * > SHA256SUMS && cat SHA256SUMS
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: control4free
|
|
path: artifacts/
|
|
if-no-files-found: error
|
|
|
|
- name: Check the tag matches VERSION
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
run: |
|
|
test "v$(cat VERSION)" = "${GITHUB_REF#refs/tags/}" \
|
|
|| { echo "tag ${GITHUB_REF#refs/tags/} does not match VERSION $(cat VERSION)"; exit 1; }
|
|
|
|
- name: Publish the release
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
# The release notes are this version's section of the changelog.
|
|
version=$(cat VERSION)
|
|
python3 tools/release_notes.py CHANGELOG.md "$version" "$GITHUB_REPOSITORY" > notes.md
|
|
test -s notes.md || { echo "CHANGELOG.md has no section for $version"; exit 1; }
|
|
gh release create "${GITHUB_REF#refs/tags/}" \
|
|
"artifacts/Control4Free-$version.pkg#Normal package (recommended)" \
|
|
'artifacts/control4free.elf#Payload for manual loading' \
|
|
'artifacts/SHA256SUMS#Download checksums' \
|
|
"artifacts/troubleshooting-Control4Free-$version-diag.pkg#Troubleshooting only - diagnostic package" \
|
|
--verify-tag --title "Control4Free $version" --notes-file notes.md
|