2023-12-31 11:58:10 +00:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ "main" ]
|
|
|
|
pull_request:
|
|
|
|
branches: [ "main" ]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-and-test:
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
dotnet-version: [ "6.0", "7.0", "8.0" ]
|
|
|
|
postgres-version: [ "12", "13", "14", "15", "latest" ]
|
|
|
|
|
|
|
|
services:
|
|
|
|
postgres:
|
|
|
|
image: postgres:${{ matrix.postgres-version }}
|
2024-04-20 23:46:47 +00:00
|
|
|
networks:
|
2024-04-20 23:55:51 +00:00
|
|
|
- runner_overlay
|
2023-12-31 11:58:10 +00:00
|
|
|
env:
|
|
|
|
POSTGRES_PASSWORD: postgres
|
|
|
|
options: >-
|
|
|
|
--health-cmd pg_isready
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 5
|
|
|
|
ports:
|
2024-04-21 00:04:33 +00:00
|
|
|
- target: 5432
|
|
|
|
published: 8301
|
|
|
|
protocol: tcp
|
|
|
|
mode: overlay
|
|
|
|
|
|
|
|
env:
|
|
|
|
BITBADGER__DOCUMENTS__POSTGRES__DBPORT: 8301
|
2023-12-31 11:58:10 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup .NET ${{ matrix.dotnet-version }}.x
|
|
|
|
uses: actions/setup-dotnet@v3
|
|
|
|
with:
|
|
|
|
dotnet-version: ${{ matrix.dotnet-version }}.x
|
2024-04-20 23:41:58 +00:00
|
|
|
#- name: Restore dependencies
|
|
|
|
# run: dotnet restore src/BitBadger.Documents.sln
|
2023-12-31 11:58:10 +00:00
|
|
|
- name: Build
|
2024-04-20 23:41:58 +00:00
|
|
|
# run: dotnet build src/BitBadger.Documents.sln --no-restore -f net${{ matrix.dotnet-version }}
|
|
|
|
run: dotnet build src/BitBadger.Documents.sln -f net${{ matrix.dotnet-version }}
|
2023-12-31 11:58:10 +00:00
|
|
|
- name: Test ${{ matrix.dotnet-version }} against PostgreSQL ${{ matrix.postgres-version }}
|
|
|
|
run: dotnet run --project src/Tests/BitBadger.Documents.Tests.fsproj -f net${{ matrix.dotnet-version }}
|
|
|
|
publish:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: build-and-test
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup .NET
|
|
|
|
uses: actions/setup-dotnet@v3
|
|
|
|
with:
|
|
|
|
dotnet-version: "8.0"
|
|
|
|
- name: Package Common Library
|
|
|
|
run: dotnet pack src/Common/BitBadger.Documents.Common.fsproj -c Release
|
|
|
|
- name: Move Common package
|
|
|
|
run: cp src/Common/bin/Release/BitBadger.Documents.Common.*.nupkg .
|
|
|
|
- name: Package PostgreSQL Library
|
|
|
|
run: dotnet pack src/Postgres/BitBadger.Documents.Postgres.fsproj -c Release
|
|
|
|
- name: Move PostgreSQL package
|
|
|
|
run: cp src/Postgres/bin/Release/BitBadger.Documents.Postgres.*.nupkg .
|
|
|
|
- name: Package SQLite Library
|
|
|
|
run: dotnet pack src/Sqlite/BitBadger.Documents.Sqlite.fsproj -c Release
|
|
|
|
- name: Move SQLite package
|
|
|
|
run: cp src/Sqlite/bin/Release/BitBadger.Documents.Sqlite.*.nupkg .
|
|
|
|
- name: Save Packages
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: packages
|
|
|
|
path: |
|
|
|
|
*.nupkg
|