154 lines
7.0 KiB
YAML
154 lines
7.0 KiB
YAML
name: ci
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
actions: write
|
|
|
|
env:
|
|
CONAN_HOME: build/build_common/conan_cache
|
|
MODULUS_DIRECT: "1"
|
|
|
|
jobs:
|
|
checks:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: docker/setup-qemu-action@v3
|
|
- uses: docker/setup-buildx-action@v3
|
|
- name: Install build dependencies
|
|
run: |
|
|
if [ -r /etc/os-release ]; then
|
|
. /etc/os-release
|
|
fi
|
|
if [ "${ID:-}" = "ubuntu" ] && [ -n "${VERSION_CODENAME:-}" ]; then
|
|
if [ -f /etc/apt/sources.list.d/ubuntu.sources ]; then
|
|
sed -i '/^Types: deb$/a Architectures: amd64' /etc/apt/sources.list.d/ubuntu.sources
|
|
printf '%s\n' \
|
|
'Types: deb' \
|
|
'URIs: http://ports.ubuntu.com/ubuntu-ports/' \
|
|
"Suites: ${VERSION_CODENAME} ${VERSION_CODENAME}-updates ${VERSION_CODENAME}-backports" \
|
|
'Components: main universe restricted multiverse' \
|
|
'Architectures: arm64' \
|
|
'Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg' \
|
|
'' \
|
|
'Types: deb' \
|
|
'URIs: http://ports.ubuntu.com/ubuntu-ports/' \
|
|
"Suites: ${VERSION_CODENAME}-security" \
|
|
'Components: main universe restricted multiverse' \
|
|
'Architectures: arm64' \
|
|
'Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg' \
|
|
> /etc/apt/sources.list.d/ubuntu-arm64.sources
|
|
elif [ -f /etc/apt/sources.list ]; then
|
|
sed -i 's|^deb http://archive.ubuntu.com/ubuntu|deb [arch=amd64] http://archive.ubuntu.com/ubuntu|' /etc/apt/sources.list
|
|
sed -i 's|^deb http://security.ubuntu.com/ubuntu|deb [arch=amd64] http://security.ubuntu.com/ubuntu|' /etc/apt/sources.list
|
|
printf '%s\n' \
|
|
"deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports ${VERSION_CODENAME} main universe restricted multiverse" \
|
|
"deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports ${VERSION_CODENAME}-updates main universe restricted multiverse" \
|
|
"deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports ${VERSION_CODENAME}-backports main universe restricted multiverse" \
|
|
"deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports ${VERSION_CODENAME}-security main universe restricted multiverse" \
|
|
> /etc/apt/sources.list.d/ubuntu-arm64.list
|
|
fi
|
|
fi
|
|
dpkg --add-architecture arm64
|
|
apt-get update
|
|
apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
ca-certificates \
|
|
cmake \
|
|
curl \
|
|
g++-12 \
|
|
g++-12-aarch64-linux-gnu \
|
|
gcc-12 \
|
|
gcc-12-aarch64-linux-gnu \
|
|
gcc-arm-none-eabi \
|
|
git \
|
|
libdrm-dev \
|
|
libdrm-dev:arm64 \
|
|
libegl-dev \
|
|
libegl-dev:arm64 \
|
|
libfribidi0 \
|
|
libgbm-dev \
|
|
libgbm-dev:arm64 \
|
|
libgles-dev \
|
|
libgles-dev:arm64 \
|
|
libglvnd-dev \
|
|
libglvnd-dev:arm64 \
|
|
libnewlib-arm-none-eabi \
|
|
libstdc++-arm-none-eabi-newlib \
|
|
ninja-build \
|
|
pkg-config \
|
|
python3 \
|
|
python3-venv
|
|
python3 -m venv build/build_common/ci_python
|
|
build/build_common/ci_python/bin/python -m pip install --no-cache-dir conan==2.26.2 -r generator/requirements.txt
|
|
echo "$PWD/build/build_common/ci_python/bin" >> "$GITHUB_PATH"
|
|
- name: Restore Conan cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: build/build_common/conan_cache
|
|
key: product-vamp-conan-${{ runner.os }}-${{ hashFiles('conanfile.py', 'modulus.json', 'conan/profiles/*') }}
|
|
restore-keys: product-vamp-conan-${{ runner.os }}-
|
|
- name: Configure native release
|
|
run: python3 modulus.py configure --target x86_64_gcc12_release --update
|
|
- name: Check package tooling
|
|
run: python3 -m unittest discover -s tests -p 'test_publish_package.py'
|
|
- name: Check code style
|
|
run: |
|
|
python3 -m pip install --no-cache-dir -r build/build_tools/docker/format-requirements.txt
|
|
python3 modulus.py format --check
|
|
- name: Identify engraving renderer
|
|
id: renderer
|
|
run: echo "fingerprint=$(python3 -m generator --renderer-fingerprint)" >> "$GITHUB_OUTPUT"
|
|
- name: Restore engraving cache
|
|
id: engraving-cache
|
|
uses: actions/cache/restore@v4
|
|
with:
|
|
path: build/build_common/engraving-cache/${{ steps.renderer.outputs.fingerprint }}
|
|
key: product-vamp-pages-${{ steps.renderer.outputs.fingerprint }}-${{ hashFiles('generator/**/*.py', 'generator/*.py', 'data/songs/*.xml', 'data/rhythms/**/*.xml', 'data/scales/**/*.xml') }}
|
|
restore-keys: product-vamp-pages-${{ steps.renderer.outputs.fingerprint }}-
|
|
- name: Build native release
|
|
run: python3 modulus.py build --target x86_64_gcc12_release
|
|
- name: Save engraving cache
|
|
if: steps.engraving-cache.outputs.cache-hit != 'true'
|
|
uses: actions/cache/save@v4
|
|
with:
|
|
path: build/build_common/engraving-cache/${{ steps.renderer.outputs.fingerprint }}
|
|
key: ${{ steps.engraving-cache.outputs.cache-primary-key }}
|
|
- name: Test native release
|
|
run: python3 modulus.py test --target x86_64_gcc12_release
|
|
- name: Test asset generation
|
|
run: python3 -m unittest discover -s tests -p 'test_*.py'
|
|
- name: Fetch Pico SDK
|
|
if: ${{ gitea.event_name == 'workflow_dispatch' || (gitea.event_name == 'push' && gitea.ref == 'refs/heads/master') }}
|
|
env:
|
|
VAMP_PICO_SDK_VERSION: "2.3.0"
|
|
run: |
|
|
mkdir -p build/build_common
|
|
git clone \
|
|
--depth 1 \
|
|
--branch "$VAMP_PICO_SDK_VERSION" \
|
|
--recurse-submodules \
|
|
--shallow-submodules \
|
|
https://github.com/raspberrypi/pico-sdk.git \
|
|
build/build_common/pico-sdk
|
|
- name: Configure Pico LSP database
|
|
if: ${{ gitea.event_name == 'workflow_dispatch' || (gitea.event_name == 'push' && gitea.ref == 'refs/heads/master') }}
|
|
run: PICO_SDK_PATH="$PWD/build/build_common/pico-sdk" python3 modulus.py lsp --no-build-targets --database pico
|
|
- name: Create package
|
|
if: ${{ gitea.event_name == 'workflow_dispatch' || (gitea.event_name == 'push' && gitea.ref == 'refs/heads/master') }}
|
|
run: PICO_SDK_PATH="$PWD/build/build_common/pico-sdk" python3 modulus.py package --update
|
|
- name: Upload latest package
|
|
if: ${{ gitea.event_name == 'workflow_dispatch' || (gitea.event_name == 'push' && gitea.ref == 'refs/heads/master') }}
|
|
env:
|
|
PACKAGE_REGISTRY_USER: ${{ secrets.CONAN_USER }}
|
|
PACKAGE_REGISTRY_TOKEN: ${{ secrets.CONAN_TOKEN }}
|
|
run: python3 package/scripts/publish_latest_generic_package.py
|