Build artifacts #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: .NET Build | |
on: | |
push: | |
branches: | |
- 'develop' | |
pull_request: | |
branches: | |
- '*' | |
workflow_dispatch: | |
env: | |
DOTNET_VERSION: '8.0.x' | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
# Setup | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'zulu' | |
# Test | |
- name: Test and analyze | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
dotnet tool install --global dotnet-sonarscanner | |
dotnet-sonarscanner begin /k:"CorruptComputer_BaldersGait" /o:"corruptcomputer" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths=./BaldersGait.UnitTests/TestResults/*/coverage.opencover.xml | |
dotnet build --no-incremental | |
dotnet test --collect:"XPlat Code Coverage;Format=opencover" | |
dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" | |
build-linux: | |
name: Build Linux | |
runs-on: ubuntu-latest | |
steps: | |
# Setup | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
# Build | |
- name: Build | |
run: | | |
dotnet publish --configuration Release --runtime linux-x64 --self-contained true --property PublishDir=~/publish | |
# Upload | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: BaldersGait-linux-x64 | |
path: ~/publish | |
build-windows: | |
name: Build Windows | |
runs-on: windows-latest | |
steps: | |
# Setup | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
# Build | |
- name: Build | |
run: | | |
dotnet publish --configuration Release --runtime win-x64 --self-contained true --property PublishDir=publish | |
# Upload | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: BaldersGait-win-x64 | |
path: D:\a\BaldersGait\BaldersGait\BaldersGait\publish\ |