From 46da2ec2d1c8f464a925af35228f0350cf84f4d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Wed, 8 Jan 2025 19:43:36 +0100 Subject: [PATCH] Fixing GitHub Actions workflows Ubuntu 24 incompatibility (#17313) --- .github/ISSUE_TEMPLATE/target_frameworks.md | 7 +++- .github/actions/setup-dotnet/action.yml | 12 +++++++ .github/workflows/assets_validation.yml | 2 +- .github/workflows/close_stale_prs_issues.yml | 2 +- .github/workflows/comment_issue_on_triage.yml | 2 +- .github/workflows/community_metrics.yml | 2 +- .github/workflows/contributor_map.yml | 2 +- .github/workflows/docs_validation.yml | 5 +-- .github/workflows/first_time_contributor.yml | 2 +- .github/workflows/functional_all_db.yml | 35 ++++++------------- .github/workflows/mac_unit_test_ci.yml | 6 ++-- .github/workflows/main_ci.yml | 10 +++--- .github/workflows/pr_ci.yml | 10 +++--- .github/workflows/preview_ci.yml | 6 ++-- .github/workflows/release_ci.yml | 20 +++++------ .github/workflows/validate_pr.yml | 2 +- 16 files changed, 57 insertions(+), 68 deletions(-) create mode 100644 .github/actions/setup-dotnet/action.yml diff --git a/.github/ISSUE_TEMPLATE/target_frameworks.md b/.github/ISSUE_TEMPLATE/target_frameworks.md index d5628bfa8f8..297481461bc 100644 --- a/.github/ISSUE_TEMPLATE/target_frameworks.md +++ b/.github/ISSUE_TEMPLATE/target_frameworks.md @@ -10,7 +10,12 @@ assignees: '' Use the minimal SDK version required, the `rollForward` rule will pick the latest version available on the machine. It's up to the user to update their SDK to the version they want in case there is an update and we don't want to force them into a newer version in case they can't install it. - [ ] Update `src/OrchardCore.Build/TargetFrameworks.props`. - [ ] Add a custom `AspNetCorePackagesVersion` for each TFM in `Directory.Packages.props` -- [ ] Update all `uses: actions/setup-dotnet` tasks to the required SDK version. +- [ ] Update `.github/actions/setup-dotnet/action.yml` to the required SDK versions. If dual targeting frameworks, add both, e.g.: +```yaml +dotnet-version: | + 8.0.x + 9.0.x +``` - [ ] Update all `dotnet publish`, `dotnet build` and `dotnet test` calls to the latest TFM, if specified. - [ ] Update all `tasks.json` files to target the latest TFM - [ ] Update the list of template **choices** (see the `template.json` files). diff --git a/.github/actions/setup-dotnet/action.yml b/.github/actions/setup-dotnet/action.yml new file mode 100644 index 00000000000..db1d5ee46a1 --- /dev/null +++ b/.github/actions/setup-dotnet/action.yml @@ -0,0 +1,12 @@ +name: Set Up .NET +description: Centralized actions/setup-dotnet for easier updates. + +runs: + using: composite + steps: + - name: Set Up .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 8.0.x + 9.0.x diff --git a/.github/workflows/assets_validation.yml b/.github/workflows/assets_validation.yml index 8a9eeb0e3b9..06812e4026a 100644 --- a/.github/workflows/assets_validation.yml +++ b/.github/workflows/assets_validation.yml @@ -19,7 +19,7 @@ concurrency: jobs: test-npm-build: name: Test building assets - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - name: Rebuild packages diff --git a/.github/workflows/close_stale_prs_issues.yml b/.github/workflows/close_stale_prs_issues.yml index 02cad5d508f..738727d39c8 100644 --- a/.github/workflows/close_stale_prs_issues.yml +++ b/.github/workflows/close_stale_prs_issues.yml @@ -11,7 +11,7 @@ on: jobs: close-stale-prs-issues: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/stale@v9 with: diff --git a/.github/workflows/comment_issue_on_triage.yml b/.github/workflows/comment_issue_on_triage.yml index 6992d6bc0ef..f492364f4d5 100644 --- a/.github/workflows/comment_issue_on_triage.yml +++ b/.github/workflows/comment_issue_on_triage.yml @@ -9,7 +9,7 @@ on: jobs: comment-issue-on-triage: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 permissions: issues: write # Despite the trigger being called "issues", this would still run for setting the milestone of PRs too. diff --git a/.github/workflows/community_metrics.yml b/.github/workflows/community_metrics.yml index 94e16559ec7..488e3dd5fe5 100644 --- a/.github/workflows/community_metrics.yml +++ b/.github/workflows/community_metrics.yml @@ -12,7 +12,7 @@ permissions: jobs: generate-community-metrics: name: Generate Community Metrics - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Get Dates For Last Month shell: pwsh diff --git a/.github/workflows/contributor_map.yml b/.github/workflows/contributor_map.yml index 45cfe59a48a..9df0b06cbfb 100644 --- a/.github/workflows/contributor_map.yml +++ b/.github/workflows/contributor_map.yml @@ -9,7 +9,7 @@ on: jobs: update-contributor-map: name: Update Contributor Map - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Update Contributor Map diff --git a/.github/workflows/docs_validation.yml b/.github/workflows/docs_validation.yml index f9eba0c6ed0..099c3bedd90 100644 --- a/.github/workflows/docs_validation.yml +++ b/.github/workflows/docs_validation.yml @@ -20,7 +20,7 @@ concurrency: jobs: validate-building-documentation: name: Validating Building the Documentation - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 with: @@ -28,10 +28,7 @@ jobs: fetch-depth: 0 - name: Install Dependencies - # Installing pip v22.0.3 is only necessary because unbuntu-latest runners include v22.0.2, which has a bug. That - # line can be removed once the runners are updated, see https://github.com/actions/runner-images?tab=readme-ov-file#available-images. run: | - python -m pip install pip==22.0.3 pip install -r src/docs/requirements.txt -v - name: Build Documentation diff --git a/.github/workflows/first_time_contributor.yml b/.github/workflows/first_time_contributor.yml index 7846cd76455..021e5078371 100644 --- a/.github/workflows/first_time_contributor.yml +++ b/.github/workflows/first_time_contributor.yml @@ -8,7 +8,7 @@ on: jobs: first-time-contributor-welcome: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: # We don't use the actions/first-interaction action because it can't reference the author, nor can it comment after # PR merge. diff --git a/.github/workflows/functional_all_db.yml b/.github/workflows/functional_all_db.yml index 8577c53e291..0d517b9a18d 100644 --- a/.github/workflows/functional_all_db.yml +++ b/.github/workflows/functional_all_db.yml @@ -29,15 +29,12 @@ jobs: github.event_name == 'push' || github.event.review.state == 'APPROVED' || github.event.review.state == 'CHANGES_REQUESTED' - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 container: image: cypress/included:13.17.0 steps: - uses: actions/checkout@v4 - # We need to install dotnet in the docker container. - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '9.0.x' + - uses: ./.github/actions/setup-dotnet - uses: actions/setup-node@v4 with: node-version: "15" @@ -59,17 +56,14 @@ jobs: github.event_name == 'push' || github.event.review.state == 'APPROVED' || github.event.review.state == 'CHANGES_REQUESTED' - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 container: image: cypress/included:13.17.0 env: OrchardCore__OrchardCore_YesSql__EnableThreadSafetyChecks: true steps: - uses: actions/checkout@v4 - # We need to install dotnet in the docker container. - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '9.0.x' + - uses: ./.github/actions/setup-dotnet - name: Functional Tests run: | cd test/OrchardCore.Tests.Functional @@ -90,7 +84,7 @@ jobs: github.event_name == 'push' || github.event.review.state == 'APPROVED' || github.event.review.state == 'CHANGES_REQUESTED' - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 container: image: cypress/included:13.17.0 services: @@ -112,10 +106,7 @@ jobs: OrchardCore__OrchardCore_YesSql__EnableThreadSafetyChecks: true steps: - uses: actions/checkout@v4 - # We need to install dotnet in the docker container. - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '9.0.x' + - uses: ./.github/actions/setup-dotnet - name: Functional Tests run: | cd test/OrchardCore.Tests.Functional @@ -136,7 +127,7 @@ jobs: github.event_name == 'push' || github.event.review.state == 'APPROVED' || github.event.review.state == 'CHANGES_REQUESTED' - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 container: image: cypress/included:13.17.0 services: @@ -154,10 +145,7 @@ jobs: OrchardCore__OrchardCore_YesSql__EnableThreadSafetyChecks: true steps: - uses: actions/checkout@v4 - # We need to install dotnet in the docker container. - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '9.0.x' + - uses: ./.github/actions/setup-dotnet - name: Functional Tests run: | cd test/OrchardCore.Tests.Functional @@ -178,7 +166,7 @@ jobs: github.event_name == 'push' || github.event.review.state == 'APPROVED' || github.event.review.state == 'CHANGES_REQUESTED' - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 container: image: cypress/included:13.17.0 services: @@ -195,10 +183,7 @@ jobs: OrchardCore__OrchardCore_YesSql__EnableThreadSafetyChecks: true steps: - uses: actions/checkout@v4 - # We need to install dotnet in the docker container. - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '9.0.x' + - uses: ./.github/actions/setup-dotnet - name: Functional Tests run: | cd test/OrchardCore.Tests.Functional diff --git a/.github/workflows/mac_unit_test_ci.yml b/.github/workflows/mac_unit_test_ci.yml index 2f13ed95576..82fc4354b5a 100644 --- a/.github/workflows/mac_unit_test_ci.yml +++ b/.github/workflows/mac_unit_test_ci.yml @@ -1,6 +1,6 @@ name: Unit Tests - MacOS on: -# manual trigger + # manual trigger workflow_dispatch: env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true @@ -11,9 +11,7 @@ jobs: name: Unit Tests steps: - uses: actions/checkout@v4 - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '9.0.x' + - uses: ./.github/actions/setup-dotnet - name: Build and test run: | dotnet build -c Release /p:TreatWarningsAsErrors=true /p:RunAnalyzers=true diff --git a/.github/workflows/main_ci.yml b/.github/workflows/main_ci.yml index bd1a1115c85..f6a61fe880c 100644 --- a/.github/workflows/main_ci.yml +++ b/.github/workflows/main_ci.yml @@ -21,15 +21,13 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-22.04, windows-latest] + os: [ubuntu-24.04, windows-2022] steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: "15" - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '9.0.x' + - uses: ./.github/actions/setup-dotnet - name: Build # See pr_ci.yml for the reason why we disable NuGet audit warnings. run: | @@ -38,14 +36,14 @@ jobs: run: | dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj - name: Functional Tests - if: matrix.os == 'ubuntu-22.04' + if: matrix.os == 'ubuntu-24.04' run: | cd test/OrchardCore.Tests.Functional npm install npm run cms:test npm run mvc:test - uses: actions/upload-artifact@v4 - if: matrix.os == 'ubuntu-22.04' && failure() + if: matrix.os == 'ubuntu-24.04' && failure() with: name: Functional Test failure path: | diff --git a/.github/workflows/pr_ci.yml b/.github/workflows/pr_ci.yml index 711a79889ca..12ffbd37e39 100644 --- a/.github/workflows/pr_ci.yml +++ b/.github/workflows/pr_ci.yml @@ -14,16 +14,14 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-22.04, windows-latest] + os: [ubuntu-24.04, windows-2022] name: Build & Test steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: "15" - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '9.0.x' + - uses: ./.github/actions/setup-dotnet - name: Build # We disable NuGet audit warnings, see https://learn.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu1901-nu1904. # Security issues being discovered in NuGet packages we use can happen at any time, and thus all our CI builds that @@ -35,14 +33,14 @@ jobs: run: | dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj - name: Functional Tests - if: matrix.os == 'ubuntu-22.04' + if: matrix.os == 'ubuntu-24.04' run: | cd test/OrchardCore.Tests.Functional npm install npm run cms:test npm run mvc:test - uses: actions/upload-artifact@v4 - if: matrix.os == 'ubuntu-22.04' && failure() + if: matrix.os == 'ubuntu-24.04' && failure() with: name: functional-test-failure path: | diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index 1f3049a8ca5..a4e235ed170 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -9,7 +9,7 @@ env: DOTNET_CLI_TELEMETRY_OPTOUT: true jobs: test: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 name: Build, Test, Deploy steps: - uses: actions/checkout@v4 @@ -25,10 +25,8 @@ jobs: if: steps.check-publish.outputs.should-publish == 'true' with: node-version: "15" - - uses: actions/setup-dotnet@v4 + - uses: ./.github/actions/setup-dotnet if: steps.check-publish.outputs.should-publish == 'true' - with: - dotnet-version: '9.0.x' - name: Set build number if: steps.check-publish.outputs.should-publish == 'true' run: echo "BuildNumber=$(( $GITHUB_RUN_NUMBER + 16368 ))" >> $GITHUB_ENV diff --git a/.github/workflows/release_ci.yml b/.github/workflows/release_ci.yml index 9757d3cc4d7..385946de1ef 100644 --- a/.github/workflows/release_ci.yml +++ b/.github/workflows/release_ci.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-22.04, windows-latest] + os: [ubuntu-24.04, windows-2022] steps: - name: Get the version id: get_version @@ -33,11 +33,9 @@ jobs: - uses: actions/setup-node@v4 with: node-version: "15" - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '9.0.x' + - uses: ./.github/actions/setup-dotnet - name: Set build number - if: matrix.os == 'ubuntu-22.04' + if: matrix.os == 'ubuntu-24.04' run: echo "BuildNumber=$(( $GITHUB_RUN_NUMBER + 15471 ))" >> $GITHUB_ENV - name: Build # NuGetAudit is intentionally not disabled here like it is for other CI builds, because we need to address any @@ -48,35 +46,35 @@ jobs: run: | dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj - name: Functional Tests - if: matrix.os == 'ubuntu-22.04' + if: matrix.os == 'ubuntu-24.04' run: | cd test/OrchardCore.Tests.Functional npm install npm run cms:test npm run mvc:test - uses: actions/upload-artifact@v4 - if: matrix.os == 'ubuntu-22.04' && failure() + if: matrix.os == 'ubuntu-24.04' && failure() with: name: Functional Test failure path: | test/OrchardCore.Tests.Functional/cms-tests/cypress/screenshots src/OrchardCore.Cms.Web/App_Data_Tests/logs - name: Deploy release NuGet packages - if: matrix.os == 'ubuntu-22.04' + if: matrix.os == 'ubuntu-24.04' run: | dotnet pack -c Release --no-build -p:Version=${{ steps.get_version.outputs.VERSION }} -p:TreatWarningsAsErrors=false dotnet nuget push './src/**/*.nupkg' -t 600 -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json --skip-duplicate - name: Set up Docker Buildx - if: matrix.os == 'ubuntu-22.04' + if: matrix.os == 'ubuntu-24.04' uses: docker/setup-buildx-action@v3 - name: Login to DockerHub - if: matrix.os == 'ubuntu-22.04' + if: matrix.os == 'ubuntu-24.04' uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - name: Deploy release docker images - if: matrix.os == 'ubuntu-22.04' + if: matrix.os == 'ubuntu-24.04' shell: pwsh run: | Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false diff --git a/.github/workflows/validate_pr.yml b/.github/workflows/validate_pr.yml index 77809155ef5..83cc7a8aca4 100644 --- a/.github/workflows/validate_pr.yml +++ b/.github/workflows/validate_pr.yml @@ -8,7 +8,7 @@ on: jobs: validate-pull-request: name: Validate Pull Request - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 timeout-minutes: 3 steps: - name: Check for Merge Conflict in PR