Skip to content

Merge pull request #439 from phnx47/test/xunit.v3 #558

Merge pull request #439 from phnx47/test/xunit.v3

Merge pull request #439 from phnx47/test/xunit.v3 #558

Workflow file for this run

name: CI
on:
push:
branches:
- "main"
tags:
- "v*"
pull_request:
branches:
- "main"
workflow_dispatch:
env:
TEST_DB_PASS: "Password12!"
jobs:
build:
name: Build, Test & Pack
runs-on: ubuntu-24.04
services:
mysql:
image: mysql:8.0-debian
env:
MYSQL_ROOT_PASSWORD: ${{ env.TEST_DB_PASS }}
ports:
- "3306:3306"
mssql:
image: mcr.microsoft.com/mssql/server:2022-latest
env:
ACCEPT_EULA: "Y"
SA_PASSWORD: ${{ env.TEST_DB_PASS }}
ports:
- "1433:1433"
oracle:
image: gvenzl/oracle-xe:21-slim-faststart
env:
ORACLE_PASSWORD: ${{ env.TEST_DB_PASS }}
ports:
- "1521:1521"
postgres:
image: postgres:17.2-alpine
ports:
- "5432:5432"
env:
POSTGRES_PASSWORD: ${{ env.TEST_DB_PASS }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --no-restore -c Release
- name: Run tests
run: dotnet test --no-build -c Release
- name: Publish to Codecov
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
- name: Set Dev version
if: github.ref == 'refs/heads/main'
run: echo "VERSION=$(git describe --long --tags | sed 's/^v//;0,/-/s//./')" >> $GITHUB_ENV
- name: Set Release version
if: startsWith(github.ref, 'refs/tags/v')
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
- name: Pack NuGet artifacts
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
run: dotnet pack --no-build -c Release -p:PackageVersion="${{ env.VERSION }}"
- name: Upload artifacts
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v4
with:
name: nupkgs
path: src/**/*nupkg
github:
name: Deploy to GitHub
needs: [build]
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-24.04
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: nupkgs
- name: Push to GitHub
run: |
dotnet nuget push "**/*.nupkg" \
--skip-duplicate \
-k ${{ secrets.GITHUB_TOKEN }} \
-s https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
nuget:
name: Deploy to NuGet
needs: [build]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-24.04
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: nupkgs
- name: Push to NuGet
run: |
dotnet nuget push "**/*.nupkg" \
-k ${{ secrets.NUGET_KEY }} \
-s https://api.nuget.org/v3/index.json