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
144 changes: 144 additions & 0 deletions .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
---
# SPDX-License-Identifier: BSD-3-Clause

name: Codestyle & Manifest Checks

# yamllint disable-line rule:truthy
on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
workflow_dispatch:

permissions: {}

concurrency:
group: "${{ github.workflow }}-${{ github.event_name }}-\
${{ github.event_name == 'pull_request' && github.ref || github.run_id }}"
cancel-in-progress: true

jobs:
yamllint:
name: YAML lint
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Install yamllint
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends yamllint

- name: Run yamllint
env:
yamllint_config: '{extends: default, rules: {line-length: {max: 100}}}'
run: |
yamllint -f parsable -d "$yamllint_config" --strict \
.github/workflows/*.yml *.yml

spdx-check:
name: SPDX license headers
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Verify SPDX-License-Identifier headers
run: |
set -euo pipefail
missing=0
while IFS= read -r f; do
case "$f" in
.github/workflows/*.yml|scripts/*.sh|cmake/*.cmake|\
CMakeLists.txt|Makefile|west.yml|\
tools/validate-*.py|tools/pretty-macro.sh)
if ! head -n 5 "$f" | grep -q "SPDX-License-Identifier:"; then
echo "ERROR: missing SPDX-License-Identifier header in $f"
missing=1
fi
;;
esac
done < <(git ls-files)
exit "$missing"

shell-syntax:
name: Shell script syntax
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Check bash syntax on tracked shell scripts
run: |
set -euo pipefail
while IFS= read -r f; do
echo "Checking $f"
bash -n "$f"
done < <(git ls-files '*.sh')

python-lint:
name: Python fatal lint (ruff)
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Run ruff fatal checks
uses: astral-sh/ruff-action@278981a28ce3188b1e39527901f38254bf3aac89 # v4.1.0
with:
args: "check --select E9,F63,F7,F82"
src: "tools validator"

manifest-consistency:
name: West manifest & ALSA pin parity
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Install python3-yaml
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends python3-yaml

- name: Verify west.yml and build-alsa-tools.sh ALSA revisions match
run: |
python3 - <<'PYEOF'
import pathlib
import re
import yaml

west = yaml.safe_load(pathlib.Path("west.yml").read_text())
projects = {p["name"]: p["revision"] for p in west["manifest"]["projects"]}
sh_text = pathlib.Path("scripts/build-alsa-tools.sh").read_text()
m = re.search(r"COMMIT_ID=\(\s*([^)]+)\)", sh_text, re.DOTALL)
assert m, "COMMIT_ID array not found in scripts/build-alsa-tools.sh"
sh_commits = re.findall(r'"([0-9a-f]{40})"', m.group(1))
assert len(sh_commits) == 2, f"Expected 2 ALSA commits, got {sh_commits}"
assert projects["alsa-lib"] == sh_commits[0], (
f"alsa-lib mismatch: west.yml={projects['alsa-lib']} vs sh={sh_commits[0]}"
)
assert projects["alsa-utils"] == sh_commits[1], (
f"alsa-utils mismatch: west.yml={projects['alsa-utils']} vs sh={sh_commits[1]}"
)
print("ALSA pins match cleanly:", projects["alsa-lib"], projects["alsa-utils"])
PYEOF
105 changes: 96 additions & 9 deletions .github/workflows/topology.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
# SPDX-License-Identifier: BSD-3-Clause

name: SOF Topologies Build & Validation

# yamllint disable-line rule:truthy
on: [pull_request, push, workflow_dispatch, workflow_call]

permissions:
contents: read
permissions: {}

concurrency:
group: "${{ github.workflow }}-${{ github.event_name }}-\
Expand All @@ -15,10 +16,13 @@ concurrency:
jobs:
build-topologies:
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: sof-topologies
persist-credentials: false

- name: Install build dependencies
run: |
Expand All @@ -40,7 +44,8 @@ jobs:

- name: Build ALSA lib & utils (alsatplg)
run: |
SOF_WORKSPACE="${GITHUB_WORKSPACE}" ./sof-topologies/scripts/build-alsa-tools.sh
SOF_WORKSPACE="${GITHUB_WORKSPACE}" \
./sof-topologies/scripts/build-alsa-tools.sh

- name: Build Topology1, Topology2 & Test Topologies
env:
Expand All @@ -56,14 +61,16 @@ jobs:

- name: Run Topology & Package Validation Suite
run: |
ctest --test-dir "${GITHUB_WORKSPACE}/sof-topologies/build" --output-on-failure -V
ctest --test-dir "${GITHUB_WORKSPACE}/sof-topologies/build" \
--output-on-failure -V

- name: Validate DEB Package System Install & Removal
run: |
sudo rm -rf /lib/firmware/intel/sof-tplg \
/lib/firmware/intel/sof-ipc4-tplg \
/lib/firmware/intel/sof-ace-tplg
sudo dpkg -i --force-overwrite "${GITHUB_WORKSPACE}/sof-topologies/build/"sof-topology_*_all.deb
sudo dpkg -i --force-overwrite \
"${GITHUB_WORKSPACE}/sof-topologies/build/"sof-topology_*_all.deb
dpkg -s sof-topology
sudo dpkg -V sof-topology
./sof-topologies/tools/validate-package.py \
Expand All @@ -80,7 +87,8 @@ jobs:
sudo rm -rf /lib/firmware/intel/sof-tplg \
/lib/firmware/intel/sof-ipc4-tplg \
/lib/firmware/intel/sof-ace-tplg
sudo rpm --dbpath /var/lib/rpm -ivh --nodeps --replacefiles "${GITHUB_WORKSPACE}/sof-topologies/build/"sof-topology-*.noarch.rpm
sudo rpm --dbpath /var/lib/rpm -ivh --nodeps --replacefiles \
"${GITHUB_WORKSPACE}/sof-topologies/build/"sof-topology-*.noarch.rpm
sudo rpm --dbpath /var/lib/rpm -qi sof-topology
sudo rpm --dbpath /var/lib/rpm -V sof-topology
./sof-topologies/tools/validate-package.py \
Expand All @@ -92,9 +100,88 @@ jobs:
test ! -e /lib/firmware/intel/sof-ipc4-tplg
test ! -L /lib/firmware/intel/sof-ace-tplg

- name: Validate Install Script
- name: Validate DEV Component & Install Scripts
run: |
./sof-topologies/scripts/install-topology.sh --dest "${GITHUB_WORKSPACE}/stage/lib/firmware"
DESTDIR="${GITHUB_WORKSPACE}/stage-dev" cmake --install \
"${GITHUB_WORKSPACE}/sof-topologies/build" --component dev
test -n "$(find "${GITHUB_WORKSPACE}/stage-dev" -name '*.tplg' | head -n 1)"
./sof-topologies/scripts/install-topology.sh \
--dest "${GITHUB_WORKSPACE}/stage/lib/firmware"
test -d "${GITHUB_WORKSPACE}/stage/lib/firmware/intel/sof-tplg"
test -d "${GITHUB_WORKSPACE}/stage/lib/firmware/intel/sof-ipc4-tplg"
test -L "${GITHUB_WORKSPACE}/stage/lib/firmware/intel/sof-ace-tplg"
mkdir -p "${GITHUB_WORKSPACE}/sof/tools"
SOF_WORKSPACE="${GITHUB_WORKSPACE}" \
./sof-topologies/scripts/build-topology.sh -T -t -L
test -d "${GITHUB_WORKSPACE}/sof/tools/build_tools/topology/topology1"
test -d "${GITHUB_WORKSPACE}/sof/tools/build_tools/topology/topology2"
test -d "${GITHUB_WORKSPACE}/sof/tools/build_tools/test/topology"

build-variants-and-makefile:
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: sof-topologies
persist-credentials: false

- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get -y install ninja-build cmake m4 \
automake autoconf libtool gettext libasound2-dev \
pkg-config python3-construct python3-pytest rpm cpio fakeroot

- name: Install autoconf 2.72
run: |
cd "${GITHUB_WORKSPACE}"
wget -q https://ftp.gnu.org/gnu/autoconf/autoconf-2.72.tar.gz
tar xf autoconf-2.72.tar.gz
cd autoconf-2.72
./configure --prefix=/usr/local
make -j"$(nproc)"
sudo make install
hash -r

- name: Build ALSA lib & utils (alsatplg)
run: |
SOF_WORKSPACE="${GITHUB_WORKSPACE}" \
./sof-topologies/scripts/build-alsa-tools.sh

- name: Test Makefile topology1-only variant (BUILD_TOPOLOGY2=OFF)
run: |
make -C "${GITHUB_WORKSPACE}/sof-topologies" \
BUILD_DIR="${GITHUB_WORKSPACE}/build-t1" \
CMAKE_ARGS="-DALSATPLG_CMD=${GITHUB_WORKSPACE}/tools/bin/alsatplg \
-DBUILD_TOPOLOGY2=OFF" \
topology1
ctest --test-dir "${GITHUB_WORKSPACE}/build-t1" \
-R validate_topology1 --output-on-failure -V

- name: Test topology2-only variant (BUILD_TOPOLOGY1=OFF, BUILD_DEV_TOPOLOGIES=OFF)
run: |
make -C "${GITHUB_WORKSPACE}/sof-topologies" \
BUILD_DIR="${GITHUB_WORKSPACE}/build-t2-prod" \
CMAKE_ARGS="-DALSATPLG_CMD=${GITHUB_WORKSPACE}/tools/bin/alsatplg \
-DBUILD_TOPOLOGY1=OFF -DBUILD_DEV_TOPOLOGIES=OFF \
-DTPLG_VALIDATE=ON" \
topology2
ctest --test-dir "${GITHUB_WORKSPACE}/build-t2-prod" \
-R "validate_topology2|validate_tplgtool2" --output-on-failure -V

- name: Test Makefile check without dev topologies (BUILD_DEV_TOPOLOGIES=OFF)
run: |
make -C "${GITHUB_WORKSPACE}/sof-topologies" \
BUILD_DIR="${GITHUB_WORKSPACE}/build-prod-only" \
CMAKE_ARGS="-DALSATPLG_CMD=${GITHUB_WORKSPACE}/tools/bin/alsatplg \
-DBUILD_DEV_TOPOLOGIES=OFF -DTPLG_VALIDATE=ON" \
check

- name: Test configure with all topologies disabled
run: |
cmake -GNinja -S "${GITHUB_WORKSPACE}/sof-topologies" \
-B "${GITHUB_WORKSPACE}/build-none" \
-DALSATPLG_CMD="${GITHUB_WORKSPACE}/tools/bin/alsatplg" \
-DBUILD_TOPOLOGY1=OFF -DBUILD_TOPOLOGY2=OFF
70 changes: 70 additions & 0 deletions .github/workflows/tplg-validator-schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
# SPDX-License-Identifier: BSD-3-Clause

name: Topology Validator Kernel Schema

# Checks that validator/schema/kernel_tokens.py still matches the SOF driver
# token tables in the kernel. When this fails, rerun schema/gen_kernel_tokens.py
# against a kernel tree and review validator rules against kernel changes.

# yamllint disable-line rule:truthy
on:
schedule:
- cron: '0 3 * * 1'
pull_request:
paths:
- 'validator/schema/**'
- 'validator/tests/**'
- '.github/workflows/tplg-validator-schema.yml'
push:
branches:
- 'main'
paths:
- 'validator/schema/**'
- 'validator/tests/**'
- '.github/workflows/tplg-validator-schema.yml'
workflow_dispatch:

permissions: {}

concurrency:
group: "${{ github.workflow }}-${{ github.event_name }}-\
${{ github.event_name == 'pull_request' && github.ref || github.run_id }}"
cancel-in-progress: true

jobs:
kernel-schema:
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
filter: 'tree:0'
path: sof-topologies
persist-credentials: false

- name: Install Python test dependencies
run: |
sudo apt-get update
sudo apt-get -y install python3-construct python3-pytest

- name: Fetch SOF driver sources
run: |
git clone --depth 1 --filter=blob:none --sparse \
--branch topic/sof-dev https://github.com/thesofproject/linux.git linux
git -C linux sparse-checkout set --no-cone \
/include/uapi/sound/ /sound/soc/sof/ /sound/soc/soc-topology.c

- name: Check kernel token schema
run: |
python3 sof-topologies/validator/schema/gen_kernel_tokens.py \
--kernel linux --check

- name: Run validator kernel schema integration test
env:
KERNEL_TREE: ${{ github.workspace }}/linux
run: |
pytest -v \
sof-topologies/validator/tests/test_integration.py \
-k test_kernel_schema_is_current
Loading
Loading