mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-10-06 21:55:39 -04:00
102 lines
3.8 KiB
YAML
102 lines
3.8 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main, master, dev, beta]
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
branches: [main, master, dev, beta]
|
|
|
|
env:
|
|
DOTNET_VERSION: "10.0.301"
|
|
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: Setup Python
|
|
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
|
|
with:
|
|
python-version: "3.10"
|
|
|
|
- name: Install PostgreSQL 18 client
|
|
shell: bash
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y --no-install-recommends ca-certificates curl
|
|
sudo install -d /usr/share/postgresql-common/pgdg
|
|
sudo curl --fail --silent --show-error \
|
|
--output /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc \
|
|
https://www.postgresql.org/media/keys/ACCC4CF8.asc
|
|
. /etc/os-release
|
|
printf '%s\n' \
|
|
'Types: deb' \
|
|
'URIs: https://apt.postgresql.org/pub/repos/apt' \
|
|
"Suites: ${VERSION_CODENAME}-pgdg" \
|
|
"Architectures: $(dpkg --print-architecture)" \
|
|
'Components: main' \
|
|
'Signed-By: /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc' \
|
|
| sudo tee /etc/apt/sources.list.d/pgdg.sources >/dev/null
|
|
sudo apt-get update
|
|
sudo apt-get install -y --no-install-recommends postgresql-client-18
|
|
echo "/usr/lib/postgresql/18/bin" >> "$GITHUB_PATH"
|
|
export PATH="/usr/lib/postgresql/18/bin:$PATH"
|
|
pg_dump --version
|
|
pg_restore --version
|
|
|
|
- name: Restore dependencies
|
|
run: dotnet restore -p:NuGetAudit=true
|
|
|
|
- name: Test first-party bundle integrity
|
|
run: python -m unittest discover -s tools/tests -v
|
|
|
|
- name: Verify C# formatting and analyzers
|
|
run: dotnet format allstarr.sln --no-restore --verify-no-changes --verbosity minimal
|
|
|
|
- name: Build
|
|
run: dotnet build --configuration Release --no-restore -p:TreatWarningsAsErrors=true
|
|
|
|
- name: Test
|
|
run: dotnet test --configuration Release --no-build --verbosity normal
|
|
|
|
- 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
|
|
|
|
- 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 -f docker-compose.dev.yml config --quiet
|
|
docker compose -f docker-compose.yml -f docker-compose.aio.yml config --quiet
|
|
docker compose -f docker-compose.yml -f docker-compose.spotify-lyrics.yml config --quiet
|
|
docker compose -f docker-compose.yml -f docker-compose.apple.yml config --quiet
|