mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-10-06 21:55:39 -04:00
85 lines
2.8 KiB
YAML
85 lines
2.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@v4
|
|
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: ${{ env.DOTNET_VERSION }}
|
|
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v5
|
|
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
|
|
|
|
- name: Build
|
|
run: dotnet build --configuration Release --no-restore
|
|
|
|
- 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
|