From 5d78be0cf673574b41e1c961191da7281882fe7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Tue, 19 Mar 2024 20:53:25 +0100 Subject: [PATCH 01/31] Separate GHA workflow for building the preview packages --- .github/workflows/main_ci.yml | 40 ++++++++++++++++++++++++++++++++ .github/workflows/preview_ci.yml | 25 +++++--------------- 2 files changed, 46 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/main_ci.yml diff --git a/.github/workflows/main_ci.yml b/.github/workflows/main_ci.yml new file mode 100644 index 00000000000..5fb91bdcc72 --- /dev/null +++ b/.github/workflows/main_ci.yml @@ -0,0 +1,40 @@ +name: Main - CI +on: + push: + paths-ignore: + - '**/*.md' + - 'mkdocs.yml' + - 'src/docs/**/*' + branches: [ main ] +env: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + DOTNET_CLI_TELEMETRY_OPTOUT: true +jobs: + test: + runs-on: ${{ matrix.os }} + name: Build & Test + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: "15" + - uses: actions/setup-dotnet@v3 + with: + dotnet-version: '8.0.x' + - name: Build + run: | + dotnet build -c Release + - name: Unit Tests + run: | + dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj + - name: Functional Tests + if: matrix.os == 'ubuntu-latest' + run: | + cd test/OrchardCore.Tests.Functional + npm install + npm run cms:test + npm run mvc:test diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index 961d8bf9b9a..19db1363657 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -1,22 +1,16 @@ name: Preview - CI on: - push: - paths-ignore: - - '**/*.md' - - 'mkdocs.yml' - - 'src/docs/**/*' - branches: [ main ] + workflow_dispatch: + schedule: + # 4:19 AM UTC every day. A random time to avoid peak times of GitHub Actions. + - cron: '19 4 * * *' env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true DOTNET_CLI_TELEMETRY_OPTOUT: true jobs: test: - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest name: Build, Test, Deploy - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest] steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 @@ -26,7 +20,6 @@ jobs: with: dotnet-version: '8.0.x' - name: Set build number - if: matrix.os == 'ubuntu-latest' run: echo "BuildNumber=$(( $GITHUB_RUN_NUMBER + 16368 ))" >> $GITHUB_ENV - name: Build run: | @@ -35,35 +28,29 @@ jobs: run: | dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj - name: Functional Tests - if: matrix.os == 'ubuntu-latest' run: | cd test/OrchardCore.Tests.Functional npm install npm run cms:test npm run mvc:test - uses: actions/upload-artifact@v2 - if: matrix.os == 'ubuntu-latest' && 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 preview nuget packages - if: matrix.os == 'ubuntu-latest' + - name: Deploy preview NuGet packages run: | dotnet pack -c Release --no-build dotnet nuget push './src/**/*.nupkg' -t 600 -k ${{secrets.CLOUDSMITH_API_KEY}} -n -s https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json --skip-duplicate - name: Set up Docker Buildx - if: matrix.os == 'ubuntu-latest' uses: docker/setup-buildx-action@v3 - name: Login to DockerHub - if: matrix.os == 'ubuntu-latest' uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - name: Deploy preview docker images - if: matrix.os == 'ubuntu-latest' shell: pwsh run: | Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false From 5e12f873813a3a4c1b0d08fd2969663aee669d66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Tue, 19 Mar 2024 21:16:57 +0100 Subject: [PATCH 02/31] Making the workflow run only when new commits are found --- .github/workflows/preview_ci.yml | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index 19db1363657..798bd308fd0 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -12,22 +12,37 @@ jobs: runs-on: ubuntu-latest name: Build, Test, Deploy steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + with: + # Necessary to count commits below. We assume that no more than 50 commits are pushed in a day to main. + fetch-depth: 50 + - name: Check for new commits + id: check-commits + shell: pwsh + run: | + $commitCount = (git log --oneline --since '24 hours ago' | Measure-Object -Line).Lines + "commit-count=$commitCount" >> $Env:GITHUB_OUTPUT - uses: actions/setup-node@v3 + if: steps.check-commits.outputs.commit-count > 0 with: node-version: "15" - uses: actions/setup-dotnet@v3 + if: steps.check-commits.outputs.commit-count > 0 with: dotnet-version: '8.0.x' - - name: Set build number + - name: Set build number + if: steps.check-commits.outputs.commit-count > 0 run: echo "BuildNumber=$(( $GITHUB_RUN_NUMBER + 16368 ))" >> $GITHUB_ENV - name: Build + if: steps.check-commits.outputs.commit-count > 0 run: | dotnet build -c Release - name: Unit Tests + if: steps.check-commits.outputs.commit-count > 0 run: | dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj - name: Functional Tests + if: steps.check-commits.outputs.commit-count > 0 run: | cd test/OrchardCore.Tests.Functional npm install @@ -40,17 +55,21 @@ jobs: test/OrchardCore.Tests.Functional/cms-tests/cypress/screenshots src/OrchardCore.Cms.Web/App_Data_Tests/logs - name: Deploy preview NuGet packages + if: steps.check-commits.outputs.commit-count > 0 run: | dotnet pack -c Release --no-build dotnet nuget push './src/**/*.nupkg' -t 600 -k ${{secrets.CLOUDSMITH_API_KEY}} -n -s https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json --skip-duplicate - name: Set up Docker Buildx + if: steps.check-commits.outputs.commit-count > 0 uses: docker/setup-buildx-action@v3 - name: Login to DockerHub + if: steps.check-commits.outputs.commit-count > 0 uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - - name: Deploy preview docker images + - name: Deploy preview Docker images + if: steps.check-commits.outputs.commit-count > 0 shell: pwsh run: | Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false From 270ec7851a56407372a722d7b0cc8e1a1f9f0e67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Tue, 19 Mar 2024 21:17:50 +0100 Subject: [PATCH 03/31] Debug output --- .github/workflows/preview_ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index 798bd308fd0..ce5346d5db9 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -21,6 +21,7 @@ jobs: shell: pwsh run: | $commitCount = (git log --oneline --since '24 hours ago' | Measure-Object -Line).Lines + Write-Output "Count of new commits found in the last 24 hours: $commitCount." "commit-count=$commitCount" >> $Env:GITHUB_OUTPUT - uses: actions/setup-node@v3 if: steps.check-commits.outputs.commit-count > 0 From cf30aeb1de5bacd38fff16dfb894d10f9b546419 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Tue, 19 Mar 2024 21:18:39 +0100 Subject: [PATCH 04/31] Temporarily removing the rest of the workflow for testing --- .github/workflows/preview_ci.yml | 52 -------------------------------- 1 file changed, 52 deletions(-) diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index ce5346d5db9..a16a9ca0a0f 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -27,55 +27,3 @@ jobs: if: steps.check-commits.outputs.commit-count > 0 with: node-version: "15" - - uses: actions/setup-dotnet@v3 - if: steps.check-commits.outputs.commit-count > 0 - with: - dotnet-version: '8.0.x' - - name: Set build number - if: steps.check-commits.outputs.commit-count > 0 - run: echo "BuildNumber=$(( $GITHUB_RUN_NUMBER + 16368 ))" >> $GITHUB_ENV - - name: Build - if: steps.check-commits.outputs.commit-count > 0 - run: | - dotnet build -c Release - - name: Unit Tests - if: steps.check-commits.outputs.commit-count > 0 - run: | - dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj - - name: Functional Tests - if: steps.check-commits.outputs.commit-count > 0 - run: | - cd test/OrchardCore.Tests.Functional - npm install - npm run cms:test - npm run mvc:test - - uses: actions/upload-artifact@v2 - with: - name: Functional Test failure - path: | - test/OrchardCore.Tests.Functional/cms-tests/cypress/screenshots - src/OrchardCore.Cms.Web/App_Data_Tests/logs - - name: Deploy preview NuGet packages - if: steps.check-commits.outputs.commit-count > 0 - run: | - dotnet pack -c Release --no-build - dotnet nuget push './src/**/*.nupkg' -t 600 -k ${{secrets.CLOUDSMITH_API_KEY}} -n -s https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json --skip-duplicate - - name: Set up Docker Buildx - if: steps.check-commits.outputs.commit-count > 0 - uses: docker/setup-buildx-action@v3 - - name: Login to DockerHub - if: steps.check-commits.outputs.commit-count > 0 - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} - - name: Deploy preview Docker images - if: steps.check-commits.outputs.commit-count > 0 - shell: pwsh - run: | - Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false - Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data_Tests -Recurse | Remove-Item -Recurse -Confirm:$false - $output = [System.IO.Path]::GetFullPath("./.build/release") - dotnet publish -c Release --property:PublishDir=$output --no-build --framework net8.0 - docker buildx build -f Dockerfile-CI --platform=linux/amd64 -t orchardproject/orchardcore-cms-linux:dev --push . - docker buildx build -f Dockerfile-CI --platform=windows/amd64 -t orchardproject/orchardcore-cms-windows:dev --push . From 80ba4e1ef567acd6d1251cfba824f02edbb92ad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Tue, 19 Mar 2024 21:20:54 +0100 Subject: [PATCH 05/31] Temporarily also running workflow on push --- .github/workflows/preview_ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index a16a9ca0a0f..e16f2319d3f 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -4,6 +4,7 @@ on: schedule: # 4:19 AM UTC every day. A random time to avoid peak times of GitHub Actions. - cron: '19 4 * * *' + push: env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true DOTNET_CLI_TELEMETRY_OPTOUT: true From a45ba9a22789282959ce71a7228ff483f3f47cce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Tue, 19 Mar 2024 21:22:03 +0100 Subject: [PATCH 06/31] Or rather for PRs --- .github/workflows/preview_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index e16f2319d3f..c56cb8ca316 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -4,7 +4,7 @@ on: schedule: # 4:19 AM UTC every day. A random time to avoid peak times of GitHub Actions. - cron: '19 4 * * *' - push: + pull_request: env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true DOTNET_CLI_TELEMETRY_OPTOUT: true From 820e0c8e547a144215f37130c60c0e7193c4f363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Tue, 19 Mar 2024 21:23:59 +0100 Subject: [PATCH 07/31] Temporary test check --- .github/workflows/preview_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index c56cb8ca316..41ebd205c66 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -25,6 +25,6 @@ jobs: Write-Output "Count of new commits found in the last 24 hours: $commitCount." "commit-count=$commitCount" >> $Env:GITHUB_OUTPUT - uses: actions/setup-node@v3 - if: steps.check-commits.outputs.commit-count > 0 + if: steps.check-commits.outputs.commit-count > 10 with: node-version: "15" From e2178ceffbc69061a9f7cf20479835f1172a4323 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Tue, 19 Mar 2024 21:25:32 +0100 Subject: [PATCH 08/31] Reverting temporary changes --- .github/workflows/preview_ci.yml | 55 ++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index 41ebd205c66..ce5346d5db9 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -4,7 +4,6 @@ on: schedule: # 4:19 AM UTC every day. A random time to avoid peak times of GitHub Actions. - cron: '19 4 * * *' - pull_request: env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true DOTNET_CLI_TELEMETRY_OPTOUT: true @@ -25,6 +24,58 @@ jobs: Write-Output "Count of new commits found in the last 24 hours: $commitCount." "commit-count=$commitCount" >> $Env:GITHUB_OUTPUT - uses: actions/setup-node@v3 - if: steps.check-commits.outputs.commit-count > 10 + if: steps.check-commits.outputs.commit-count > 0 with: node-version: "15" + - uses: actions/setup-dotnet@v3 + if: steps.check-commits.outputs.commit-count > 0 + with: + dotnet-version: '8.0.x' + - name: Set build number + if: steps.check-commits.outputs.commit-count > 0 + run: echo "BuildNumber=$(( $GITHUB_RUN_NUMBER + 16368 ))" >> $GITHUB_ENV + - name: Build + if: steps.check-commits.outputs.commit-count > 0 + run: | + dotnet build -c Release + - name: Unit Tests + if: steps.check-commits.outputs.commit-count > 0 + run: | + dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj + - name: Functional Tests + if: steps.check-commits.outputs.commit-count > 0 + run: | + cd test/OrchardCore.Tests.Functional + npm install + npm run cms:test + npm run mvc:test + - uses: actions/upload-artifact@v2 + with: + name: Functional Test failure + path: | + test/OrchardCore.Tests.Functional/cms-tests/cypress/screenshots + src/OrchardCore.Cms.Web/App_Data_Tests/logs + - name: Deploy preview NuGet packages + if: steps.check-commits.outputs.commit-count > 0 + run: | + dotnet pack -c Release --no-build + dotnet nuget push './src/**/*.nupkg' -t 600 -k ${{secrets.CLOUDSMITH_API_KEY}} -n -s https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json --skip-duplicate + - name: Set up Docker Buildx + if: steps.check-commits.outputs.commit-count > 0 + uses: docker/setup-buildx-action@v3 + - name: Login to DockerHub + if: steps.check-commits.outputs.commit-count > 0 + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + - name: Deploy preview Docker images + if: steps.check-commits.outputs.commit-count > 0 + shell: pwsh + run: | + Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false + Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data_Tests -Recurse | Remove-Item -Recurse -Confirm:$false + $output = [System.IO.Path]::GetFullPath("./.build/release") + dotnet publish -c Release --property:PublishDir=$output --no-build --framework net8.0 + docker buildx build -f Dockerfile-CI --platform=linux/amd64 -t orchardproject/orchardcore-cms-linux:dev --push . + docker buildx build -f Dockerfile-CI --platform=windows/amd64 -t orchardproject/orchardcore-cms-windows:dev --push . From 4d3a93de6d64b0ea6e7657d6e1fcfbff1cc78621 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Tue, 19 Mar 2024 21:29:12 +0100 Subject: [PATCH 09/31] Temporarily running most of the preview workflow --- .github/workflows/preview_ci.yml | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index ce5346d5db9..621877f5f82 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -4,6 +4,7 @@ on: schedule: # 4:19 AM UTC every day. A random time to avoid peak times of GitHub Actions. - cron: '19 4 * * *' + pull_request: env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true DOTNET_CLI_TELEMETRY_OPTOUT: true @@ -55,27 +56,3 @@ jobs: path: | test/OrchardCore.Tests.Functional/cms-tests/cypress/screenshots src/OrchardCore.Cms.Web/App_Data_Tests/logs - - name: Deploy preview NuGet packages - if: steps.check-commits.outputs.commit-count > 0 - run: | - dotnet pack -c Release --no-build - dotnet nuget push './src/**/*.nupkg' -t 600 -k ${{secrets.CLOUDSMITH_API_KEY}} -n -s https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json --skip-duplicate - - name: Set up Docker Buildx - if: steps.check-commits.outputs.commit-count > 0 - uses: docker/setup-buildx-action@v3 - - name: Login to DockerHub - if: steps.check-commits.outputs.commit-count > 0 - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} - - name: Deploy preview Docker images - if: steps.check-commits.outputs.commit-count > 0 - shell: pwsh - run: | - Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false - Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data_Tests -Recurse | Remove-Item -Recurse -Confirm:$false - $output = [System.IO.Path]::GetFullPath("./.build/release") - dotnet publish -c Release --property:PublishDir=$output --no-build --framework net8.0 - docker buildx build -f Dockerfile-CI --platform=linux/amd64 -t orchardproject/orchardcore-cms-linux:dev --push . - docker buildx build -f Dockerfile-CI --platform=windows/amd64 -t orchardproject/orchardcore-cms-windows:dev --push . From 642ffc44bcf60de37f383138da948c8a5b80a3e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Tue, 19 Mar 2024 21:40:38 +0100 Subject: [PATCH 10/31] Docs --- src/docs/getting-started/preview-package-source.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/docs/getting-started/preview-package-source.md b/src/docs/getting-started/preview-package-source.md index dcd1d5496d1..3ae52f447db 100644 --- a/src/docs/getting-started/preview-package-source.md +++ b/src/docs/getting-started/preview-package-source.md @@ -1,11 +1,11 @@ # Add preview package source -In this article, we are going to add a new package source pointing to the preview packages. -The preview packages are built each time some code is committed on the `dev` branch, compared to the ones on NuGet, built from the `master` branch. -They are the most up to date versions but not the most stable and can contain breaking changes. +In this article, we are going to add a new package source pointing to the preview packages. The preview packages are built every day from the latest code on the `main` branch and published to [Cloudsmith](https://cloudsmith.io/~orchardcore/repos/preview/packages/). Release packages are published to NuGet, built from code corresponding to that release's version tag. + +The preview packages are the most up to date versions but not the most stable and can contain breaking changes. Only use them if you want to work with the latest development version of Orchard Core, e.g. to try out a fix for a bug you reported. !!! warning - We do not suggest you to use the dev packages in production. + We do not suggest you to use the preview packages in production. Preview packages are not kept forever, and there's no guarantee on how long a given preview package will be available. (You can assume something like 1-1.5 months, but then again, there's no guarantee.) ## Adding Orchard Core preview Feed to Visual Studio From 9ebee7f6de2ab4a64674eebe9ffa8ae9f1e0d7a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Tue, 19 Mar 2024 21:40:43 +0100 Subject: [PATCH 11/31] Revert "Temporarily running most of the preview workflow" This reverts commit 4d3a93de6d64b0ea6e7657d6e1fcfbff1cc78621. --- .github/workflows/preview_ci.yml | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index 621877f5f82..ce5346d5db9 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -4,7 +4,6 @@ on: schedule: # 4:19 AM UTC every day. A random time to avoid peak times of GitHub Actions. - cron: '19 4 * * *' - pull_request: env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true DOTNET_CLI_TELEMETRY_OPTOUT: true @@ -56,3 +55,27 @@ jobs: path: | test/OrchardCore.Tests.Functional/cms-tests/cypress/screenshots src/OrchardCore.Cms.Web/App_Data_Tests/logs + - name: Deploy preview NuGet packages + if: steps.check-commits.outputs.commit-count > 0 + run: | + dotnet pack -c Release --no-build + dotnet nuget push './src/**/*.nupkg' -t 600 -k ${{secrets.CLOUDSMITH_API_KEY}} -n -s https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json --skip-duplicate + - name: Set up Docker Buildx + if: steps.check-commits.outputs.commit-count > 0 + uses: docker/setup-buildx-action@v3 + - name: Login to DockerHub + if: steps.check-commits.outputs.commit-count > 0 + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + - name: Deploy preview Docker images + if: steps.check-commits.outputs.commit-count > 0 + shell: pwsh + run: | + Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false + Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data_Tests -Recurse | Remove-Item -Recurse -Confirm:$false + $output = [System.IO.Path]::GetFullPath("./.build/release") + dotnet publish -c Release --property:PublishDir=$output --no-build --framework net8.0 + docker buildx build -f Dockerfile-CI --platform=linux/amd64 -t orchardproject/orchardcore-cms-linux:dev --push . + docker buildx build -f Dockerfile-CI --platform=windows/amd64 -t orchardproject/orchardcore-cms-windows:dev --push . From ec369c2340551be69dabd53f34b6ed4053afb480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Tue, 19 Mar 2024 21:48:53 +0100 Subject: [PATCH 12/31] Grammar --- src/docs/getting-started/preview-package-source.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/docs/getting-started/preview-package-source.md b/src/docs/getting-started/preview-package-source.md index 3ae52f447db..3c7d12e6da2 100644 --- a/src/docs/getting-started/preview-package-source.md +++ b/src/docs/getting-started/preview-package-source.md @@ -2,10 +2,10 @@ In this article, we are going to add a new package source pointing to the preview packages. The preview packages are built every day from the latest code on the `main` branch and published to [Cloudsmith](https://cloudsmith.io/~orchardcore/repos/preview/packages/). Release packages are published to NuGet, built from code corresponding to that release's version tag. -The preview packages are the most up to date versions but not the most stable and can contain breaking changes. Only use them if you want to work with the latest development version of Orchard Core, e.g. to try out a fix for a bug you reported. +The preview packages are the most up-to-date versions but not the most stable and can contain breaking changes. Only use them if you want to work with the latest development version of Orchard Core, e.g. to try out a fix for a bug you reported. !!! warning - We do not suggest you to use the preview packages in production. Preview packages are not kept forever, and there's no guarantee on how long a given preview package will be available. (You can assume something like 1-1.5 months, but then again, there's no guarantee.) + We do not suggest you use the preview packages in production. Preview packages are not kept forever, and there's no guarantee on how long a given preview package will be available. (You can assume something like 1-1.5 months, but then again, there's no guarantee.) ## Adding Orchard Core preview Feed to Visual Studio From 62c54d4ed73c78fdebc5a4c4e3f2872e27caa873 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Tue, 19 Mar 2024 22:27:03 +0100 Subject: [PATCH 13/31] Re-adding missing condition for the Functional Test failure step --- .github/workflows/preview_ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index ce5346d5db9..5d410e7d772 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -50,6 +50,7 @@ jobs: npm run cms:test npm run mvc:test - uses: actions/upload-artifact@v2 + if: failure() with: name: Functional Test failure path: | From 46b925d17b19c5db52cfd2d9b5a4b90a5dd76cef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Wed, 20 Mar 2024 00:32:32 +0100 Subject: [PATCH 14/31] Re-adding functional test failure artifact upload --- .github/workflows/main_ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/main_ci.yml b/.github/workflows/main_ci.yml index 5fb91bdcc72..ca8bc847223 100644 --- a/.github/workflows/main_ci.yml +++ b/.github/workflows/main_ci.yml @@ -38,3 +38,10 @@ jobs: npm install npm run cms:test npm run mvc:test + - uses: actions/upload-artifact@v2 + if: matrix.os == 'ubuntu-latest' && failure() + with: + name: Functional Test failure + path: | + test/OrchardCore.Tests.Functional/cms-tests/cypress/screenshots + src/OrchardCore.Cms.Web/App_Data_Tests/logs From b35426041ebb35601cc7d64dba82b4a088dfaacc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Wed, 20 Mar 2024 00:39:39 +0100 Subject: [PATCH 15/31] Root Readme branch reference formatting --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 779d6ed855b..3affe32fc33 100644 --- a/README.md +++ b/README.md @@ -12,12 +12,12 @@ Orchard Core consists of two distinct projects: ## Build Status -Stable (release/1.8.2): +Stable (`release/1.8.2`): [![Build status](https://github.com/OrchardCMS/OrchardCore/actions/workflows/release_ci.yml/badge.svg)](https://github.com/OrchardCMS/OrchardCore/actions?query=workflow%3A%22Release+-+CI%22) [![NuGet](https://img.shields.io/nuget/v/OrchardCore.Application.Cms.Targets.svg)](https://www.nuget.org/packages/OrchardCore.Application.Cms.Targets) -Nightly (main): +Nightly (`main`): [![Build status](https://github.com/OrchardCMS/OrchardCore/actions/workflows/preview_ci.yml/badge.svg)](https://github.com/OrchardCMS/OrchardCore/actions?query=workflow%3A%22Preview+-+CI%22) [![Cloudsmith](https://api-prd.cloudsmith.io/badges/version/orchardcore/preview/nuget/OrchardCore.Application.Cms.Targets/latest/x/?render=true&badge_token=gAAAAABey9hKFD_C-ZIpLvayS3HDsIjIorQluDs53KjIdlxoDz6Ntt1TzvMNJp7a_UWvQbsfN5nS7_0IbxCyqHZsjhmZP6cBkKforo-NqwrH5-E6QCrJ3D8%3D)](https://cloudsmith.io/~orchardcore/repos/preview/packages/detail/nuget/OrchardCore.Application.Cms.Targets/latest/) From 283b58dc4fbe7bb79eb9c4fce4db47cf157b0beb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Thu, 21 Mar 2024 01:21:40 +0100 Subject: [PATCH 16/31] No need for a fetch-depth of 50 for the checkout --- .github/workflows/preview_ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index 5d410e7d772..9c19128f7da 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -13,9 +13,6 @@ jobs: name: Build, Test, Deploy steps: - uses: actions/checkout@v4 - with: - # Necessary to count commits below. We assume that no more than 50 commits are pushed in a day to main. - fetch-depth: 50 - name: Check for new commits id: check-commits shell: pwsh From b78560b4dc3390db003c6aa72c74503e5930442a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Thu, 21 Mar 2024 01:22:27 +0100 Subject: [PATCH 17/31] Better condition handling --- .github/workflows/preview_ci.yml | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index 9c19128f7da..47f97fdfe35 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -14,33 +14,34 @@ jobs: steps: - uses: actions/checkout@v4 - name: Check for new commits + if: ${{ github.event_name == 'schedule' }} id: check-commits shell: pwsh run: | - $commitCount = (git log --oneline --since '24 hours ago' | Measure-Object -Line).Lines - Write-Output "Count of new commits found in the last 24 hours: $commitCount." - "commit-count=$commitCount" >> $Env:GITHUB_OUTPUT + $hasCommitFromLastDay = ![string]::IsNullOrEmpty((git log --oneline --since '24 hours ago')) + Write-Output "Commits found in the last 24 hours: $hasCommitFromLastDay." + "should-publish=$($hasCommitFromLastDay ? 'true' : 'false')" >> $Env:GITHUB_OUTPUT - uses: actions/setup-node@v3 - if: steps.check-commits.outputs.commit-count > 0 + if: steps.check-commits.outputs.should-publish with: node-version: "15" - uses: actions/setup-dotnet@v3 - if: steps.check-commits.outputs.commit-count > 0 + if: steps.check-commits.outputs.should-publish with: dotnet-version: '8.0.x' - name: Set build number - if: steps.check-commits.outputs.commit-count > 0 + if: steps.check-commits.outputs.should-publish run: echo "BuildNumber=$(( $GITHUB_RUN_NUMBER + 16368 ))" >> $GITHUB_ENV - name: Build - if: steps.check-commits.outputs.commit-count > 0 + if: steps.check-commits.outputs.should-publish run: | dotnet build -c Release - name: Unit Tests - if: steps.check-commits.outputs.commit-count > 0 + if: steps.check-commits.outputs.should-publish run: | dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj - name: Functional Tests - if: steps.check-commits.outputs.commit-count > 0 + if: steps.check-commits.outputs.should-publish run: | cd test/OrchardCore.Tests.Functional npm install @@ -54,21 +55,21 @@ jobs: test/OrchardCore.Tests.Functional/cms-tests/cypress/screenshots src/OrchardCore.Cms.Web/App_Data_Tests/logs - name: Deploy preview NuGet packages - if: steps.check-commits.outputs.commit-count > 0 + if: steps.check-commits.outputs.should-publish run: | dotnet pack -c Release --no-build dotnet nuget push './src/**/*.nupkg' -t 600 -k ${{secrets.CLOUDSMITH_API_KEY}} -n -s https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json --skip-duplicate - name: Set up Docker Buildx - if: steps.check-commits.outputs.commit-count > 0 + if: steps.check-commits.outputs.should-publish uses: docker/setup-buildx-action@v3 - name: Login to DockerHub - if: steps.check-commits.outputs.commit-count > 0 + if: steps.check-commits.outputs.should-publish uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - name: Deploy preview Docker images - if: steps.check-commits.outputs.commit-count > 0 + if: steps.check-commits.outputs.should-publish shell: pwsh run: | Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false From 9e1da8e9d3e6460d7fe30673e82090dca01cb1c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Thu, 21 Mar 2024 01:22:51 +0100 Subject: [PATCH 18/31] Temporarily disabling most steps --- .github/workflows/preview_ci.yml | 92 ++++++++++++++++---------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index 47f97fdfe35..e71eba77f25 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -32,49 +32,49 @@ jobs: - name: Set build number if: steps.check-commits.outputs.should-publish run: echo "BuildNumber=$(( $GITHUB_RUN_NUMBER + 16368 ))" >> $GITHUB_ENV - - name: Build - if: steps.check-commits.outputs.should-publish - run: | - dotnet build -c Release - - name: Unit Tests - if: steps.check-commits.outputs.should-publish - run: | - dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj - - name: Functional Tests - if: steps.check-commits.outputs.should-publish - run: | - cd test/OrchardCore.Tests.Functional - npm install - npm run cms:test - npm run mvc:test - - uses: actions/upload-artifact@v2 - if: 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 preview NuGet packages - if: steps.check-commits.outputs.should-publish - run: | - dotnet pack -c Release --no-build - dotnet nuget push './src/**/*.nupkg' -t 600 -k ${{secrets.CLOUDSMITH_API_KEY}} -n -s https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json --skip-duplicate - - name: Set up Docker Buildx - if: steps.check-commits.outputs.should-publish - uses: docker/setup-buildx-action@v3 - - name: Login to DockerHub - if: steps.check-commits.outputs.should-publish - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} - - name: Deploy preview Docker images - if: steps.check-commits.outputs.should-publish - shell: pwsh - run: | - Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false - Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data_Tests -Recurse | Remove-Item -Recurse -Confirm:$false - $output = [System.IO.Path]::GetFullPath("./.build/release") - dotnet publish -c Release --property:PublishDir=$output --no-build --framework net8.0 - docker buildx build -f Dockerfile-CI --platform=linux/amd64 -t orchardproject/orchardcore-cms-linux:dev --push . - docker buildx build -f Dockerfile-CI --platform=windows/amd64 -t orchardproject/orchardcore-cms-windows:dev --push . + # - name: Build + # if: steps.check-commits.outputs.should-publish + # run: | + # dotnet build -c Release + # - name: Unit Tests + # if: steps.check-commits.outputs.should-publish + # run: | + # dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj + # - name: Functional Tests + # if: steps.check-commits.outputs.should-publish + # run: | + # cd test/OrchardCore.Tests.Functional + # npm install + # npm run cms:test + # npm run mvc:test + # - uses: actions/upload-artifact@v2 + # if: 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 preview NuGet packages + # if: steps.check-commits.outputs.should-publish + # run: | + # dotnet pack -c Release --no-build + # dotnet nuget push './src/**/*.nupkg' -t 600 -k ${{secrets.CLOUDSMITH_API_KEY}} -n -s https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json --skip-duplicate + # - name: Set up Docker Buildx + # if: steps.check-commits.outputs.should-publish + # uses: docker/setup-buildx-action@v3 + # - name: Login to DockerHub + # if: steps.check-commits.outputs.should-publish + # uses: docker/login-action@v3 + # with: + # username: ${{ secrets.DOCKERHUB_USERNAME }} + # password: ${{ secrets.DOCKERHUB_PASSWORD }} + # - name: Deploy preview Docker images + # if: steps.check-commits.outputs.should-publish + # shell: pwsh + # run: | + # Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false + # Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data_Tests -Recurse | Remove-Item -Recurse -Confirm:$false + # $output = [System.IO.Path]::GetFullPath("./.build/release") + # dotnet publish -c Release --property:PublishDir=$output --no-build --framework net8.0 + # docker buildx build -f Dockerfile-CI --platform=linux/amd64 -t orchardproject/orchardcore-cms-linux:dev --push . + # docker buildx build -f Dockerfile-CI --platform=windows/amd64 -t orchardproject/orchardcore-cms-windows:dev --push . From 83bb7cada96b7e6e21b772c70e799ab989ab3ea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Thu, 21 Mar 2024 01:23:14 +0100 Subject: [PATCH 19/31] Temporarily running for PRs too --- .github/workflows/preview_ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index e71eba77f25..009691a987a 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -4,6 +4,7 @@ on: schedule: # 4:19 AM UTC every day. A random time to avoid peak times of GitHub Actions. - cron: '19 4 * * *' + pull_request: env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true DOTNET_CLI_TELEMETRY_OPTOUT: true From f7ba70862734656e1125248a0201b7e2261365ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Thu, 21 Mar 2024 01:25:33 +0100 Subject: [PATCH 20/31] Fixing condition --- .github/workflows/preview_ci.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index 009691a987a..751ecea7f80 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -23,26 +23,26 @@ jobs: Write-Output "Commits found in the last 24 hours: $hasCommitFromLastDay." "should-publish=$($hasCommitFromLastDay ? 'true' : 'false')" >> $Env:GITHUB_OUTPUT - uses: actions/setup-node@v3 - if: steps.check-commits.outputs.should-publish + if: steps.check-commits.outputs.should-publish != 'false' with: node-version: "15" - uses: actions/setup-dotnet@v3 - if: steps.check-commits.outputs.should-publish + if: steps.check-commits.outputs.should-publish != 'false' with: dotnet-version: '8.0.x' - name: Set build number - if: steps.check-commits.outputs.should-publish + if: steps.check-commits.outputs.should-publish != 'false' run: echo "BuildNumber=$(( $GITHUB_RUN_NUMBER + 16368 ))" >> $GITHUB_ENV # - name: Build - # if: steps.check-commits.outputs.should-publish + # if: steps.check-commits.outputs.should-publish != 'false' # run: | # dotnet build -c Release # - name: Unit Tests - # if: steps.check-commits.outputs.should-publish + # if: steps.check-commits.outputs.should-publish != 'false' # run: | # dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj # - name: Functional Tests - # if: steps.check-commits.outputs.should-publish + # if: steps.check-commits.outputs.should-publish != 'false' # run: | # cd test/OrchardCore.Tests.Functional # npm install @@ -56,21 +56,21 @@ jobs: # test/OrchardCore.Tests.Functional/cms-tests/cypress/screenshots # src/OrchardCore.Cms.Web/App_Data_Tests/logs # - name: Deploy preview NuGet packages - # if: steps.check-commits.outputs.should-publish + # if: steps.check-commits.outputs.should-publish != 'false' # run: | # dotnet pack -c Release --no-build # dotnet nuget push './src/**/*.nupkg' -t 600 -k ${{secrets.CLOUDSMITH_API_KEY}} -n -s https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json --skip-duplicate # - name: Set up Docker Buildx - # if: steps.check-commits.outputs.should-publish + # if: steps.check-commits.outputs.should-publish != 'false' # uses: docker/setup-buildx-action@v3 # - name: Login to DockerHub - # if: steps.check-commits.outputs.should-publish + # if: steps.check-commits.outputs.should-publish != 'false' # uses: docker/login-action@v3 # with: # username: ${{ secrets.DOCKERHUB_USERNAME }} # password: ${{ secrets.DOCKERHUB_PASSWORD }} # - name: Deploy preview Docker images - # if: steps.check-commits.outputs.should-publish + # if: steps.check-commits.outputs.should-publish != 'false' # shell: pwsh # run: | # Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false From de7148391eaec22ce003032d0148b4ba0b7da4e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Thu, 21 Mar 2024 01:26:45 +0100 Subject: [PATCH 21/31] Testing condition --- .github/workflows/preview_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index 751ecea7f80..1b0e127fbb6 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -15,7 +15,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Check for new commits - if: ${{ github.event_name == 'schedule' }} + if: ${{ github.event_name == 'pull_request' }} id: check-commits shell: pwsh run: | From a73fc5fb398c967ab6a7e1bbf252f69b9fcfd4ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Thu, 21 Mar 2024 01:28:14 +0100 Subject: [PATCH 22/31] Reverting temporary changes --- .github/workflows/preview_ci.yml | 95 ++++++++++++++++---------------- 1 file changed, 47 insertions(+), 48 deletions(-) diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index 1b0e127fbb6..687b8d27b0e 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -4,7 +4,6 @@ on: schedule: # 4:19 AM UTC every day. A random time to avoid peak times of GitHub Actions. - cron: '19 4 * * *' - pull_request: env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true DOTNET_CLI_TELEMETRY_OPTOUT: true @@ -15,7 +14,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Check for new commits - if: ${{ github.event_name == 'pull_request' }} + if: ${{ github.event_name == 'schedule' }} id: check-commits shell: pwsh run: | @@ -33,49 +32,49 @@ jobs: - name: Set build number if: steps.check-commits.outputs.should-publish != 'false' run: echo "BuildNumber=$(( $GITHUB_RUN_NUMBER + 16368 ))" >> $GITHUB_ENV - # - name: Build - # if: steps.check-commits.outputs.should-publish != 'false' - # run: | - # dotnet build -c Release - # - name: Unit Tests - # if: steps.check-commits.outputs.should-publish != 'false' - # run: | - # dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj - # - name: Functional Tests - # if: steps.check-commits.outputs.should-publish != 'false' - # run: | - # cd test/OrchardCore.Tests.Functional - # npm install - # npm run cms:test - # npm run mvc:test - # - uses: actions/upload-artifact@v2 - # if: 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 preview NuGet packages - # if: steps.check-commits.outputs.should-publish != 'false' - # run: | - # dotnet pack -c Release --no-build - # dotnet nuget push './src/**/*.nupkg' -t 600 -k ${{secrets.CLOUDSMITH_API_KEY}} -n -s https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json --skip-duplicate - # - name: Set up Docker Buildx - # if: steps.check-commits.outputs.should-publish != 'false' - # uses: docker/setup-buildx-action@v3 - # - name: Login to DockerHub - # if: steps.check-commits.outputs.should-publish != 'false' - # uses: docker/login-action@v3 - # with: - # username: ${{ secrets.DOCKERHUB_USERNAME }} - # password: ${{ secrets.DOCKERHUB_PASSWORD }} - # - name: Deploy preview Docker images - # if: steps.check-commits.outputs.should-publish != 'false' - # shell: pwsh - # run: | - # Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false - # Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data_Tests -Recurse | Remove-Item -Recurse -Confirm:$false - # $output = [System.IO.Path]::GetFullPath("./.build/release") - # dotnet publish -c Release --property:PublishDir=$output --no-build --framework net8.0 - # docker buildx build -f Dockerfile-CI --platform=linux/amd64 -t orchardproject/orchardcore-cms-linux:dev --push . - # docker buildx build -f Dockerfile-CI --platform=windows/amd64 -t orchardproject/orchardcore-cms-windows:dev --push . + - name: Build + if: steps.check-commits.outputs.should-publish != 'false' + run: | + dotnet build -c Release + - name: Unit Tests + if: steps.check-commits.outputs.should-publish != 'false' + run: | + dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj + - name: Functional Tests + if: steps.check-commits.outputs.should-publish != 'false' + run: | + cd test/OrchardCore.Tests.Functional + npm install + npm run cms:test + npm run mvc:test + - uses: actions/upload-artifact@v2 + if: 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 preview NuGet packages + if: steps.check-commits.outputs.should-publish != 'false' + run: | + dotnet pack -c Release --no-build + dotnet nuget push './src/**/*.nupkg' -t 600 -k ${{secrets.CLOUDSMITH_API_KEY}} -n -s https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json --skip-duplicate + - name: Set up Docker Buildx + if: steps.check-commits.outputs.should-publish != 'false' + uses: docker/setup-buildx-action@v3 + - name: Login to DockerHub + if: steps.check-commits.outputs.should-publish != 'false' + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + - name: Deploy preview Docker images + if: steps.check-commits.outputs.should-publish != 'false' + shell: pwsh + run: | + Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false + Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data_Tests -Recurse | Remove-Item -Recurse -Confirm:$false + $output = [System.IO.Path]::GetFullPath("./.build/release") + dotnet publish -c Release --property:PublishDir=$output --no-build --framework net8.0 + docker buildx build -f Dockerfile-CI --platform=linux/amd64 -t orchardproject/orchardcore-cms-linux:dev --push . + docker buildx build -f Dockerfile-CI --platform=windows/amd64 -t orchardproject/orchardcore-cms-windows:dev --push . From 437d53d00b2975a15abea3dc2a3f356387749e6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Thu, 21 Mar 2024 01:30:53 +0100 Subject: [PATCH 23/31] Revert "Reverting temporary changes" This reverts commit a73fc5fb398c967ab6a7e1bbf252f69b9fcfd4ed. --- .github/workflows/preview_ci.yml | 95 ++++++++++++++++---------------- 1 file changed, 48 insertions(+), 47 deletions(-) diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index 687b8d27b0e..1b0e127fbb6 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -4,6 +4,7 @@ on: schedule: # 4:19 AM UTC every day. A random time to avoid peak times of GitHub Actions. - cron: '19 4 * * *' + pull_request: env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true DOTNET_CLI_TELEMETRY_OPTOUT: true @@ -14,7 +15,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Check for new commits - if: ${{ github.event_name == 'schedule' }} + if: ${{ github.event_name == 'pull_request' }} id: check-commits shell: pwsh run: | @@ -32,49 +33,49 @@ jobs: - name: Set build number if: steps.check-commits.outputs.should-publish != 'false' run: echo "BuildNumber=$(( $GITHUB_RUN_NUMBER + 16368 ))" >> $GITHUB_ENV - - name: Build - if: steps.check-commits.outputs.should-publish != 'false' - run: | - dotnet build -c Release - - name: Unit Tests - if: steps.check-commits.outputs.should-publish != 'false' - run: | - dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj - - name: Functional Tests - if: steps.check-commits.outputs.should-publish != 'false' - run: | - cd test/OrchardCore.Tests.Functional - npm install - npm run cms:test - npm run mvc:test - - uses: actions/upload-artifact@v2 - if: 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 preview NuGet packages - if: steps.check-commits.outputs.should-publish != 'false' - run: | - dotnet pack -c Release --no-build - dotnet nuget push './src/**/*.nupkg' -t 600 -k ${{secrets.CLOUDSMITH_API_KEY}} -n -s https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json --skip-duplicate - - name: Set up Docker Buildx - if: steps.check-commits.outputs.should-publish != 'false' - uses: docker/setup-buildx-action@v3 - - name: Login to DockerHub - if: steps.check-commits.outputs.should-publish != 'false' - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} - - name: Deploy preview Docker images - if: steps.check-commits.outputs.should-publish != 'false' - shell: pwsh - run: | - Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false - Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data_Tests -Recurse | Remove-Item -Recurse -Confirm:$false - $output = [System.IO.Path]::GetFullPath("./.build/release") - dotnet publish -c Release --property:PublishDir=$output --no-build --framework net8.0 - docker buildx build -f Dockerfile-CI --platform=linux/amd64 -t orchardproject/orchardcore-cms-linux:dev --push . - docker buildx build -f Dockerfile-CI --platform=windows/amd64 -t orchardproject/orchardcore-cms-windows:dev --push . + # - name: Build + # if: steps.check-commits.outputs.should-publish != 'false' + # run: | + # dotnet build -c Release + # - name: Unit Tests + # if: steps.check-commits.outputs.should-publish != 'false' + # run: | + # dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj + # - name: Functional Tests + # if: steps.check-commits.outputs.should-publish != 'false' + # run: | + # cd test/OrchardCore.Tests.Functional + # npm install + # npm run cms:test + # npm run mvc:test + # - uses: actions/upload-artifact@v2 + # if: 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 preview NuGet packages + # if: steps.check-commits.outputs.should-publish != 'false' + # run: | + # dotnet pack -c Release --no-build + # dotnet nuget push './src/**/*.nupkg' -t 600 -k ${{secrets.CLOUDSMITH_API_KEY}} -n -s https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json --skip-duplicate + # - name: Set up Docker Buildx + # if: steps.check-commits.outputs.should-publish != 'false' + # uses: docker/setup-buildx-action@v3 + # - name: Login to DockerHub + # if: steps.check-commits.outputs.should-publish != 'false' + # uses: docker/login-action@v3 + # with: + # username: ${{ secrets.DOCKERHUB_USERNAME }} + # password: ${{ secrets.DOCKERHUB_PASSWORD }} + # - name: Deploy preview Docker images + # if: steps.check-commits.outputs.should-publish != 'false' + # shell: pwsh + # run: | + # Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false + # Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data_Tests -Recurse | Remove-Item -Recurse -Confirm:$false + # $output = [System.IO.Path]::GetFullPath("./.build/release") + # dotnet publish -c Release --property:PublishDir=$output --no-build --framework net8.0 + # docker buildx build -f Dockerfile-CI --platform=linux/amd64 -t orchardproject/orchardcore-cms-linux:dev --push . + # docker buildx build -f Dockerfile-CI --platform=windows/amd64 -t orchardproject/orchardcore-cms-windows:dev --push . From 74ec9401bb3040c0554961c745278255826c075c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Thu, 21 Mar 2024 01:33:44 +0100 Subject: [PATCH 24/31] Better conditions --- .github/workflows/preview_ci.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index 1b0e127fbb6..499f433ba11 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -14,35 +14,35 @@ jobs: name: Build, Test, Deploy steps: - uses: actions/checkout@v4 - - name: Check for new commits - if: ${{ github.event_name == 'pull_request' }} - id: check-commits + - name: Check if should publish + id: check-publish shell: pwsh run: | $hasCommitFromLastDay = ![string]::IsNullOrEmpty((git log --oneline --since '24 hours ago')) Write-Output "Commits found in the last 24 hours: $hasCommitFromLastDay." - "should-publish=$($hasCommitFromLastDay ? 'true' : 'false')" >> $Env:GITHUB_OUTPUT + $shouldPublish = $hasCommitFromLastDay -and '${{ github.event_name }}' == 'pull_request' + "should-publish=$($shouldPublish ? 'true' : 'false')" >> $Env:GITHUB_OUTPUT - uses: actions/setup-node@v3 - if: steps.check-commits.outputs.should-publish != 'false' + if: steps.check-publish.outputs.check-publish with: node-version: "15" - uses: actions/setup-dotnet@v3 - if: steps.check-commits.outputs.should-publish != 'false' + if: steps.check-publish.outputs.check-publish with: dotnet-version: '8.0.x' - name: Set build number - if: steps.check-commits.outputs.should-publish != 'false' + if: steps.check-publish.outputs.check-publish run: echo "BuildNumber=$(( $GITHUB_RUN_NUMBER + 16368 ))" >> $GITHUB_ENV # - name: Build - # if: steps.check-commits.outputs.should-publish != 'false' + # if: steps.check-publish.outputs.check-publish # run: | # dotnet build -c Release # - name: Unit Tests - # if: steps.check-commits.outputs.should-publish != 'false' + # if: steps.check-publish.outputs.check-publish # run: | # dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj # - name: Functional Tests - # if: steps.check-commits.outputs.should-publish != 'false' + # if: steps.check-publish.outputs.check-publish # run: | # cd test/OrchardCore.Tests.Functional # npm install @@ -56,21 +56,21 @@ jobs: # test/OrchardCore.Tests.Functional/cms-tests/cypress/screenshots # src/OrchardCore.Cms.Web/App_Data_Tests/logs # - name: Deploy preview NuGet packages - # if: steps.check-commits.outputs.should-publish != 'false' + # if: steps.check-publish.outputs.check-publish # run: | # dotnet pack -c Release --no-build # dotnet nuget push './src/**/*.nupkg' -t 600 -k ${{secrets.CLOUDSMITH_API_KEY}} -n -s https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json --skip-duplicate # - name: Set up Docker Buildx - # if: steps.check-commits.outputs.should-publish != 'false' + # if: steps.check-publish.outputs.check-publish # uses: docker/setup-buildx-action@v3 # - name: Login to DockerHub - # if: steps.check-commits.outputs.should-publish != 'false' + # if: steps.check-publish.outputs.check-publish # uses: docker/login-action@v3 # with: # username: ${{ secrets.DOCKERHUB_USERNAME }} # password: ${{ secrets.DOCKERHUB_PASSWORD }} # - name: Deploy preview Docker images - # if: steps.check-commits.outputs.should-publish != 'false' + # if: steps.check-publish.outputs.check-publish # shell: pwsh # run: | # Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false From 82204ff09d32b6a7a1b3257f3ac832049149b50f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Thu, 21 Mar 2024 01:35:47 +0100 Subject: [PATCH 25/31] PS syntax --- .github/workflows/preview_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index 499f433ba11..56b4ec46251 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -20,7 +20,7 @@ jobs: run: | $hasCommitFromLastDay = ![string]::IsNullOrEmpty((git log --oneline --since '24 hours ago')) Write-Output "Commits found in the last 24 hours: $hasCommitFromLastDay." - $shouldPublish = $hasCommitFromLastDay -and '${{ github.event_name }}' == 'pull_request' + $shouldPublish = $hasCommitFromLastDay -and '${{ github.event_name }}' -eq 'pull_request' "should-publish=$($shouldPublish ? 'true' : 'false')" >> $Env:GITHUB_OUTPUT - uses: actions/setup-node@v3 if: steps.check-publish.outputs.check-publish From be10429ebf540f98a36cdc52c9fa475e493aa837 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Thu, 21 Mar 2024 01:37:48 +0100 Subject: [PATCH 26/31] Fixing conditions --- .github/workflows/preview_ci.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index 56b4ec46251..69a16e0eb50 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -23,26 +23,26 @@ jobs: $shouldPublish = $hasCommitFromLastDay -and '${{ github.event_name }}' -eq 'pull_request' "should-publish=$($shouldPublish ? 'true' : 'false')" >> $Env:GITHUB_OUTPUT - uses: actions/setup-node@v3 - if: steps.check-publish.outputs.check-publish + if: steps.check-publish.outputs.check-publish == 'true' with: node-version: "15" - uses: actions/setup-dotnet@v3 - if: steps.check-publish.outputs.check-publish + if: steps.check-publish.outputs.check-publish == 'true' with: dotnet-version: '8.0.x' - name: Set build number - if: steps.check-publish.outputs.check-publish + if: steps.check-publish.outputs.check-publish == 'true' run: echo "BuildNumber=$(( $GITHUB_RUN_NUMBER + 16368 ))" >> $GITHUB_ENV # - name: Build - # if: steps.check-publish.outputs.check-publish + # if: steps.check-publish.outputs.check-publish == 'true' # run: | # dotnet build -c Release # - name: Unit Tests - # if: steps.check-publish.outputs.check-publish + # if: steps.check-publish.outputs.check-publish == 'true' # run: | # dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj # - name: Functional Tests - # if: steps.check-publish.outputs.check-publish + # if: steps.check-publish.outputs.check-publish == 'true' # run: | # cd test/OrchardCore.Tests.Functional # npm install @@ -56,21 +56,21 @@ jobs: # test/OrchardCore.Tests.Functional/cms-tests/cypress/screenshots # src/OrchardCore.Cms.Web/App_Data_Tests/logs # - name: Deploy preview NuGet packages - # if: steps.check-publish.outputs.check-publish + # if: steps.check-publish.outputs.check-publish == 'true' # run: | # dotnet pack -c Release --no-build # dotnet nuget push './src/**/*.nupkg' -t 600 -k ${{secrets.CLOUDSMITH_API_KEY}} -n -s https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json --skip-duplicate # - name: Set up Docker Buildx - # if: steps.check-publish.outputs.check-publish + # if: steps.check-publish.outputs.check-publish == 'true' # uses: docker/setup-buildx-action@v3 # - name: Login to DockerHub - # if: steps.check-publish.outputs.check-publish + # if: steps.check-publish.outputs.check-publish == 'true' # uses: docker/login-action@v3 # with: # username: ${{ secrets.DOCKERHUB_USERNAME }} # password: ${{ secrets.DOCKERHUB_PASSWORD }} # - name: Deploy preview Docker images - # if: steps.check-publish.outputs.check-publish + # if: steps.check-publish.outputs.check-publish == 'true' # shell: pwsh # run: | # Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false From 8c5f48bd8bee7236eecd87f9fa0587f3ac2fa5b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Thu, 21 Mar 2024 01:40:32 +0100 Subject: [PATCH 27/31] Fixing conditions --- .github/workflows/preview_ci.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index 69a16e0eb50..5e518862c8b 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -23,26 +23,26 @@ jobs: $shouldPublish = $hasCommitFromLastDay -and '${{ github.event_name }}' -eq 'pull_request' "should-publish=$($shouldPublish ? 'true' : 'false')" >> $Env:GITHUB_OUTPUT - uses: actions/setup-node@v3 - if: steps.check-publish.outputs.check-publish == 'true' + if: steps.check-publish.outputs.should-publish with: node-version: "15" - uses: actions/setup-dotnet@v3 - if: steps.check-publish.outputs.check-publish == 'true' + if: steps.check-publish.outputs.should-publish with: dotnet-version: '8.0.x' - name: Set build number - if: steps.check-publish.outputs.check-publish == 'true' + if: steps.check-publish.outputs.should-publish run: echo "BuildNumber=$(( $GITHUB_RUN_NUMBER + 16368 ))" >> $GITHUB_ENV # - name: Build - # if: steps.check-publish.outputs.check-publish == 'true' + # if: steps.check-publish.outputs.should-publish # run: | # dotnet build -c Release # - name: Unit Tests - # if: steps.check-publish.outputs.check-publish == 'true' + # if: steps.check-publish.outputs.should-publish # run: | # dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj # - name: Functional Tests - # if: steps.check-publish.outputs.check-publish == 'true' + # if: steps.check-publish.outputs.should-publish # run: | # cd test/OrchardCore.Tests.Functional # npm install @@ -56,21 +56,21 @@ jobs: # test/OrchardCore.Tests.Functional/cms-tests/cypress/screenshots # src/OrchardCore.Cms.Web/App_Data_Tests/logs # - name: Deploy preview NuGet packages - # if: steps.check-publish.outputs.check-publish == 'true' + # if: steps.check-publish.outputs.should-publish # run: | # dotnet pack -c Release --no-build # dotnet nuget push './src/**/*.nupkg' -t 600 -k ${{secrets.CLOUDSMITH_API_KEY}} -n -s https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json --skip-duplicate # - name: Set up Docker Buildx - # if: steps.check-publish.outputs.check-publish == 'true' + # if: steps.check-publish.outputs.should-publish # uses: docker/setup-buildx-action@v3 # - name: Login to DockerHub - # if: steps.check-publish.outputs.check-publish == 'true' + # if: steps.check-publish.outputs.should-publish # uses: docker/login-action@v3 # with: # username: ${{ secrets.DOCKERHUB_USERNAME }} # password: ${{ secrets.DOCKERHUB_PASSWORD }} # - name: Deploy preview Docker images - # if: steps.check-publish.outputs.check-publish == 'true' + # if: steps.check-publish.outputs.should-publish # shell: pwsh # run: | # Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false From 77ab8556e71fb39acc50b13213f1529cf55484ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Thu, 21 Mar 2024 01:42:38 +0100 Subject: [PATCH 28/31] Restoring correct event condition --- .github/workflows/preview_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index 5e518862c8b..c4651a29e64 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -20,7 +20,7 @@ jobs: run: | $hasCommitFromLastDay = ![string]::IsNullOrEmpty((git log --oneline --since '24 hours ago')) Write-Output "Commits found in the last 24 hours: $hasCommitFromLastDay." - $shouldPublish = $hasCommitFromLastDay -and '${{ github.event_name }}' -eq 'pull_request' + $shouldPublish = $hasCommitFromLastDay -and '${{ github.event_name }}' -eq 'schedule' "should-publish=$($shouldPublish ? 'true' : 'false')" >> $Env:GITHUB_OUTPUT - uses: actions/setup-node@v3 if: steps.check-publish.outputs.should-publish From aad62b789a689bb8ea6adc061cfc7f2febf92251 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Thu, 21 Mar 2024 01:47:56 +0100 Subject: [PATCH 29/31] Fixing conditions --- .github/workflows/preview_ci.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index c4651a29e64..bbf607a019b 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -23,26 +23,26 @@ jobs: $shouldPublish = $hasCommitFromLastDay -and '${{ github.event_name }}' -eq 'schedule' "should-publish=$($shouldPublish ? 'true' : 'false')" >> $Env:GITHUB_OUTPUT - uses: actions/setup-node@v3 - if: steps.check-publish.outputs.should-publish + if: steps.check-publish.outputs.should-publish == 'true' with: node-version: "15" - uses: actions/setup-dotnet@v3 - if: steps.check-publish.outputs.should-publish + if: steps.check-publish.outputs.should-publish == 'true' with: dotnet-version: '8.0.x' - name: Set build number - if: steps.check-publish.outputs.should-publish + if: steps.check-publish.outputs.should-publish == 'true' run: echo "BuildNumber=$(( $GITHUB_RUN_NUMBER + 16368 ))" >> $GITHUB_ENV # - name: Build - # if: steps.check-publish.outputs.should-publish + # if: steps.check-publish.outputs.should-publish == 'true' # run: | # dotnet build -c Release # - name: Unit Tests - # if: steps.check-publish.outputs.should-publish + # if: steps.check-publish.outputs.should-publish == 'true' # run: | # dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj # - name: Functional Tests - # if: steps.check-publish.outputs.should-publish + # if: steps.check-publish.outputs.should-publish == 'true' # run: | # cd test/OrchardCore.Tests.Functional # npm install @@ -56,21 +56,21 @@ jobs: # test/OrchardCore.Tests.Functional/cms-tests/cypress/screenshots # src/OrchardCore.Cms.Web/App_Data_Tests/logs # - name: Deploy preview NuGet packages - # if: steps.check-publish.outputs.should-publish + # if: steps.check-publish.outputs.should-publish == 'true' # run: | # dotnet pack -c Release --no-build # dotnet nuget push './src/**/*.nupkg' -t 600 -k ${{secrets.CLOUDSMITH_API_KEY}} -n -s https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json --skip-duplicate # - name: Set up Docker Buildx - # if: steps.check-publish.outputs.should-publish + # if: steps.check-publish.outputs.should-publish == 'true' # uses: docker/setup-buildx-action@v3 # - name: Login to DockerHub - # if: steps.check-publish.outputs.should-publish + # if: steps.check-publish.outputs.should-publish == 'true' # uses: docker/login-action@v3 # with: # username: ${{ secrets.DOCKERHUB_USERNAME }} # password: ${{ secrets.DOCKERHUB_PASSWORD }} # - name: Deploy preview Docker images - # if: steps.check-publish.outputs.should-publish + # if: steps.check-publish.outputs.should-publish == 'true' # shell: pwsh # run: | # Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false From f52399b3c3a2460e84c94c2dcaa28753503bace1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Thu, 21 Mar 2024 01:48:51 +0100 Subject: [PATCH 30/31] Test condition --- .github/workflows/preview_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index bbf607a019b..ce53c43f334 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -20,7 +20,7 @@ jobs: run: | $hasCommitFromLastDay = ![string]::IsNullOrEmpty((git log --oneline --since '24 hours ago')) Write-Output "Commits found in the last 24 hours: $hasCommitFromLastDay." - $shouldPublish = $hasCommitFromLastDay -and '${{ github.event_name }}' -eq 'schedule' + $shouldPublish = $hasCommitFromLastDay -and '${{ github.event_name }}' -eq 'pull_request' "should-publish=$($shouldPublish ? 'true' : 'false')" >> $Env:GITHUB_OUTPUT - uses: actions/setup-node@v3 if: steps.check-publish.outputs.should-publish == 'true' From 849bf2a54344ce171df304cb4b6557253da93994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Thu, 21 Mar 2024 01:49:32 +0100 Subject: [PATCH 31/31] Reverting temporary changes --- .github/workflows/preview_ci.yml | 95 ++++++++++++++++---------------- 1 file changed, 47 insertions(+), 48 deletions(-) diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml index ce53c43f334..fe25acb75b8 100644 --- a/.github/workflows/preview_ci.yml +++ b/.github/workflows/preview_ci.yml @@ -4,7 +4,6 @@ on: schedule: # 4:19 AM UTC every day. A random time to avoid peak times of GitHub Actions. - cron: '19 4 * * *' - pull_request: env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true DOTNET_CLI_TELEMETRY_OPTOUT: true @@ -20,7 +19,7 @@ jobs: run: | $hasCommitFromLastDay = ![string]::IsNullOrEmpty((git log --oneline --since '24 hours ago')) Write-Output "Commits found in the last 24 hours: $hasCommitFromLastDay." - $shouldPublish = $hasCommitFromLastDay -and '${{ github.event_name }}' -eq 'pull_request' + $shouldPublish = $hasCommitFromLastDay -and '${{ github.event_name }}' -eq 'schedule' "should-publish=$($shouldPublish ? 'true' : 'false')" >> $Env:GITHUB_OUTPUT - uses: actions/setup-node@v3 if: steps.check-publish.outputs.should-publish == 'true' @@ -33,49 +32,49 @@ jobs: - name: Set build number if: steps.check-publish.outputs.should-publish == 'true' run: echo "BuildNumber=$(( $GITHUB_RUN_NUMBER + 16368 ))" >> $GITHUB_ENV - # - name: Build - # if: steps.check-publish.outputs.should-publish == 'true' - # run: | - # dotnet build -c Release - # - name: Unit Tests - # if: steps.check-publish.outputs.should-publish == 'true' - # run: | - # dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj - # - name: Functional Tests - # if: steps.check-publish.outputs.should-publish == 'true' - # run: | - # cd test/OrchardCore.Tests.Functional - # npm install - # npm run cms:test - # npm run mvc:test - # - uses: actions/upload-artifact@v2 - # if: 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 preview NuGet packages - # if: steps.check-publish.outputs.should-publish == 'true' - # run: | - # dotnet pack -c Release --no-build - # dotnet nuget push './src/**/*.nupkg' -t 600 -k ${{secrets.CLOUDSMITH_API_KEY}} -n -s https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json --skip-duplicate - # - name: Set up Docker Buildx - # if: steps.check-publish.outputs.should-publish == 'true' - # uses: docker/setup-buildx-action@v3 - # - name: Login to DockerHub - # if: steps.check-publish.outputs.should-publish == 'true' - # uses: docker/login-action@v3 - # with: - # username: ${{ secrets.DOCKERHUB_USERNAME }} - # password: ${{ secrets.DOCKERHUB_PASSWORD }} - # - name: Deploy preview Docker images - # if: steps.check-publish.outputs.should-publish == 'true' - # shell: pwsh - # run: | - # Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false - # Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data_Tests -Recurse | Remove-Item -Recurse -Confirm:$false - # $output = [System.IO.Path]::GetFullPath("./.build/release") - # dotnet publish -c Release --property:PublishDir=$output --no-build --framework net8.0 - # docker buildx build -f Dockerfile-CI --platform=linux/amd64 -t orchardproject/orchardcore-cms-linux:dev --push . - # docker buildx build -f Dockerfile-CI --platform=windows/amd64 -t orchardproject/orchardcore-cms-windows:dev --push . + - name: Build + if: steps.check-publish.outputs.should-publish == 'true' + run: | + dotnet build -c Release + - name: Unit Tests + if: steps.check-publish.outputs.should-publish == 'true' + run: | + dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj + - name: Functional Tests + if: steps.check-publish.outputs.should-publish == 'true' + run: | + cd test/OrchardCore.Tests.Functional + npm install + npm run cms:test + npm run mvc:test + - uses: actions/upload-artifact@v2 + if: 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 preview NuGet packages + if: steps.check-publish.outputs.should-publish == 'true' + run: | + dotnet pack -c Release --no-build + dotnet nuget push './src/**/*.nupkg' -t 600 -k ${{secrets.CLOUDSMITH_API_KEY}} -n -s https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json --skip-duplicate + - name: Set up Docker Buildx + if: steps.check-publish.outputs.should-publish == 'true' + uses: docker/setup-buildx-action@v3 + - name: Login to DockerHub + if: steps.check-publish.outputs.should-publish == 'true' + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + - name: Deploy preview Docker images + if: steps.check-publish.outputs.should-publish == 'true' + shell: pwsh + run: | + Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false + Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data_Tests -Recurse | Remove-Item -Recurse -Confirm:$false + $output = [System.IO.Path]::GetFullPath("./.build/release") + dotnet publish -c Release --property:PublishDir=$output --no-build --framework net8.0 + docker buildx build -f Dockerfile-CI --platform=linux/amd64 -t orchardproject/orchardcore-cms-linux:dev --push . + docker buildx build -f Dockerfile-CI --platform=windows/amd64 -t orchardproject/orchardcore-cms-windows:dev --push .