cicd-github-actions/.github/workflows/build-and-test.yml

51 lines
1.6 KiB
YAML
Raw Normal View History

2023-07-10 10:36:27 +00:00
name: Build and Test
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
2023-07-10 11:40:37 +00:00
- uses: actions/checkout@v3
2023-07-10 11:43:26 +00:00
- name: Fetch unshallow
run: git fetch --prune --tags --unshallow
2023-07-10 11:34:37 +00:00
- name: Install GitVersion
2023-07-10 11:40:37 +00:00
uses: gittools/actions/gitversion/setup@v0.9.7
2023-07-10 11:34:37 +00:00
with:
versionSpec: '5.x'
- name: Determine Version
2023-07-10 11:40:37 +00:00
id: gitversion
uses: gittools/actions/gitversion/execute@v0.9.7
2023-07-10 10:36:27 +00:00
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build
- name: Run Unit Tests
2023-07-10 11:12:15 +00:00
run: dotnet test --filter Category=Unit --no-restore --verbosity normal
2023-07-10 11:18:40 +00:00
- name: Copy Unit Test Results
run: mkdir TestResults; cp test/**/TestResults/*.Unit.Tests.trx TestResults/
shell: bash
2023-07-10 10:53:30 +00:00
- name: Start containers
run: docker-compose -f "docker-compose.yml" up -d --build
2023-07-10 11:40:37 +00:00
env:
VERSION: ${{ steps.gitversion.outputs.nuGetVersion }}
2023-07-10 10:57:39 +00:00
- name: Wait for docker containers to setup
run: sleep 30s
shell: bash
2023-07-10 10:53:30 +00:00
- name: Run Integration Tests
2023-07-10 11:12:15 +00:00
run: dotnet test --filter Category=Integration --no-restore --verbosity normal
2023-07-10 11:18:40 +00:00
- name: Copy Integration Test Results
run: cp test/**/TestResults/*.Integration.Tests.trx TestResults/
shell: bash
2023-07-10 10:47:11 +00:00
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Test Results
path: TestResults/*.trx
reporter: dotnet-trx