-
Notifications
You must be signed in to change notification settings - Fork 797
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use GH reusable workflows to reduce .yml duplication (#2037)
Co-authored-by: Luis Fraile <[email protected]>
- Loading branch information
1 parent
33d6641
commit 7060bdd
Showing
9 changed files
with
161 additions
and
146 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
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
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
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
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
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
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,37 @@ | ||
name: Reusable Preview CD Workflow | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
BUILD_CONFIG: | ||
required: true | ||
type: string | ||
VERSION_SUFFIX_PREFIX: | ||
required: true | ||
type: string | ||
PROJECT_PATH: | ||
required: true | ||
type: string | ||
PACKAGE_NAME: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: | | ||
6.0.x | ||
7.0.x | ||
- name: Restore | ||
run: dotnet restore ${{inputs.PROJECT_PATH}} | ||
- name: Build | ||
run: dotnet build --no-restore ${{inputs.PROJECT_PATH}} -c ${{inputs.BUILD_CONFIG}} | ||
- name: Pack | ||
run: dotnet pack --no-build ${{inputs.PROJECT_PATH}} --version-suffix ${{inputs.VERSION_SUFFIX_PREFIX}}.${{ github.run_number }} -c ${{inputs.BUILD_CONFIG}} -o ./artifacts | ||
- name: Publish | ||
run: dotnet nuget push ./artifacts/${{inputs.PACKAGE_NAME}}.*.nupkg -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json --skip-duplicate |
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,34 @@ | ||
name: Reusable CD Workflow | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
BUILD_CONFIG: | ||
required: true | ||
type: string | ||
PROJECT_PATH: | ||
required: true | ||
type: string | ||
PACKAGE_NAME: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: | | ||
6.0.x | ||
7.0.x | ||
- name: Restore | ||
run: dotnet restore ${{inputs.PROJECT_PATH}} | ||
- name: Build | ||
run: dotnet build --no-restore ${{inputs.PROJECT_PATH}} -c ${{inputs.BUILD_CONFIG}} | ||
- name: Pack | ||
run: dotnet pack --no-build ${{inputs.PROJECT_PATH}} -c ${{inputs.BUILD_CONFIG}} -o ./artifacts | ||
- name: Publish | ||
run: dotnet nuget push ./artifacts/${{inputs.PACKAGE_NAME}}.*.nupkg -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json --skip-duplicate |
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,53 @@ | ||
name: Reusable CI workflow | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
PROJECT_PATH: | ||
required: true | ||
type: string | ||
TEST_PROJECT_PATH: | ||
required: true | ||
type: string | ||
CODECOV_FLAGS: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: | | ||
6.0.x | ||
7.0.x | ||
- name: Restore | ||
run: | | ||
dotnet restore ${{inputs.PROJECT_PATH}} && | ||
dotnet restore ${{inputs.TEST_PROJECT_PATH}} | ||
- name: Check formatting | ||
run: | | ||
dotnet format --no-restore --verify-no-changes --severity warn ${{inputs.PROJECT_PATH}} || (echo "Run 'dotnet format' to fix issues" && exit 1) && | ||
dotnet format --no-restore --verify-no-changes --severity warn ${{inputs.TEST_PROJECT_PATH}} || (echo "Run 'dotnet format' to fix issues" && exit 1) | ||
- name: Build | ||
run: | | ||
dotnet build --no-restore ${{inputs.PROJECT_PATH}} | ||
dotnet build --no-restore ${{inputs.TEST_PROJECT_PATH}} | ||
- name: Test | ||
run: > | ||
dotnet test | ||
${{inputs.TEST_PROJECT_PATH}} | ||
--no-restore | ||
--no-build | ||
--collect "XPlat Code Coverage" | ||
--results-directory .coverage | ||
-- | ||
DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover | ||
- name: Upload Coverage | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
flags: ${{inputs.CODECOV_FLAGS}} | ||
directory: .coverage |