From 6e20d3c856974af74ef4e1a88abc29c659f21536 Mon Sep 17 00:00:00 2001 From: Omar Boukli-Hacene Date: Thu, 4 Apr 2024 22:10:17 +0200 Subject: [PATCH] ci(GitHub Actions): Update GitHub actions --- .github/workflows/build-and-test.yml | 33 +++++++++---------- .github/workflows/code-style-check.yml | 10 ++++-- .../composite/dotnet-build/action.yml | 16 ++++++--- .github/workflows/publish.yml | 12 ++++--- 4 files changed, 43 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 58f8324..7ac8e30 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -18,6 +18,9 @@ on: permissions: {} env: + DOTNET_CLI_TELEMETRY_OPTOUT: true + DOTNET_NUGET_SIGNATURE_VERIFICATION: true + NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages INTEGRATION_TEST_RESULTS_DIR_NAME: integration_test_results UNIT_TEST_RESULTS_DIR_NAME: unit_test_results @@ -26,9 +29,6 @@ jobs: name: Solution build runs-on: ubuntu-latest - env: - DOTNET_CLI_TELEMETRY_OPTOUT: true - steps: - name: Check out repository uses: actions/checkout@v4 @@ -48,7 +48,6 @@ jobs: AKTABOOK_ENVIRONMENT: Test AKTABOOK_INTEGRATION_TEST_ENVIRONMENT: Test BUS_HOST_PID_FILE: src/Aktabook.Bus/bin/Release/net6.0/aktabook-bus.pid - DOTNET_CLI_TELEMETRY_OPTOUT: true RequesterServiceBus__RabbitMQConnectionOptions__HostName: localhost RequesterServiceBus__RabbitMQConnectionOptions__Password: ${{ secrets.RABBITMQ_INTEGRATION_TEST_PASSWORD }} RequesterServiceBus__RabbitMQConnectionOptions__PortNumber: 5672 @@ -322,7 +321,7 @@ jobs: >> $GITHUB_OUTPUT - name: Upload test results archive - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: if-no-files-found: error name: ${{ steps.get_artifact_name.outputs.artifact_name }} @@ -330,7 +329,7 @@ jobs: - name: Upload bus logs if: ${{ always() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: if-no-files-found: error name: bus-logs @@ -338,7 +337,7 @@ jobs: - name: Upload public API logs if: ${{ always() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: if-no-files-found: error name: public-api-logs @@ -400,7 +399,7 @@ jobs: >> $GITHUB_OUTPUT - name: Upload test results archive - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: if-no-files-found: error name: ${{ steps.get_artifact_name.outputs.artifact_name }} @@ -414,9 +413,6 @@ jobs: - unit_test - integration_test - env: - DOTNET_CLI_TELEMETRY_OPTOUT: true - steps: - name: Check out repository uses: actions/checkout@v4 @@ -425,12 +421,12 @@ jobs: persist-credentials: false - name: Download integration test results - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: ${{ needs.integration_test.outputs.artifact_name }} - name: Download unit test results - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: ${{ needs.unit_test.outputs.artifact_name }} @@ -447,7 +443,7 @@ jobs: ${{ env.UNIT_TEST_RESULTS_DIR_NAME }}.7z - name: Cache NuGet packages - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.nuget/packages key: >- @@ -459,9 +455,13 @@ jobs: ${{ runner.os }}-nuget- - name: Set up .NET SDK - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: - dotnet-version: 6.0.x + cache: true + cache-dependency-path: |- + src/**/packages.lock.json + test/**/packages.lock.json + global-json-file: global.json - name: Restore .NET tools run: dotnet tool restore @@ -485,7 +485,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - DOTNET_CLI_TELEMETRY_OPTOUT: true run: >- JAVA_HOME=$JAVA_HOME_17_X64 diff --git a/.github/workflows/code-style-check.yml b/.github/workflows/code-style-check.yml index 4fbc2ef..fd21d5b 100644 --- a/.github/workflows/code-style-check.yml +++ b/.github/workflows/code-style-check.yml @@ -29,12 +29,18 @@ jobs: env: DOTNET_CLI_TELEMETRY_OPTOUT: true + DOTNET_NUGET_SIGNATURE_VERIFICATION: true + NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages steps: - name: Set up .NET SDK - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: - dotnet-version: 6.0.x + cache: true + cache-dependency-path: |- + src/**/packages.lock.json + test/**/packages.lock.json + global-json-file: global.json - name: Check out repository uses: actions/checkout@v4 diff --git a/.github/workflows/composite/dotnet-build/action.yml b/.github/workflows/composite/dotnet-build/action.yml index f27a813..cc98356 100644 --- a/.github/workflows/composite/dotnet-build/action.yml +++ b/.github/workflows/composite/dotnet-build/action.yml @@ -7,6 +7,10 @@ name: Build description: Build .NET solution and cache restored NuGet packages +env: + DOTNET_CLI_TELEMETRY_OPTOUT: true + DOTNET_NUGET_SIGNATURE_VERIFICATION: true + inputs: configuration: description: .NET build configuration @@ -16,7 +20,7 @@ runs: using: composite steps: - name: Cache NuGet packages - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.nuget/packages key: >- @@ -28,13 +32,15 @@ runs: ${{ runner.os }}-nuget- - name: Set up .NET SDK - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: - dotnet-version: 6.0.x + cache: true + cache-dependency-path: |- + src/**/packages.lock.json + test/**/packages.lock.json + global-json-file: global.json - name: Restores dependencies - env: - DOTNET_NUGET_SIGNATURE_VERIFICATION: "true" shell: bash run: dotnet restore --locked-mode diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0e4fb68..58be1e4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -35,9 +35,13 @@ jobs: persist-credentials: false - name: Set up .NET SDK - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: - dotnet-version: 6.0.x + cache: true + cache-dependency-path: |- + src/**/packages.lock.json + test/**/packages.lock.json + global-json-file: global.json - name: Restores dependencies run: >- @@ -68,14 +72,14 @@ jobs: --runtime ${{ env.AKTABOOK_DOTNET_RUNTIME_TARGET }} - name: Upload bus binaries - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: if-no-files-found: error name: aktabook_bus_${{ env.AKTABOOK_DOTNET_RUNTIME_TARGET }} path: ${{ env.AKTABOOK_PUBLISH_PATH_ROOT }}/Aktabook.Bus/ - name: Upload API binaries - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: if-no-files-found: error name: aktabook_api_${{ env.AKTABOOK_DOTNET_RUNTIME_TARGET }}