Skip to content

Commit d2954bc

Browse files
authored
Merge pull request #4278 from arturcic/main
(build) Improve input parameters for workflows, changed to dynamic matrix
2 parents bca6e18 + 92e173e commit d2954bc

39 files changed

+197
-126
lines changed

.github/actions/docker-manifests/action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: 'Docker Manifests'
22
description: 'Docker Publish Manifests'
33
inputs:
4-
distro:
4+
dockerDistro:
55
description: 'Linux Distro'
66
required: true
7-
targetFramework:
7+
dotnetVersion:
88
description: '.net version'
99
required: true
1010
docker_registry_username:
@@ -32,7 +32,7 @@ runs:
3232
-
3333
name: '[Docker Publish Manifests] DockerHub'
3434
shell: pwsh
35-
run: dotnet run/docker.dll --target=DockerManifest --arch=amd64 --arch=arm64 --docker_dotnetversion=${{ inputs.targetFramework }} --docker_distro=${{ inputs.distro }} --docker_registry dockerhub
35+
run: dotnet run/docker.dll --target=DockerManifest --arch=amd64 --arch=arm64 --dotnet_version=${{ inputs.dotnetVersion }} --docker_distro=${{ inputs.dockerDistro }} --docker_registry dockerhub
3636
-
3737
name: Login to GitHub
3838
uses: docker/login-action@v3
@@ -43,4 +43,4 @@ runs:
4343
-
4444
name: '[Docker Publish Manifests] GitHub'
4545
shell: pwsh
46-
run: dotnet run/docker.dll --target=DockerManifest --arch=amd64 --arch=arm64 --docker_dotnetversion=${{ inputs.targetFramework }} --docker_distro=${{ inputs.distro }} --docker_registry github
46+
run: dotnet run/docker.dll --target=DockerManifest --arch=amd64 --arch=arm64 --dotnet_version=${{ inputs.dotnetVersion }} --docker_distro=${{ inputs.dockerDistro }} --docker_registry github

.github/actions/docker-publish/action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ inputs:
44
arch:
55
description: 'Docker architecture'
66
required: true
7-
distro:
7+
dockerDistro:
88
description: 'Linux Distro'
99
required: true
10-
targetFramework:
10+
dotnetVersion:
1111
description: '.net version'
1212
required: true
1313
docker_registry_username:
@@ -35,7 +35,7 @@ runs:
3535
-
3636
name: '[Docker Publish] DockerHub'
3737
shell: pwsh
38-
run: dotnet run/docker.dll --target=DockerPublish --arch=${{ inputs.arch }} --docker_dotnetversion=${{ inputs.targetFramework }} --docker_distro=${{ inputs.distro }} --docker_registry dockerhub --verbosity=diagnostic
38+
run: dotnet run/docker.dll --target=DockerPublish --arch=${{ inputs.arch }} --dotnet_version=${{ inputs.dotnetVersion }} --docker_distro=${{ inputs.dockerDistro }} --docker_registry dockerhub --verbosity=diagnostic
3939
-
4040
name: Login to GitHub
4141
uses: docker/login-action@v3
@@ -46,4 +46,4 @@ runs:
4646
-
4747
name: '[Docker Publish] GitHub'
4848
shell: pwsh
49-
run: dotnet run/docker.dll --target=DockerPublish --arch=${{ inputs.arch }} --docker_dotnetversion=${{ inputs.targetFramework }} --docker_distro=${{ inputs.distro }} --docker_registry github --verbosity=diagnostic
49+
run: dotnet run/docker.dll --target=DockerPublish --arch=${{ inputs.arch }} --dotnet_version=${{ inputs.dotnetVersion }} --docker_distro=${{ inputs.dockerDistro }} --docker_registry github --verbosity=diagnostic

.github/actions/docker-test/action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ inputs:
44
arch:
55
description: 'Docker architecture'
66
default: 'amd64'
7-
distro:
7+
dockerDistro:
88
description: 'Linux Distro'
99
default: 'debian.12'
10-
targetFramework:
10+
dotnetVersion:
1111
description: '.net version'
1212
default: '8.0'
1313

@@ -17,8 +17,8 @@ runs:
1717
-
1818
name: '[Docker Build & Test] DockerHub'
1919
shell: pwsh
20-
run: dotnet run/docker.dll --target=DockerTest --arch=${{ inputs.arch }} --docker_dotnetversion=${{ inputs.targetFramework }} --docker_distro=${{ inputs.distro }} --docker_registry dockerhub --verbosity=diagnostic
20+
run: dotnet run/docker.dll --target=DockerTest --arch=${{ inputs.arch }} --dotnet_version=${{ inputs.dotnetVersion }} --docker_distro=${{ inputs.dockerDistro }} --docker_registry dockerhub --verbosity=diagnostic
2121
-
2222
name: '[Docker Build & Test] GitHub'
2323
shell: pwsh
24-
run: dotnet run/docker.dll --target=DockerTest --arch=${{ inputs.arch }} --docker_dotnetversion=${{ inputs.targetFramework }} --docker_distro=${{ inputs.distro }} --docker_registry github --verbosity=diagnostic
24+
run: dotnet run/docker.dll --target=DockerTest --arch=${{ inputs.arch }} --dotnet_version=${{ inputs.dotnetVersion }} --docker_distro=${{ inputs.dockerDistro }} --docker_registry github --verbosity=diagnostic

.github/workflows/_artifacts_linux.yml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,25 @@ on:
77
arch:
88
required: true
99
type: string
10-
10+
dockerDistros:
11+
required: true
12+
type: string
13+
dotnetVersions:
14+
required: true
15+
type: string
1116
env:
1217
DOTNET_INSTALL_DIR: "./.dotnet"
1318
DOTNET_ROLL_FORWARD: "Major"
1419

1520
jobs:
1621
artifacts:
17-
name: ${{ matrix.distro }} - net${{ matrix.targetFramework }}
22+
name: ${{ matrix.dockerDistro }} - net${{ matrix.dotnetVersion }}
1823
runs-on: ${{ inputs.runner }}
1924
strategy:
2025
fail-fast: false
21-
matrix:
22-
distro:
23-
- alpine.3.20
24-
- centos.stream.9
25-
- debian.12
26-
- fedora.40
27-
- ubuntu.20.04
28-
- ubuntu.22.04
29-
- ubuntu.24.04
30-
targetFramework: [ '8.0', '6.0' ]
31-
26+
matrix:
27+
dockerDistro: ${{ fromJson(inputs.dockerDistros) }}
28+
dotnetVersion: ${{ fromJson(inputs.dotnetVersions) }}
3229
steps:
3330
-
3431
name: Checkout
@@ -53,4 +50,4 @@ jobs:
5350
-
5451
name: '[Test Artifacts]'
5552
shell: pwsh
56-
run: dotnet run/artifacts.dll --target=ArtifactsTest --arch=${{ inputs.arch }} --docker_dotnetversion=${{ matrix.targetFramework }} --docker_distro=${{ matrix.distro }}
53+
run: dotnet run/artifacts.dll --target=ArtifactsTest --arch=${{ inputs.arch }} --dotnet_version=${{ matrix.dotnetVersion }} --docker_distro=${{ matrix.dockerDistro }}

.github/workflows/_docker.yml

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,25 @@ on:
77
arch:
88
required: true
99
type: string
10-
10+
dockerDistros:
11+
required: true
12+
type: string
13+
dotnetVersions:
14+
required: true
15+
type: string
1116
env:
1217
DOTNET_INSTALL_DIR: "./.dotnet"
1318
DOTNET_ROLL_FORWARD: "Major"
1419

1520
jobs:
1621
docker:
17-
name: ${{ matrix.distro }} - net${{ matrix.targetFramework }}
22+
name: ${{ matrix.dockerDistro }} - net${{ matrix.dotnetVersion }}
1823
runs-on: ${{ inputs.runner }}
1924
strategy:
2025
fail-fast: false
2126
matrix:
22-
distro:
23-
- alpine.3.20
24-
- centos.stream.9
25-
- debian.12
26-
- fedora.40
27-
- ubuntu.20.04
28-
- ubuntu.22.04
29-
- ubuntu.24.04
30-
targetFramework: [ '8.0', '6.0' ]
31-
27+
dockerDistro: ${{ fromJson(inputs.dockerDistros) }}
28+
dotnetVersion: ${{ fromJson(inputs.dotnetVersions) }}
3229
steps:
3330
-
3431
name: Checkout
@@ -65,16 +62,16 @@ jobs:
6562
uses: ./.github/actions/docker-test
6663
with:
6764
arch: ${{ inputs.arch }}
68-
distro: ${{ matrix.distro }}
69-
targetFramework: ${{ matrix.targetFramework }}
65+
dockerDistro: ${{ matrix.dockerDistro }}
66+
dotnetVersion: ${{ matrix.dotnetVersion }}
7067
-
7168
name: Docker Publish
7269
if: success() && github.event_name != 'pull_request' && github.repository_owner == 'GitTools' && github.ref_name == 'main'
7370
uses: ./.github/actions/docker-publish
7471
with:
7572
arch: ${{ inputs.arch }}
76-
distro: ${{ matrix.distro }}
77-
targetFramework: ${{ matrix.targetFramework }}
73+
dockerDistro: ${{ matrix.dockerDistro }}
74+
dotnetVersion: ${{ matrix.dotnetVersion }}
7875
docker_registry_username: ${{ secrets.DOCKER_USERNAME }}
7976
docker_registry_password: ${{ secrets.DOCKER_PASSWORD }}
8077
github_registry_username: ${{ github.repository_owner }}

.github/workflows/_docker_manifests.yml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
11
on:
22
workflow_call:
3-
3+
inputs:
4+
dockerDistros:
5+
required: true
6+
type: string
7+
dotnetVersions:
8+
required: true
9+
type: string
410
env:
511
DOTNET_INSTALL_DIR: "./.dotnet"
612
DOTNET_ROLL_FORWARD: "Major"
713

814
jobs:
915
manifest:
10-
name: ${{ matrix.distro }} - net${{ matrix.targetFramework }}
16+
name: ${{ matrix.dockerDistro }} - net${{ matrix.dotnetVersion }}
1117
runs-on: ubuntu-latest
1218
strategy:
1319
fail-fast: false
1420
matrix:
15-
distro:
16-
- alpine.3.20
17-
- centos.stream.9
18-
- debian.12
19-
- fedora.40
20-
- ubuntu.20.04
21-
- ubuntu.22.04
22-
- ubuntu.24.04
23-
targetFramework: [ '8.0', '6.0' ]
24-
21+
dockerDistro: ${{ fromJson(inputs.dockerDistros) }}
22+
dotnetVersion: ${{ fromJson(inputs.dotnetVersions) }}
2523
steps:
2624
-
2725
name: Checkout
@@ -51,8 +49,8 @@ jobs:
5149
if: success() && github.event_name != 'pull_request' && github.repository_owner == 'GitTools' && github.ref_name == 'main'
5250
uses: ./.github/actions/docker-manifests
5351
with:
54-
distro: ${{ matrix.distro }}
55-
targetFramework: ${{ matrix.targetFramework }}
52+
dockerDistro: ${{ matrix.dockerDistro }}
53+
dotnetVersion: ${{ matrix.dotnetVersion }}
5654
docker_registry_username: ${{ secrets.DOCKER_USERNAME }}
5755
docker_registry_password: ${{ secrets.DOCKER_PASSWORD }}
5856
github_registry_username: ${{ github.repository_owner }}

.github/workflows/_prepare.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
on:
22
workflow_call:
3-
3+
outputs:
4+
dockerDistros:
5+
description: 'List of Docker distros'
6+
value: ${{ jobs.set_matrix.outputs.dockerDistros }}
7+
dotnetVersions:
8+
description: 'List of .NET versions'
9+
value: ${{ jobs.set_matrix.outputs.dotnetVersions }}
410
jobs:
511
prepare:
612
name: ${{ matrix.os }}
@@ -40,3 +46,22 @@ jobs:
4046
name: '[Prepare]'
4147
shell: pwsh
4248
run: dotnet run/build.dll --target=BuildPrepare
49+
set_matrix:
50+
needs: [ prepare ]
51+
name: Set Matrix
52+
runs-on: ubuntu-latest
53+
outputs:
54+
dockerDistros: ${{ steps.set_matrix.outputs.dockerDistros }}
55+
dotnetVersions: ${{ steps.set_matrix.outputs.dotnetVersions }}
56+
steps:
57+
-
58+
name: Checkout
59+
uses: actions/checkout@v4
60+
-
61+
name: Restore State
62+
uses: ./.github/actions/cache-restore
63+
-
64+
name: '[Matrix]'
65+
id: set_matrix
66+
shell: pwsh
67+
run: dotnet run/config.dll --target=SetMatrix

.github/workflows/_unit_tests.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
on:
22
workflow_call:
3-
3+
inputs:
4+
dotnetVersions:
5+
required: true
6+
type: string
47
env:
58
DOTNET_INSTALL_DIR: "./.dotnet"
69
DOTNET_ROLL_FORWARD: "Major"
710

811
jobs:
912
unit_test:
10-
name: ${{ matrix.os }} - net${{ matrix.targetFramework }}
13+
name: ${{ matrix.os }} - net${{ matrix.dotnetVersion }}
1114
env:
1215
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
1316
strategy:
1417
fail-fast: false
1518
matrix:
1619
os: [windows-latest, ubuntu-latest, macos-15]
17-
targetFramework: [ '8.0', '6.0' ]
20+
dotnetVersion: ${{ fromJson(inputs.dotnetVersions) }}
1821

1922
runs-on: ${{ matrix.os }}
2023
steps:
@@ -29,11 +32,11 @@ jobs:
2932
-
3033
name: '[Unit Test]'
3134
shell: pwsh
32-
run: dotnet run/build.dll --target=Test --dotnet_target=${{ matrix.targetFramework }}
35+
run: dotnet run/build.dll --target=Test --dotnet_version=${{ matrix.dotnetVersion }}
3336

3437
-
3538
name: Test Summary
3639
uses: test-summary/[email protected]
37-
if: matrix.targetFramework == '8.0'
40+
if: matrix.dotnetVersion == '8.0'
3841
with:
3942
paths: artifacts/test-results/*.results.xml

.github/workflows/ci.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
prepare:
4444
name: Prepare
4545
uses: ./.github/workflows/_prepare.yml
46-
46+
4747
build:
4848
name: Build & Package
4949
needs: [ prepare ]
@@ -53,6 +53,8 @@ jobs:
5353
name: Test
5454
needs: [ prepare ]
5555
uses: ./.github/workflows/_unit_tests.yml
56+
with:
57+
dotnetVersions: ${{ needs.prepare.outputs.dotnetVersions }}
5658
secrets: inherit
5759

5860
artifacts_windows_test:
@@ -61,7 +63,7 @@ jobs:
6163
uses: ./.github/workflows/_artifacts_windows.yml
6264

6365
artifacts_linux_test:
64-
needs: [ build ]
66+
needs: [ prepare, build ]
6567
name: Artifacts Linux (${{ matrix.arch }})
6668
strategy:
6769
fail-fast: false
@@ -75,9 +77,11 @@ jobs:
7577
with:
7678
runner: ${{ matrix.runner }}
7779
arch: ${{ matrix.arch }}
80+
dockerDistros: ${{ needs.prepare.outputs.dockerDistros }}
81+
dotnetVersions: ${{ needs.prepare.outputs.dotnetVersions }}
7882

7983
docker_linux_images:
80-
needs: [ build ]
84+
needs: [ prepare, build ]
8185
name: Docker Images (${{ matrix.arch }})
8286
strategy:
8387
fail-fast: false
@@ -92,12 +96,17 @@ jobs:
9296
with:
9397
runner: ${{ matrix.runner }}
9498
arch: ${{ matrix.arch }}
99+
dockerDistros: ${{ needs.prepare.outputs.dockerDistros }}
100+
dotnetVersions: ${{ needs.prepare.outputs.dotnetVersions }}
95101
secrets: inherit
96102

97103
docker_linux_manifests:
98-
needs: [ docker_linux_images ]
104+
needs: [ prepare, docker_linux_images ]
99105
name: Docker Manifests
100106
uses: ./.github/workflows/_docker_manifests.yml
107+
with:
108+
dockerDistros: ${{ needs.prepare.outputs.dockerDistros }}
109+
dotnetVersions: ${{ needs.prepare.outputs.dotnetVersions }}
101110
secrets: inherit
102111

103112
publish:

0 commit comments

Comments
 (0)