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

GitHub Actions pr_ci.yml improvements #12589

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
b267b94
Add cache action for NuGet packages to pr_ci.yml
lahma Oct 8, 2022
0798c9d
try hard-linking
lahma Oct 8, 2022
b979ef1
no need to setup NET 6 or Node.JS which comes OOB
lahma Oct 8, 2022
e74d59f
trigger again
lahma Oct 8, 2022
ed265f6
remove commented items
lahma Oct 9, 2022
07a1820
tweaks
lahma Oct 15, 2022
9cee90c
add newline
lahma Oct 16, 2022
bbdb34b
test GNU tar
lahma Oct 16, 2022
9e421c8
remove latest hard-link additions
lahma Oct 16, 2022
41a4da6
use correct DOTNET_NOLOGO
lahma Oct 16, 2022
9b60b2f
remove verbosity
lahma Oct 16, 2022
5b83041
verbose again
lahma Oct 16, 2022
96d4720
tweaks
lahma Oct 16, 2022
48bb0dd
tweak cache rules
lahma Oct 16, 2022
992f14f
actual lock file usage, disable implicit sources
lahma Oct 16, 2022
b9dc6cf
cannot use lock files for cache key as they are not in the repo..
lahma Oct 16, 2022
f6fded4
better specificity for hashing
lahma Oct 16, 2022
a565a02
setup .net can take over minute even with v3 on windows
lahma Oct 16, 2022
b7d0be5
trigger
lahma Oct 16, 2022
bb202fc
try caching csproj.nuget.g.targets
lahma Oct 16, 2022
94ceec5
skip restore on cache hit
lahma Oct 16, 2022
87e5306
friendly name for cache
lahma Oct 16, 2022
70b99b7
move implicit skip to correct task
lahma Oct 16, 2022
1d77dfe
cleanup
lahma Oct 16, 2022
9557fa1
workaround for source root problem
lahma Oct 16, 2022
81fbd26
test cache invalidation
lahma Oct 16, 2022
c5bb2aa
remove restore verbosity
lahma Oct 16, 2022
b2ec3f9
no need for symbols, bring back .NET and Node setup tasks
lahma Oct 20, 2022
227b396
use public project references to reduce disk I/O from dependencies
lahma Oct 20, 2022
c77ac62
freaking YAML
lahma Oct 20, 2022
369190f
cleanup
lahma Oct 20, 2022
d948438
fix syntax
lahma Oct 20, 2022
9af8521
more specific cache key
lahma Oct 20, 2022
07eb291
force evaluate when cache hit fails
lahma Oct 20, 2022
f9ac261
change to use solution for restore again
lahma Oct 20, 2022
5a82c18
tweak cached items
lahma Oct 20, 2022
233f62a
test non-deterministic
lahma Oct 20, 2022
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
58 changes: 48 additions & 10 deletions .github/workflows/pr_ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: PR - CI
on:

on:
pull_request:
branches: [ main, release/** ]

env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_NOLOGO: true
Piedone marked this conversation as resolved.
Show resolved Hide resolved
DOTNET_CLI_TELEMETRY_OPTOUT: true

jobs:
build_test:
runs-on: ${{ matrix.os }}
Expand All @@ -14,32 +17,67 @@ jobs:
os: [ubuntu-latest, windows-latest]
name: Build & Test
steps:

- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "15"
- name: Setup .NET 6.0
name: Checkout source code

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "16"

# https://github.com/actions/cache/blob/main/workarounds.md#improving-cache-restore-performance-on-windowsusing-cross-os-caching
- if: ${{ runner.os == 'Windows' }}
name: Use GNU tar
shell: cmd
run: |
echo "Adding GNU tar to PATH"
echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"

# caching all generated nuget items so we don't need to call restore
- uses: actions/cache@v3
id: cache-nuget
name: Cached NuGet artifacts
with:
path: |
~/.nuget/packages
**/obj/project.*
**/obj/*.csproj.nuget.*
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json', '**/Dependencies.props', '**/Dependencies.AspNetCore.props', '**/Directory.Packages.props') }}
restore-keys: |
${{ runner.os }}-nuget-

- name: Restore
if: steps.cache-nuget.outputs.cache-hit != 'true'
run: |
dotnet restore /p:DisableImplicitNuGetFallbackFolder=true /p:DisableImplicitLibraryPacksFolder

- name: Build
run: |
dotnet build --configuration Release --framework net6.0
dotnet build -c Release --no-restore --framework net6.0 /p:IncludeSymbols=false /p:CreateHardLinksForCopyLocalIfPossible=true /p:CreateHardLinksForCopyFilesToOutputDirectoryIfPossible=true /p:CreateHardLinksForPublishFilesIfPossible=true

- name: Unit Tests
run: |
dotnet test -c Release --no-restore --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj
dotnet test -c Release --no-restore --no-build --framework net6.0 ./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

- uses: actions/upload-artifact@v3
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/logs

14 changes: 14 additions & 0 deletions src/OrchardCore.Build/OrchardCore.Commons.targets
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,18 @@
File="$(MSBuildProjectFullPath)" />
</Target>

<Target Name="SetAllProjectReferenceAsPublic"
AfterTargets="AssignProjectConfiguration"
BeforeTargets="ResolveProjectReferences"
Condition="'$(OutputType)' == 'Library' and '$(CopyLocalLockFileAssemblies)' != 'true' and $(MSBuildProjectDirectory.Contains('.Tests.')) == 'false' ">
<ItemGroup>
<ProjectReferenceWithConfiguration Update="@(ProjectReferenceWithConfiguration)">
<Private>false</Private>
</ProjectReferenceWithConfiguration>
<ProjectReference Update="@(ProjectReference)">
<Private>false</Private>
</ProjectReference>
</ItemGroup>
</Target>

</Project>
2 changes: 1 addition & 1 deletion src/OrchardCore.Cms.Web/OrchardCore.Cms.Web.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project ToolsVersion="15.0" Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<Import Project="..\OrchardCore.Build\Dependencies.props" />

Expand Down
2 changes: 1 addition & 1 deletion src/OrchardCore.Mvc.Web/OrchardCore.Mvc.Web.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project ToolsVersion="15.0" Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<Import Project="..\OrchardCore.Build\Dependencies.props" />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project ToolsVersion="15.0" Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<Import Project="..\..\..\src\OrchardCore.Build\Dependencies.props" />

Expand Down