Skip to content

Commit

Permalink
Separate out building and testing
Browse files Browse the repository at this point in the history
  • Loading branch information
MSWS committed Aug 31, 2024
1 parent 8121461 commit e4585b8
Showing 1 changed file with 29 additions and 10 deletions.
39 changes: 29 additions & 10 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
pull_request:

jobs:
db:
setup-db:
runs-on: ubuntu-latest
services:
mariadb:
Expand All @@ -16,17 +16,8 @@ jobs:
ports:
- 3306:3306

steps:
- name: Wait for MariaDB
run: |
until mysqladmin ping -h "localhost" --silent; do
echo "Waiting for database connection..."
sleep 2
done
build:
runs-on: ubuntu-latest
needs: db
strategy:
matrix:
dotnet-version: [ 6.0.x, 7.0.x, 8.0.x, 9.0.x ] # Test on multiple .NET versions
Expand All @@ -53,5 +44,33 @@ jobs:
- name: Build
run: dotnet build --no-restore

- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: build-output
path: |
**/bin/**/*.dll
**/bin/**/*.pdb
test:
runs-on: ubuntu-latest
needs: [ setup-db, build ]
strategy:
matrix:
dotnet-version: [ 6.0.x, 7.0.x, 8.0.x, 9.0.x ] # Test on multiple .NET versions

steps:
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet-version }}

- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: build-output

- name: Test
run: dotnet test GangsTest/GangsTest.csproj --no-build --verbosity normal

0 comments on commit e4585b8

Please sign in to comment.