Skip to content

try to fix codecov

try to fix codecov #91

Workflow file for this run

name: Build and Test
on:
pull_request:
branches: [ main, dev ]
jobs:
build_and_pack:
runs-on: ubuntu-latest
env:
ContinuousIntegrationBuild: true
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: true
- name: Setup .NET 9
uses: actions/setup-dotnet@v3
with:
dotnet-version: '9.0.x'
- name: Build harmony and test runner
run: |
dotnet build ./Harmony/Harmony/Harmony.csproj -c ReleaseThin
dotnet build ./tests/MockMe.Tests.Runner/MockMe.Tests.Runner.csproj -c Release
- name: Test And Collect CodeCov
run: |
dotnet tool install --global dotnet-coverage
export PATH="$PATH:/root/.dotnet/tools"
dotnet-coverage collect "dotnet run --project ./tests/MockMe.Tests.Runner/ -c Release --no-build" -f cobertura -s ./CodeCoverage.runsettings
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.COVERALLS_REPO_TOKEN }}
file: ./output.cobertura.xml
- name: Pack NuGet Packages
run: dotnet pack --configuration Release --output ./packages /p:Version=0.0.1-dev
- name: Upload NuGet Packages
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: ./packages
test_linux:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet:
- '6.0'
- '7.0'
- '8.0'
- '9.0'
env:
ContinuousIntegrationBuild: true
LATEST_DOTNET_VERSION: '9.0'
needs: build_and_pack
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet }}
- name: Download NuGet Packages
uses: actions/download-artifact@v4
with:
name: nuget-packages
path: ./packages
- name: Create local package feed
run: dotnet nuget add source ${{ github.workspace }}/packages --name localNuGet
- name: Clean previous build artifacts
run: |
find . -type d -name 'bin' -exec rm -rf {} +
find . -type d -name 'obj' -exec rm -rf {} +
# stack overflow thread for why I'm using maxcpucount
# https://stackoverflow.com/questions/72267139/msbuild-error-msb4018-cannot-access-project-assets-json-in-net-5-build
- name: Build
run: dotnet build ./tests/MockMe.Tests.slnf -c Release /p:MockMeNugetPackageVersion="0.0.1-dev" /p:MockMeTestsTargetFramework=net${{ matrix.dotnet }} -f net${{ matrix.dotnet }} -maxcpucount:1
- name: Test
run: dotnet test ./tests/MockMe.Tests.slnf --no-build -c Release --verbosity normal /p:MockMeTestsTargetFramework=net${{ matrix.dotnet }} -f net${{ matrix.dotnet }}
# test-windows:
# runs-on: windows-latest
# strategy:
# matrix:
# dotnet:
# - '6.0'
# - '7.0'
# - '8.0'
# - '9.0'
# needs: build_and_pack
# steps:
# - name: Checkout Code
# uses: actions/checkout@v4
# - name: Setup .NET ${{ matrix.dotnet }}
# uses: actions/setup-dotnet@v3
# with:
# dotnet-version: ${{ matrix.dotnet }}
# - name: Download NuGet Packages
# uses: actions/download-artifact@v4
# with:
# name: nuget-packages
# path: ./packages
# - name: Create local package feed
# run: dotnet nuget add source ${{ github.workspace }}/packages --name localNuGet
# - name: Print NuGet Sources
# run: dotnet nuget list source
# - name: Restore dependencies
# run: dotnet restore /p:MockMeNugetPackageVersion="0.0.1-dev"
# - name: Build
# run: dotnet build ./tests/MockMe.Tests.slnf --no-restore -c Release /p:MockMeNugetPackageVersion="0.0.1-dev"
# - name: Test
# run: dotnet test ./tests/MockMe.Tests.slnf --no-build -c Release --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=openCover