-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
396449c
commit efe7e21
Showing
3 changed files
with
72 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: .NET lint | ||
|
||
# Note: this action requires .NET 6+ SDK | ||
|
||
inputs: | ||
WORKING_DIRECTORY: | ||
required: true | ||
type: string | ||
SHELL: | ||
required: false | ||
type: string | ||
default: 'bash' | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: .NET lint style | ||
shell: ${{ inputs.SHELL }} | ||
run: dotnet format style --verify-no-changes | ||
working-directory: ${{ inputs.WORKING_DIRECTORY }} | ||
|
||
- name: .NET lint analyzers | ||
shell: ${{ inputs.SHELL }} | ||
run: dotnet format analyzers --verify-no-changes | ||
working-directory: ${{ inputs.WORKING_DIRECTORY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,11 @@ jobs: | |
WORKING_DIRECTORY: ${{ inputs.WORKING_DIRECTORY }} | ||
BUILD_CONFIG: "Debug" | ||
|
||
- name: Lint | ||
uses: zupit-it/pipeline-templates/.github/actions/dotnet/[email protected] | ||
with: | ||
WORKING_DIRECTORY: ${{ inputs.WORKING_DIRECTORY }} | ||
|
||
- name: Run tests | ||
uses: zupit-it/pipeline-templates/.github/actions/dotnet/[email protected] | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,9 +17,10 @@ If you would like to get more details of these tasks, just look at this [doc](do | |
1. [Install](#net-action---install) | ||
2. [Build](#net-action---build) | ||
3. [Format](#net-action---format) | ||
4. [Test](#net-action---test) | ||
5. [Publish](#net-action---publish) | ||
6. [Release](#net-action---release) | ||
4. [Lint](#net-action---lint) | ||
5. [Test](#net-action---test) | ||
6. [Publish](#net-action---publish) | ||
7. [Release](#net-action---release) | ||
5. [Azure](#azure-action) | ||
1. [App Service](#azure-action---app-service---deploy) | ||
2. [Storage Account](#azure-action---storage-account---deploy) | ||
|
@@ -327,6 +328,41 @@ steps: | |
CSHARPIER_VERSION: "0.25.0" | ||
``` | ||
|
||
#### .NET Action - Lint | ||
|
||
This action: | ||
- run the `dotnet format` command on the `WORKING_DIRECTORY`. | ||
|
||
###### Requirements | ||
|
||
- The `WORKING_DIRECTORY` directory must contain a solution or a project file. | ||
- The correct .NET (6+) version must be installed. | ||
|
||
_This workflow doesn't download the codebase. You have to check out the repo by yourself._ | ||
|
||
###### Action | ||
|
||
**.github/actions/dotnet/lint** is the action that lints the code of a .NET solution. | ||
|
||
It requires these inputs: | ||
|
||
- **WORKING_DIRECTORY**: The directory where the runner can execute all the commands. It must contain a solution (`.sln`) or a project (`.csproj`) file. | ||
|
||
In addition, it is possible to specify this optional input: | ||
|
||
- **SHELL**: The shell type to use. By default, it is **bash**. | ||
|
||
This is an example to show how data should be formatted. | ||
|
||
```yaml | ||
steps: | ||
- name: Build | ||
uses: zupit-it/pipeline-templates/.github/actions/dotnet/[email protected] | ||
with: | ||
WORKING_DIRECTORY: "backend" | ||
SHELL: "bash" | ||
``` | ||
|
||
#### .NET Action - Test | ||
|
||
This action: | ||
|
@@ -1308,13 +1344,14 @@ This workflow is based on the following actions: | |
- [.NET - Install](#net-action---install) | ||
- [.NET - Build](#net-action---build) | ||
- [.NET - Format](#net-action---format) | ||
- [.NET - Lint](#net-action---lint) | ||
- [.NET - Test](#net-action---test) | ||
|
||
Check these actions requirements before using this workflow. | ||
|
||
###### Workflow | ||
|
||
**dotnet-workflow-common.yml** is the reusable workflow to check that the code is correctly linted and that all tests pass. | ||
**dotnet-workflow-common.yml** is the reusable workflow to check that the code is correctly linted, formatted, and that all tests pass. | ||
|
||
It requires these inputs: | ||
|
||
|
@@ -1329,7 +1366,7 @@ jobs: | |
common: | ||
uses: zupit-it/pipeline-templates/.github/workflows/[email protected] | ||
with: | ||
WORKING_DIRECTORY: "back-end" | ||
WORKING_DIRECTORY: "backend" | ||
DOTNET_IMAGE: "'mcr.microsoft.com/dotnet/sdk:7.0" | ||
CONTAINER_CI_LABELS: "['team', 'pipeline', 'container']" | ||
``` | ||
|