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

OSOE-172: Check if all packages are consolidated in a solution #42

Merged
merged 10 commits into from
Aug 30, 2022
27 changes: 27 additions & 0 deletions .github/actions/verify-dotnet-consolidation/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Verify that .NET packages are consolidated
description: >
Verifies that the NuGet packages of a .NET solution are consolidated, i.e. the same version of a given package is used
in all projects.

inputs:
directory:
required: false
default: .
description: Path to the directory where a solution file can be found.
solution-path:
required: false
default: "*.sln"
description: >
The path of the solution file to be processed. The value is given to PowerShell's `Get-ChildItem` cmdlet as-is, so
grepping is still possible but a name with spaces must be escaped separately.
dministro marked this conversation as resolved.
Show resolved Hide resolved

runs:
using: "composite"
steps:
- name: Setup
shell: pwsh
run: dotnet tool install dotnet-consolidate --global --version 2.0.0
- name: Verify consolidation status
shell: pwsh
working-directory: ${{ inputs.directory }}
run: dotnet consolidate -s (Get-ChildItem ${{ inputs.solution-path }}).FullName
13 changes: 13 additions & 0 deletions .github/workflows/build-and-test-orchard-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ on:
type: number
default: 360
description: Configuration for the timeout-minutes parameter of the workflow. The 360 is GitHub's default.
verify-dotnet-consolidation:
required: false
type: boolean
default: true
description: >
When set to true, it will be verified whether the NuGet packages of the .NET solution are consolidated, i.e.
the same version of a given package is used in all projects.

jobs:
build-and-test:
Expand All @@ -91,6 +98,12 @@ jobs:
with:
dotnet-version: ${{ inputs.dotnet-version }}

- name: Verify that .NET packages are consolidated
if: ${{ inputs.verify-dotnet-consolidation }}
uses: Lombiq/GitHub-Actions/.github/actions/verify-dotnet-consolidation@issue/OSOE-172
with:
directory: ${{ inputs.build-directory }}

- name: Enable Node corepack
uses: Lombiq/GitHub-Actions/.github/actions/enable-corepack@dev

Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/build-dotnet.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build .NET solution
name: Build .NET solution

on:
workflow_call:
Expand Down Expand Up @@ -59,6 +59,13 @@ on:
type: number
default: 360
description: Configuration for the timeout-minutes parameter of the workflow. The 360 is GitHub's default.
verify-dotnet-consolidation:
required: false
type: boolean
default: true
description: >
When set to true, it will be verified whether the NuGet packages of the .NET solution are consolidated, i.e.
the same version of a given package is used in all projects.

jobs:
# While the below steps seem suitable to DRY with build-and-test-orchard-core, since reusable workflows can't call
Expand All @@ -85,6 +92,12 @@ jobs:
with:
dotnet-version: ${{ inputs.dotnet-version }}

- name: Verify that .NET packages are consolidated
if: ${{ inputs.verify-dotnet-consolidation }}
uses: Lombiq/GitHub-Actions/.github/actions/verify-dotnet-consolidation@issue/OSOE-172
with:
directory: ${{ inputs.build-directory }}

- name: Build and Static Code Analysis
uses: Lombiq/GitHub-Actions/.github/actions/build-dotnet@dev
with:
Expand Down
1 change: 1 addition & 0 deletions Docs/Actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ In addition to the below short explanations, check out the inline documentation
- `setup-dotnet`: Sets up the .NET SDK.
- `setup-sql-server`: Sets up SQL Server with Lombiq-recommended defaults.
- `test-dotnet`: Runs .NET unit and UI tests (with the [Lombiq UI Testing Toolbox for Orchard Core](https://github.com/Lombiq/UI-Testing-Toolbox)), generates a test report, and uploads UI testing failure dumps to artifacts.
- `verify-dotnet-consolidation`: Verifies that the NuGet packages of a .NET solution are consolidated, i.e. the same version of a given package is used in all projects.
- `verify-submodule-pull-request`: Assuming that the current repository is a submodule in another repository, this action verifies that a pull request with a matching issue code has been opened there as well.