Skip to content

refactor build script with C# script (#26) #91

refactor build script with C# script (#26)

refactor build script with C# script (#26) #91

Workflow file for this run

name: Test
on:
workflow_dispatch:
push:
branches:
- main
- 'hotfix/**'
tags:
- '*'
pull_request:
# Cancel previous PR branch commits (head_ref is only defined on PRs)
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
jobs:
test:
runs-on: "ubuntu-latest"
env:
NPGSQL_TEST_DB: "Host=localhost;Port=5432;Username=gaussdb;Password=Password@1234;Database=gaussdb_tests;"
# Service containers to run with `container-job`
# https://docs.github.com/en/actions/use-cases-and-examples/using-containerized-services/creating-postgresql-service-containers
services:
# Label used to access the service container
opengauss:
image: opengauss/opengauss:5.0.0
env:
# GS_USERNAME: gaussdb # by default
GS_PASSWORD: Password@1234
GS_DB: gaussdb_tests
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--name opengauss
--health-cmd "sleep 15"
--health-interval 10s
--health-timeout 30s
--health-retries 10
strategy:
matrix:
include:
- config: Release
test_tfm: net8.0
- config: Release
test_tfm: net9.0
steps:
- name: Update DB configuration
run: |
docker exec opengauss bash -c "sed -i 's/^max_wal_senders\s*=\s*4/max_wal_senders = 80/' /var/lib/opengauss/data/postgresql.conf"
docker exec opengauss bash -c "sed -i 's/^max_connections\s*=\s*200/max_connections = 500/' /var/lib/opengauss/data/postgresql.conf"
docker exec opengauss bash -c "cat /var/lib/opengauss/data/postgresql.conf"
docker restart opengauss
for i in {1..30}; do
if [ "$(docker inspect --format='{{json .State.Health.Status}}' opengauss)" == "\"healthy\"" ]; then
break
fi
sleep 1
done
- name: Checkout
uses: actions/checkout@v4
- name: NuGet Cache
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Build.targets') }}
restore-keys: |
${{ runner.os }}-nuget
- name: Setup .NET SDK
uses: actions/[email protected]
with:
dotnet-version: |
8.0.x
9.0.x
- name: DependencyInjection Test
run: |
dotnet test -c ${{ matrix.config }} -f ${{ matrix.test_tfm }} test/GaussDB.DependencyInjection.Tests --logger "GitHubActions;report-warnings=false"
- name: Tests
run: |
dotnet test -c ${{ matrix.config }} -f ${{ matrix.test_tfm }} test/GaussDB.Tests --logger "GitHubActions;report-warnings=false"