Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 3 additions & 113 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Every push and PR: the host lane tests the workspace on Linux; the console lane builds the
# toolchain image, the probe NRO and the title's (punktfunk.nro), which every run uploads.
# Every push and PR: the host lane tests the workspace on Linux; the console lane
# (console.yml) builds the probe NRO and the title's (punktfunk.nro), which every run uploads.
name: ci

on:
Expand All @@ -26,114 +26,4 @@ jobs:
run: cargo test --workspace

console:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
# The runner's preinstalled SDKs the console build never uses: about 25 GB back.
- name: Disk space
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /usr/local/.ghcup /opt/hostedtoolcache/CodeQL
df -h /
# The image's layers live in the Actions cache: devkitPro's servers are hit only when a pin
# or the Dockerfile changes, not on every run (they answered 403 to repeated runs).
- name: Pins
id: pins
run: grep -E '^[A-Z0-9_]+=' scripts/pins.env >> "$GITHUB_OUTPUT"
- uses: docker/setup-buildx-action@v3
- name: Toolchain image
uses: docker/build-push-action@v6
with:
context: docker
load: true
tags: ${{ steps.pins.outputs.NX_IMAGE }}
build-args: |
DEVKITA64=${{ steps.pins.outputs.DEVKITA64 }}
LIBNX=${{ steps.pins.outputs.LIBNX }}
SWITCH_TOOLS=${{ steps.pins.outputs.SWITCH_TOOLS }}
RUST_NIGHTLY=${{ steps.pins.outputs.RUST_NIGHTLY }}
cache-from: type=gha,scope=nx-toolchain
cache-to: type=gha,scope=nx-toolchain,mode=max
# NVK (libvulkan_bh.a) for check 4: built once per pin, then kept in the Actions cache and
# loaded into the toolchain volume where pf-nx-sys links it.
# Saved right after the build, not at the job's end, so a later failing step keeps it.
- name: NVK cache
id: nvk
uses: actions/cache/restore@v4
with:
path: ${{ runner.temp }}/nvk-archive
key: nvk-${{ hashFiles('scripts/build-nvk.sh', 'scripts/pins.env') }}
- name: NVK
if: steps.nvk.outputs.cache-hit != 'true'
run: |
JOBS=$(nproc) PF_NX_NVK_WORK="$RUNNER_TEMP/nvk" scripts/build-nvk.sh
mkdir -p "$RUNNER_TEMP/nvk-archive"
docker run --rm -v pf-nx-toolchains:/opt/pf-nx alpine:3 tar -cf - -C /opt/pf-nx/nvk . |
tar -xf - -C "$RUNNER_TEMP/nvk-archive"
# Mesa's tree and the two NVK images fill the runner's disk before the probe's build.
sudo rm -rf "$RUNNER_TEMP/nvk"
docker image rm -f bevy-horizon-nvk:local bevy-horizon-toolchain:local
docker builder prune -af
df -h /
- name: NVK cache save
if: steps.nvk.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{ runner.temp }}/nvk-archive
key: ${{ steps.nvk.outputs.cache-primary-key }}
- name: NVK into the volume
if: steps.nvk.outputs.cache-hit == 'true'
run: |
tar -cf - -C "$RUNNER_TEMP/nvk-archive" . | docker run --rm -i -v pf-nx-toolchains:/opt/pf-nx alpine:3 sh -c \
'rm -rf /opt/pf-nx/nvk && mkdir -p /opt/pf-nx/nvk && tar -xf - -C /opt/pf-nx/nvk'
# Skia's Vulkan archive for the title, the same way: built once per skia-bindings version
# and per change to how it is built, then kept in the Actions cache.
- name: Skia key
id: skia-key
run: echo "version=$(grep -A1 '^name = "skia-bindings"$' Cargo.lock | sed -n 's/^version = "\(.*\)"/\1/p')" >> "$GITHUB_OUTPUT"
- name: Skia cache
id: skia
uses: actions/cache/restore@v4
with:
path: ${{ runner.temp }}/skia-archive
key: skia-vulkan-${{ steps.skia-key.outputs.version }}-${{ hashFiles('scripts/build-skia.sh', 'toolchain/skia/**', 'scripts/pins.env') }}
- name: Skia
if: steps.skia.outputs.cache-hit != 'true'
run: |
scripts/docker.sh scripts/build-skia.sh vulkan
mkdir -p "$RUNNER_TEMP/skia-archive"
docker run --rm -v pf-nx-toolchains:/opt/pf-nx alpine:3 tar -cf - -C /opt/pf-nx/skia . |
tar -xf - -C "$RUNNER_TEMP/skia-archive"
# Skia's tree and objects, which the title's build has no use for.
docker run --rm -v pf-nx-target:/t alpine:3 rm -rf /t/skia
df -h /
- name: Skia cache save
if: steps.skia.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{ runner.temp }}/skia-archive
key: ${{ steps.skia.outputs.cache-primary-key }}
- name: Skia into the volume
if: steps.skia.outputs.cache-hit == 'true'
run: |
tar -cf - -C "$RUNNER_TEMP/skia-archive" . | docker run --rm -i -v pf-nx-toolchains:/opt/pf-nx alpine:3 sh -c \
'rm -rf /opt/pf-nx/skia && mkdir -p /opt/pf-nx/skia && tar -xf - -C /opt/pf-nx/skia'
- name: Probe
run: scripts/docker.sh bash -c 'scripts/cargo-nx.sh build -p pf-nx-probe --features vulkan,nvdec && scripts/package-nro.sh pf-nx-probe'
- name: Title
run: scripts/docker.sh bash -c 'scripts/cargo-nx.sh build -p pf-nx && scripts/package-nro.sh pf-nx punktfunk'
# Check 6 reads these from the SD card next to the NRO.
- name: NVDEC streams
run: sudo apt-get update && sudo apt-get install -y ffmpeg && scripts/nvdec-streams.sh
- uses: actions/upload-artifact@v4
with:
name: pf-nx-probe
path: |
dist/pf-nx-probe.nro
dist/pf-nx-probe.elf
dist/nvdec-*
- uses: actions/upload-artifact@v4
with:
name: punktfunk
path: |
dist/punktfunk.nro
dist/punktfunk.elf
uses: ./.github/workflows/console.yml
142 changes: 142 additions & 0 deletions .github/workflows/console.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# The console lane: the toolchain image, NVK and Skia (each cached per pin), the probe NRO and the
# title's (punktfunk.nro), uploaded as artifacts. ci.yml runs it on every push and PR, release.yml
# on a version tag with the tag's version.
name: console

on:
workflow_call:
inputs:
version:
description: PKG_VERSION for the title; empty derives it from git (scripts/docker.sh)
type: string
default: ''
ref:
description: the commit to build; empty builds the PR's head or the pushed commit
type: string
default: ''

env:
CMAKE_POLICY_VERSION_MINIMUM: '3.5'

jobs:
console:
runs-on: ubuntu-24.04
steps:
# The branch's own commit, not the PR's merge commit, so the NRO's version names a commit
# that exists (scripts/docker.sh).
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.event.pull_request.head.sha || github.sha }}
# The runner's preinstalled SDKs the console build never uses: about 25 GB back.
- name: Disk space
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /usr/local/.ghcup /opt/hostedtoolcache/CodeQL
df -h /
# The image's layers live in the Actions cache: devkitPro's servers are hit only when a pin
# or the Dockerfile changes, not on every run (they answered 403 to repeated runs).
- name: Pins
id: pins
run: grep -E '^[A-Z0-9_]+=' scripts/pins.env >> "$GITHUB_OUTPUT"
- uses: docker/setup-buildx-action@v3
- name: Toolchain image
uses: docker/build-push-action@v6
with:
context: docker
load: true
tags: ${{ steps.pins.outputs.NX_IMAGE }}
build-args: |
DEVKITA64=${{ steps.pins.outputs.DEVKITA64 }}
LIBNX=${{ steps.pins.outputs.LIBNX }}
SWITCH_TOOLS=${{ steps.pins.outputs.SWITCH_TOOLS }}
SWITCH_FFMPEG=${{ steps.pins.outputs.SWITCH_FFMPEG }}
SWITCH_DAV1D=${{ steps.pins.outputs.SWITCH_DAV1D }}
RUST_NIGHTLY=${{ steps.pins.outputs.RUST_NIGHTLY }}
cache-from: type=gha,scope=nx-toolchain
cache-to: type=gha,scope=nx-toolchain,mode=max
# NVK (libvulkan_bh.a) for check 4: built once per pin, then kept in the Actions cache and
# loaded into the toolchain volume where pf-nx-sys links it.
# Saved right after the build, not at the job's end, so a later failing step keeps it.
- name: NVK cache
id: nvk
uses: actions/cache/restore@v4
with:
path: ${{ runner.temp }}/nvk-archive
key: nvk-${{ hashFiles('scripts/build-nvk.sh', 'scripts/pins.env') }}
- name: NVK
if: steps.nvk.outputs.cache-hit != 'true'
run: |
JOBS=$(nproc) PF_NX_NVK_WORK="$RUNNER_TEMP/nvk" scripts/build-nvk.sh
mkdir -p "$RUNNER_TEMP/nvk-archive"
docker run --rm -v pf-nx-toolchains:/opt/pf-nx alpine:3 tar -cf - -C /opt/pf-nx/nvk . |
tar -xf - -C "$RUNNER_TEMP/nvk-archive"
# Mesa's tree and the two NVK images fill the runner's disk before the probe's build.
sudo rm -rf "$RUNNER_TEMP/nvk"
docker image rm -f bevy-horizon-nvk:local bevy-horizon-toolchain:local
docker builder prune -af
df -h /
- name: NVK cache save
if: steps.nvk.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{ runner.temp }}/nvk-archive
key: ${{ steps.nvk.outputs.cache-primary-key }}
- name: NVK into the volume
if: steps.nvk.outputs.cache-hit == 'true'
run: |
tar -cf - -C "$RUNNER_TEMP/nvk-archive" . | docker run --rm -i -v pf-nx-toolchains:/opt/pf-nx alpine:3 sh -c \
'rm -rf /opt/pf-nx/nvk && mkdir -p /opt/pf-nx/nvk && tar -xf - -C /opt/pf-nx/nvk'
# Skia's Vulkan archive for the title, the same way: built once per skia-bindings version
# and per change to how it is built, then kept in the Actions cache.
- name: Skia key
id: skia-key
run: echo "version=$(grep -A1 '^name = "skia-bindings"$' Cargo.lock | sed -n 's/^version = "\(.*\)"/\1/p')" >> "$GITHUB_OUTPUT"
- name: Skia cache
id: skia
uses: actions/cache/restore@v4
with:
path: ${{ runner.temp }}/skia-archive
key: skia-vulkan-${{ steps.skia-key.outputs.version }}-${{ hashFiles('scripts/build-skia.sh', 'toolchain/skia/**', 'scripts/pins.env') }}
- name: Skia
if: steps.skia.outputs.cache-hit != 'true'
run: |
scripts/docker.sh scripts/build-skia.sh vulkan
mkdir -p "$RUNNER_TEMP/skia-archive"
docker run --rm -v pf-nx-toolchains:/opt/pf-nx alpine:3 tar -cf - -C /opt/pf-nx/skia . |
tar -xf - -C "$RUNNER_TEMP/skia-archive"
# Skia's tree and objects, which the title's build has no use for.
docker run --rm -v pf-nx-target:/t alpine:3 rm -rf /t/skia
df -h /
- name: Skia cache save
if: steps.skia.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{ runner.temp }}/skia-archive
key: ${{ steps.skia.outputs.cache-primary-key }}
- name: Skia into the volume
if: steps.skia.outputs.cache-hit == 'true'
run: |
tar -cf - -C "$RUNNER_TEMP/skia-archive" . | docker run --rm -i -v pf-nx-toolchains:/opt/pf-nx alpine:3 sh -c \
'rm -rf /opt/pf-nx/skia && mkdir -p /opt/pf-nx/skia && tar -xf - -C /opt/pf-nx/skia'
- name: Probe
run: scripts/docker.sh bash -c 'scripts/cargo-nx.sh build -p pf-nx-probe --features vulkan,nvdec && scripts/package-nro.sh pf-nx-probe'
- name: Title
env:
PKG_VERSION: ${{ inputs.version }}
run: scripts/docker.sh bash -c 'scripts/cargo-nx.sh build -p pf-nx && scripts/package-nro.sh pf-nx punktfunk'
# Check 6 reads these from the SD card next to the NRO.
- name: NVDEC streams
run: sudo apt-get update && sudo apt-get install -y ffmpeg && scripts/nvdec-streams.sh
- uses: actions/upload-artifact@v4
with:
name: pf-nx-probe
path: |
dist/pf-nx-probe.nro
dist/pf-nx-probe.elf
dist/nvdec-*
- uses: actions/upload-artifact@v4
with:
name: punktfunk
path: |
dist/punktfunk.nro
dist/punktfunk.elf
dist/THIRD-PARTY-NOTICES.txt
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# A version tag (v1.0.0) builds the title with the tag's version and publishes a GitHub release:
# punktfunk.nro, its SHA-256, the unstripped ELF (crash offsets resolve against it) and the
# notices. The NRO is GPL-3.0-or-later (plan D19), so the tag fails when the notices do not say so.
name: release

on:
push:
tags: ['v*']

permissions:
contents: read

jobs:
console:
uses: ./.github/workflows/console.yml
with:
version: ${{ github.ref_name }}
ref: ${{ github.sha }}

release:
needs: console
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: punktfunk
path: dist
- name: Version
run: |
version=${GITHUB_REF_NAME#v}
grep -a -q -F "$version" dist/punktfunk.nro || { echo "punktfunk.nro does not carry $version" >&2; exit 1; }
if grep -a -q -E "$version\+g[0-9a-f]{7}" dist/punktfunk.nro; then
echo "punktfunk.nro carries a commit's version, not the tag's" >&2; exit 1
fi
- name: Licence
run: |
grep -q 'The NRO as linked is GPL-3.0-or-later' dist/THIRD-PARTY-NOTICES.txt ||
{ echo "THIRD-PARTY-NOTICES.txt does not name the NRO's GPL (plan D19)" >&2; exit 1; }
- name: Checksum
run: cd dist && sha256sum punktfunk.nro > punktfunk.nro.sha256
- uses: softprops/action-gh-release@v2
with:
name: punktfunk ${{ github.ref_name }}
body_path: packaging/release-notes.md
files: |
dist/punktfunk.nro
dist/punktfunk.nro.sha256
dist/punktfunk.elf
dist/THIRD-PARTY-NOTICES.txt
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "pf-nx"
description = "Nintendo Switch homebrew client for punktfunk: the title binary."
version = "0.0.1"
version = "1.0.0"
edition.workspace = true
rust-version.workspace = true
license.workspace = true
Expand Down
Loading
Loading