From 70418e95e57bceffa974a3eeb4c22462e065f255 Mon Sep 17 00:00:00 2001 From: Fredi Kats Date: Sat, 27 Apr 2024 12:49:18 +0200 Subject: [PATCH] Update GitHub Actions --- .github/workflows/build-test.yaml | 52 +++++++++++++++++++ .github/workflows/build-test.yml | 39 -------------- .../{nuget-publish.yml => nuget-publish.yaml} | 16 ++++-- 3 files changed, 63 insertions(+), 44 deletions(-) create mode 100644 .github/workflows/build-test.yaml delete mode 100644 .github/workflows/build-test.yml rename .github/workflows/{nuget-publish.yml => nuget-publish.yaml} (68%) diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml new file mode 100644 index 0000000..3ac730c --- /dev/null +++ b/.github/workflows/build-test.yaml @@ -0,0 +1,52 @@ +name: Build and test + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ '*' ] + + +env: + working-directory: Sources + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + DOTNET_NOLOGO: true + dotnet-version: 8.0.x + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - run: git config --global core.autocrlf input + - uses: actions/checkout@v3 + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: ${{ env.dotnet-version }} + + - name: Restore dependencies + run: dotnet restore + working-directory: ${{ env.working-directory }} + + - name: Build + run: dotnet build -c Release --no-restore --verbosity normal + working-directory: ${{ env.working-directory }} + + - name: Test + run: dotnet test -c Release --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover + working-directory: ${{ env.working-directory }} + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + # - name: Run mutation tests + # run: | + # dotnet tool restore + # dotnet stryker --reporter dashboard + # working-directory: ${{ env.working-directory }} + # env: + # STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml deleted file mode 100644 index eb7fa0f..0000000 --- a/.github/workflows/build-test.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Build and test - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ '*' ] - - -env: - working-directory: Sources - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 - DOTNET_NOLOGO: true - dotnet-version: 8.0.x - -jobs: - build: - runs-on: ubuntu-latest - - defaults: - run: - working-directory: ${{ env.working-directory }} - - steps: - - uses: actions/checkout@v3 - - - name: Setup .NET - uses: actions/setup-dotnet@v3 - with: - dotnet-version: ${{ env.dotnet-version }} - - - name: Restore dependencies - run: dotnet restore - - - name: Build - run: dotnet build -c Release --no-restore --verbosity normal - - - name: Test - run: dotnet test -c Release --no-build --verbosity normal \ No newline at end of file diff --git a/.github/workflows/nuget-publish.yml b/.github/workflows/nuget-publish.yaml similarity index 68% rename from .github/workflows/nuget-publish.yml rename to .github/workflows/nuget-publish.yaml index 7d202c9..580cd4a 100644 --- a/.github/workflows/nuget-publish.yml +++ b/.github/workflows/nuget-publish.yaml @@ -13,11 +13,8 @@ jobs: build: runs-on: ubuntu-latest - defaults: - run: - working-directory: ${{ env.working-directory }} - steps: + - run: git config --global core.autocrlf input - uses: actions/checkout@v3 - name: Setup .NET @@ -27,15 +24,24 @@ jobs: - name: Restore dependencies run: dotnet restore + working-directory: ${{ env.working-directory }} - name: Build run: dotnet build -c Release /p:ContinuousIntegrationBuild=true --no-restore --verbosity normal + working-directory: ${{ env.working-directory }} - name: Test run: dotnet test -c Release --no-build --verbosity normal + working-directory: ${{ env.working-directory }} + + - name: Pack + run: dotnet pack --no-build + working-directory: ${{ env.working-directory }} - name: Publish to Nuget run: dotnet nuget push ${{ env.release-directory }}/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate + working-directory: ${{ env.working-directory }} - name: Publish to Nuget symbols - run: dotnet nuget push ${{ env.release-directory }}/*.snupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate \ No newline at end of file + run: dotnet nuget push ${{ env.release-directory }}/*.snupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate + working-directory: ${{ env.working-directory }} \ No newline at end of file