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

91 lines
3.3 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: Validate Compose contracts
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