Files
allstarr/.github/workflows/ci.yml
T

248 lines
8.3 KiB
YAML

name: CI
on:
push:
branches: [main, master, dev, beta]
pull_request:
types: [opened, synchronize, reopened]
branches: [main, master, dev, beta]
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
DOTNET_VERSION: "10.0.301"
NODE_VERSION: "22.23.1"
ALLSTARR_TEST_POSTGRES: "Host=127.0.0.1;Port=5432;Database=allstarr_test;Username=allstarr;Password=ci-postgres-password;SSL Mode=Disable"
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:18.4-alpine3.23@sha256:996d0920e4ff9df1fc19dacb904492f3c1ec0ec1cc338f0ad7123be7731c5f5e
env:
POSTGRES_DB: allstarr_test
POSTGRES_USER: allstarr
POSTGRES_PASSWORD: ci-postgres-password
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U allstarr -d allstarr_test"
--health-interval 5s
--health-timeout 5s
--health-retries 20
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: Setup .NET
uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Install PostgreSQL 18 client
shell: bash
run: bash tools/ci/postgres-client.sh install
- name: Restore dependencies
run: python3 tools/tests/timing_report.py --name dotnet-restore -- dotnet restore -p:NuGetAudit=true
- name: Build
run: python3 tools/tests/timing_report.py --name dotnet-build -- dotnet build --configuration Release --no-restore -p:TreatWarningsAsErrors=true
- name: Test
run: >-
python3 tools/tests/timing_report.py
--name dotnet-test
--require-tests
--trx "${{ runner.temp }}/build-and-test.trx"
--
dotnet test --configuration Release --no-build
--filter "Lane!=ReleaseCritical"
--verbosity minimal
--logger "trx;LogFileName=${{ runner.temp }}/build-and-test.trx"
- name: Upload .NET test results
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: dotnet-test-results-build-and-test
path: ${{ runner.temp }}/build-and-test.trx
if-no-files-found: warn
release-critical-tests:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:18.4-alpine3.23@sha256:996d0920e4ff9df1fc19dacb904492f3c1ec0ec1cc338f0ad7123be7731c5f5e
env:
POSTGRES_DB: allstarr_test
POSTGRES_USER: allstarr
POSTGRES_PASSWORD: ci-postgres-password
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U allstarr -d allstarr_test"
--health-interval 5s
--health-timeout 5s
--health-retries 20
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: Setup .NET
uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Install PostgreSQL 18 client
shell: bash
run: bash tools/ci/postgres-client.sh install
- name: Restore dependencies
run: python3 tools/tests/timing_report.py --name release-critical-restore -- dotnet restore -p:NuGetAudit=true
- name: Build
run: python3 tools/tests/timing_report.py --name release-critical-build -- dotnet build --configuration Release --no-restore -p:TreatWarningsAsErrors=true
- name: Test release-critical contracts
run: >-
python3 tools/tests/timing_report.py
--name release-critical-test
--require-tests
--trx "${{ runner.temp }}/release-critical-tests.trx"
--
dotnet test --configuration Release --no-build
--filter "Lane=ReleaseCritical"
--verbosity minimal
--logger "trx;LogFileName=${{ runner.temp }}/release-critical-tests.trx"
- name: Upload release-critical test results
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: dotnet-test-results-release-critical
path: ${{ runner.temp }}/release-critical-tests.trx
if-no-files-found: warn
csharp-format:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: Setup .NET
uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore dependencies
run: python3 tools/tests/timing_report.py --name csharp-restore -- dotnet restore -p:NuGetAudit=true
- name: Verify C# formatting and analyzers
run: python3 tools/tests/timing_report.py --name csharp-format -- dotnet format allstarr.sln --no-restore --verify-no-changes --verbosity minimal
webui:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: Setup Node
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
cache-dependency-path: webui/package-lock.json
- name: Restore Svelte WebUI
working-directory: webui
run: |
npm ci
npx playwright install --with-deps chromium
- name: WebUI check
working-directory: webui
run: python3 ../tools/tests/timing_report.py --name webui-check -- npm run check
- name: WebUI unit tests
working-directory: webui
run: python3 ../tools/tests/timing_report.py --name webui-unit --require-tests -- npm test
- name: WebUI build
working-directory: webui
run: python3 ../tools/tests/timing_report.py --name webui-build -- npm run build
- name: WebUI budgets
working-directory: webui
run: python3 ../tools/tests/timing_report.py --name webui-budgets -- npm run check:budgets
- name: WebUI E2E
working-directory: webui
run: >-
python3 ../tools/tests/timing_report.py
--name webui-e2e
--require-tests
--playwright-json "$RUNNER_TEMP/allstarr-playwright.json"
-- npm run test:e2e:existing-build
release-manifest:
needs:
- build-and-test
- release-critical-tests
- csharp-format
- webui
- apple-contracts
- compose-contracts
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: Create release manifest
run: bash tools/create-release-manifest.sh > allstarr-release-manifest.json
- name: Upload release manifest
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: release-manifest-${{ github.sha }}
path: allstarr-release-manifest.json
if-no-files-found: error
retention-days: 30
apple-contracts:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: Setup Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: "3.10"
- name: Test Apple gateway contracts
working-directory: sidecars/apple-gateway
run: |
python -m pip install uv==0.11.29
UV_CACHE_DIR=/tmp/allstarr-uv-cache uv sync --frozen --extra test
UV_CACHE_DIR=/tmp/allstarr-uv-cache uv run --frozen --extra test pytest
compose-contracts:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: Validate Compose contracts
env:
SPOTIFY_API_SESSION_COOKIE: ci-placeholder
run: |
docker compose -f docker-compose.yml config --quiet
docker compose -f docker-compose.yml --profile spotify-lyrics config --quiet
docker compose -f docker-compose.yml --profile apple config --quiet