2024-12-19 09:12:39 +05:00
|
|
|
name: Unit tests
|
|
|
|
run-name: ${{ gitea.actor }} is testing
|
2025-01-27 09:06:07 +05:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2024-12-17 14:05:14 +05:00
|
|
|
|
|
|
|
jobs:
|
2025-02-04 11:46:46 +05:00
|
|
|
tests-and-publication:
|
2024-12-17 14:05:14 +05:00
|
|
|
runs-on: ubuntu-latest
|
2025-02-04 11:41:47 +05:00
|
|
|
# container: node
|
2024-12-19 09:12:39 +05:00
|
|
|
|
|
|
|
# Service containers to run with `runner-job`
|
|
|
|
services:
|
|
|
|
# Label used to access the service container
|
2024-12-20 12:19:36 +05:00
|
|
|
postgres:
|
2024-12-19 09:12:39 +05:00
|
|
|
# Docker Hub image
|
|
|
|
image: postgres
|
|
|
|
# Provide the password for postgres
|
|
|
|
env:
|
|
|
|
POSTGRES_USER: postgres
|
|
|
|
POSTGRES_PASSWORD: postgres
|
|
|
|
# Set health checks to wait until postgres has started
|
|
|
|
options: >-
|
|
|
|
--health-cmd pg_isready
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 5
|
|
|
|
ports:
|
|
|
|
# Maps tcp port 5432 on service container to the host
|
|
|
|
- 5442:5432
|
|
|
|
|
2024-12-17 14:05:14 +05:00
|
|
|
steps:
|
2025-02-04 11:31:22 +05:00
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- name: Setup .NET
|
|
|
|
if: ${{ steps.cache-dotnet.outputs.cache-hit != 'true' }}
|
2024-12-23 16:22:58 +05:00
|
|
|
uses: actions/setup-dotnet@v4
|
|
|
|
with:
|
2024-12-24 11:50:54 +05:00
|
|
|
dotnet-version: 9.0.x
|
2025-02-04 10:48:13 +05:00
|
|
|
|
2025-01-27 09:06:07 +05:00
|
|
|
- name: Add gitea as nuget source
|
|
|
|
run: dotnet nuget add source --name gitea --username publisher --password ${{ secrets.PUBLISHER_PASSWORD }} --store-password-in-clear-text https://git.ddrilling.ru/api/packages/DDrilling/nuget/index.json
|
2025-02-04 10:48:13 +05:00
|
|
|
|
2025-02-04 11:31:22 +05:00
|
|
|
- name: Restore dependencies
|
|
|
|
run: dotnet restore
|
|
|
|
|
|
|
|
- name: Build solution
|
|
|
|
run: dotnet build --no-restore
|
2025-02-04 10:48:13 +05:00
|
|
|
|
2024-12-20 12:19:36 +05:00
|
|
|
- name: Run integration tests
|
|
|
|
run: dotnet test DD.Persistence.IntegrationTests
|
2025-02-04 10:48:13 +05:00
|
|
|
|
2025-01-27 09:17:40 +05:00
|
|
|
- name: Run unit tests
|
|
|
|
run: dotnet test DD.Persistence.Test --no-build
|
2025-02-04 10:48:13 +05:00
|
|
|
|
2025-01-27 09:06:07 +05:00
|
|
|
- name: Pack Persistence Client
|
|
|
|
run: dotnet pack DD.Persistence.Client/DD.Persistence.Client.csproj -c Debug -o ./artifacts
|
2025-02-04 10:48:13 +05:00
|
|
|
|
2025-01-27 14:27:20 +05:00
|
|
|
- name: Pack Persistence Models
|
|
|
|
run: dotnet pack DD.Persistence.Models/DD.Persistence.Models.csproj -c Debug -o ./artifacts
|
2025-02-04 10:48:13 +05:00
|
|
|
|
2025-01-27 14:30:49 +05:00
|
|
|
- name: Publish Persistence Client Package
|
|
|
|
run: dotnet nuget push ./artifacts/DD.Persistence.Client.*.nupkg --source gitea --skip-duplicate
|
2025-02-04 10:48:13 +05:00
|
|
|
|
2025-01-27 14:27:20 +05:00
|
|
|
- name: Publish Persistence Models Package
|
|
|
|
run: dotnet nuget push ./artifacts/DD.Persistence.Models.*.nupkg --source gitea --skip-duplicate
|
2025-02-04 11:16:23 +05:00
|
|
|
|
2025-02-04 11:46:46 +05:00
|
|
|
- name: Login to Gitea Docker Registry
|
|
|
|
run: docker login -u publisher -p ${{ secrets.PUBLISHER_PASSWORD }} https://git.ddrilling.ru
|
|
|
|
|
2025-02-04 11:16:23 +05:00
|
|
|
- name: Docker Build
|
|
|
|
run: docker build -t git.ddrilling.ru/ddrilling/persistence:latest --network=host --build-arg PUBLISHERPASSWORD="${{ secrets.PUBLISHER_PASSWORD }}" -f DD.Persistence.App/Dockerfile .
|
|
|
|
|
|
|
|
- name: Push Docker image to Gitea
|
|
|
|
run: docker push git.ddrilling.ru/ddrilling/persistence:latest
|
2025-02-04 11:07:41 +05:00
|
|
|
|
2025-02-04 11:31:22 +05:00
|
|
|
|
|
|
|
|