Skip to content

Commit

Permalink
ci/cd update & matrix testing
Browse files Browse the repository at this point in the history
  • Loading branch information
NotOfficer committed Nov 17, 2024
1 parent de4e59a commit 2872880
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 61 deletions.
62 changes: 33 additions & 29 deletions .github/workflows/nuget_push.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,41 @@
name: NuGet Push

on:
push:
branches:
- master
workflow_run:
workflows: [Tests]
types:
- completed

defaults:
run:
working-directory: src

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Restore dependencies
run: dotnet restore ./src

- name: Build
run: dotnet build ./src --no-restore --configuration Release

- name: Pack NuGet Package(s)
run: dotnet pack ./src --no-restore --no-build --configuration Release --output ./nuget-packages

- name: Upload Build Artifact(s)
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: ./nuget-packages

- name: Push NuGet Package(s)
run: dotnet nuget push ./nuget-packages/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
9.0.x
- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore --configuration Release

- name: Pack NuGet Package(s)
run: dotnet pack --no-restore --no-build --configuration Release --output ~/nuget-packages

- name: Upload Build Artifact(s)
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: ~/nuget-packages

- name: Push NuGet Package(s)
run: dotnet nuget push ~/nuget-packages/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate
32 changes: 0 additions & 32 deletions .github/workflows/test.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Tests

on:
push:
branches:
- master
pull_request:
branches:
- master

defaults:
run:
working-directory: src

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet: [ '8.0.x', '9.0.x' ]
name: .NET ${{ matrix.dotnet }} Test
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
id: stepid
with:
dotnet-version: ${{ matrix.dotnet }}

- name: Create temporary global.json
run: echo '{"sdk":{"version":"${{ steps.stepid.outputs.dotnet-version }}"}}' > ./global.json

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore --configuration Release

- name: Run Tests
run: dotnet test --no-build --configuration Release --verbosity normal

0 comments on commit 2872880

Please sign in to comment.