Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publishing preview packages daily (Lombiq Technologies: OCORE-151) #15552

Merged
merged 31 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
5d78be0
Separate GHA workflow for building the preview packages
Piedone Mar 19, 2024
5e12f87
Making the workflow run only when new commits are found
Piedone Mar 19, 2024
270ec78
Debug output
Piedone Mar 19, 2024
cf30aeb
Temporarily removing the rest of the workflow for testing
Piedone Mar 19, 2024
80ba4e1
Temporarily also running workflow on push
Piedone Mar 19, 2024
a45ba9a
Or rather for PRs
Piedone Mar 19, 2024
820e0c8
Temporary test check
Piedone Mar 19, 2024
e2178ce
Reverting temporary changes
Piedone Mar 19, 2024
4d3a93d
Temporarily running most of the preview workflow
Piedone Mar 19, 2024
642ffc4
Docs
Piedone Mar 19, 2024
9ebee7f
Revert "Temporarily running most of the preview workflow"
Piedone Mar 19, 2024
ec369c2
Grammar
Piedone Mar 19, 2024
62c54d4
Re-adding missing condition for the Functional Test failure step
Piedone Mar 19, 2024
46b925d
Re-adding functional test failure artifact upload
Piedone Mar 19, 2024
b354260
Root Readme branch reference formatting
Piedone Mar 19, 2024
283b58d
No need for a fetch-depth of 50 for the checkout
Piedone Mar 21, 2024
b78560b
Better condition handling
Piedone Mar 21, 2024
9e1da8e
Temporarily disabling most steps
Piedone Mar 21, 2024
83bb7ca
Temporarily running for PRs too
Piedone Mar 21, 2024
f7ba708
Fixing condition
Piedone Mar 21, 2024
de71483
Testing condition
Piedone Mar 21, 2024
a73fc5f
Reverting temporary changes
Piedone Mar 21, 2024
437d53d
Revert "Reverting temporary changes"
Piedone Mar 21, 2024
74ec940
Better conditions
Piedone Mar 21, 2024
82204ff
PS syntax
Piedone Mar 21, 2024
be10429
Fixing conditions
Piedone Mar 21, 2024
8c5f48b
Fixing conditions
Piedone Mar 21, 2024
77ab855
Restoring correct event condition
Piedone Mar 21, 2024
aad62b7
Fixing conditions
Piedone Mar 21, 2024
f52399b
Test condition
Piedone Mar 21, 2024
849bf2a
Reverting temporary changes
Piedone Mar 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/main_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
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
- 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
52 changes: 30 additions & 22 deletions .github/workflows/preview_ci.yml
Original file line number Diff line number Diff line change
@@ -1,69 +1,77 @@
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
MikeAlhayek marked this conversation as resolved.
Show resolved Hide resolved
name: Build, Test, Deploy
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why any number if not 1? I assume a single commit existence should trigger the build? So if any option is passed maybe 1? (I do that in CI builds for benchmarks to speed-up the clones).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it doesn't need to be. I was thinking wrong. 1 is the default anyway.

- name: Check for new commits
id: check-commits
shell: pwsh
run: |
$commitCount = (git log --oneline --since '24 hours ago' | Measure-Object -Line).Lines
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there are no commits in the span then the response is empty, so maybe easier to check for that.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't there a way to just stop the workflow altogether in one step?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in an analogous way to C#'s return. This is the only way to skip steps conditionally, use a single job, and make the workflow succeed even if the steps were skipped (which I think should happen; the run was successful, even if we didn't need to publish).

Alternatives:

  • Having a separate job that produces a true/false, and then make the second job depend on that. This is what Miek did. The downside of this is that this check is a separate VM instance just for the script.
  • Canceling the workflow, like here. That would show the workflow as canceled when the condition wasn't met instead of succeeding.

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: matrix.os == 'ubuntu-latest'
- 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: matrix.os == 'ubuntu-latest'
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
if: matrix.os == 'ubuntu-latest' && failure()
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: matrix.os == 'ubuntu-latest'
- 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: matrix.os == 'ubuntu-latest'
if: steps.check-commits.outputs.commit-count > 0
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: matrix.os == 'ubuntu-latest'
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: matrix.os == 'ubuntu-latest'
- 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
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/)
Expand Down
8 changes: 4 additions & 4 deletions src/docs/getting-started/preview-package-source.md
Original file line number Diff line number Diff line change
@@ -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 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

Expand Down
Loading