Skip to content

Commit 1e3513c

Browse files
committed
feat(ci): update GitHub Actions workflow and enhance paths
- Renames Docker ignore files to the top-level directory for better clarity. - Updates the GitHub Container Registry repository path for better organization. - Refactors the CI/CD pipeline to include additional source filters for build and test jobs. - Adds dotnet commands for restore, build, and test processes to streamline development workflow. - Removes obsolete steps for tool installations and configurations to reduce complexity. Closes #45
1 parent 2370ed7 commit 1e3513c

File tree

8 files changed

+202
-162
lines changed

8 files changed

+202
-162
lines changed
Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
**/.classpath
2-
**/.dockerignore
3-
**/.env
4-
**/.git
5-
**/.gitignore
6-
**/.project
7-
**/.settings
8-
**/.toolstarget
9-
**/.vs
10-
**/.vscode
11-
**/*.*proj.user
12-
**/*.dbmdl
13-
**/*.jfm
14-
**/azds.yaml
15-
**/bin
16-
**/charts
17-
**/docker-compose*
18-
**/Dockerfile*
19-
**/node_modules
20-
**/npm-debug.log
21-
**/obj
22-
**/secrets.dev.yaml
23-
**/values.dev.yaml
24-
LICENSE
1+
**/.classpath
2+
**/.dockerignore
3+
**/.env
4+
**/.git
5+
**/.gitignore
6+
**/.project
7+
**/.settings
8+
**/.toolstarget
9+
**/.vs
10+
**/.vscode
11+
**/*.*proj.user
12+
**/*.dbmdl
13+
**/*.jfm
14+
**/azds.yaml
15+
**/bin
16+
**/charts
17+
**/docker-compose*
18+
**/Dockerfile*
19+
**/node_modules
20+
**/npm-debug.log
21+
**/obj
22+
**/secrets.dev.yaml
23+
**/values.dev.yaml
24+
LICENSE
2525
README.md

.github/workflows/pipeline.yaml

Lines changed: 141 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ env:
2828
containerImageBuildContext: "src/"
2929
containerImageBuildDockerfile: "src/ES.Kubernetes.Reflector/Dockerfile"
3030
dockerHubContainerImageRepository: "emberstack"
31-
ghcrContainerImageRepository: "ghcr.io/emberstack"
31+
ghcrContainerImageRepository: "ghcr.io/emberstack/container-images"
3232
helmChart: "reflector"
3333
helmChartDir: "src/helm/reflector"
3434

@@ -76,12 +76,23 @@ jobs:
7676
base: ${{ github.ref }}
7777
filters: |
7878
src:
79+
- '*.sln'
80+
- '*.slnx'
81+
- '*.props'
7982
- 'src/**'
83+
build:
84+
- '*.sln'
85+
- '*.slnx'
86+
- '*.props'
87+
- 'src/**'
88+
- 'tests/**'
89+
- 'playground/**'
90+
8091
8192
- name: evaluate - requires_build
8293
id: requires_build
8394
run: |
84-
if [ "${{ steps.pathsFilter.outputs.src }}" = "true" ] || \
95+
if [ "${{ steps.pathsFilter.outputs.build }}" = "true" ] || \
8596
[ "${{ github.event.inputs.force_build }}" = "true" ] || \
8697
[ "${{ github.event.inputs.force_publish }}" = "true" ]; then
8798
result=true
@@ -125,111 +136,135 @@ jobs:
125136
- name: checkout
126137
uses: actions/checkout@v4
127138

128-
- name: tools - kubectl - install
129-
uses: azure/setup-kubectl@v4
130-
131-
- name: tools - oras - install
132-
uses: oras-project/setup-oras@v1
133-
134-
- name: tools - oras - login - ghcr.io
135-
if: ${{ needs.discovery.outputs.requiresBuildPush == 'true' }}
136-
run: echo "${{ secrets.ES_GITHUB_PAT }}" | oras login ghcr.io -u ${{ github.actor }} --password-stdin
137-
138-
- name: tools - helm - install
139-
uses: azure/setup-helm@v4
140-
141-
- name: tools - helm - login - ghcr.io
142-
if: ${{ needs.discovery.outputs.requiresBuildPush == 'true' }}
143-
run: echo "${{ secrets.ES_GITHUB_PAT }}" | helm registry login ghcr.io -u ${{ github.actor }} --password-stdin
139+
- name: dotnet restore
140+
if: ${{ env.build == 'true' }}
141+
run: dotnet restore
144142

145-
- name: tools - docker - login ghcr.io
146-
if: ${{ needs.discovery.outputs.requiresBuildPush == 'true' }}
147-
uses: docker/login-action@v3
148-
with:
149-
registry: ghcr.io
150-
username: ${{ github.actor }}
151-
password: ${{ secrets.ES_GITHUB_PAT }}
152-
153-
- name: tools - docker - login docker.io
154-
if: ${{ needs.discovery.outputs.requiresBuildPush == 'true' }}
155-
uses: docker/login-action@v3
156-
with:
157-
registry: docker.io
158-
username: ${{ secrets.ES_DOCKERHUB_USERNAME }}
159-
password: ${{ secrets.ES_DOCKERHUB_PAT }}
143+
- name: dotnet build
144+
if: ${{ env.build == 'true' }}
145+
run: dotnet build --no-restore --configuration Release /p:Version=${{env.GitVersion_SemVer}} /p:AssemblyVersion=${{env.GitVersion_AssemblySemFileVer}} /p:NuGetVersion=${{env.GitVersion_SemVer}}
160146

161-
- name: tools - docker - register QEMU
162-
run: |
163-
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
164-
165-
- name: tools - docker - setup buildx
166-
uses: docker/setup-buildx-action@v3
167-
with:
168-
driver: docker-container # REQUIRED for multi-platform builds
169-
170-
- name: artifacts - prepare directories
171-
run: |
172-
mkdir -p .artifacts/helm
173-
mkdir -p .artifacts/kubectl
174-
mkdir -p .artifacts/artifacthub
175-
176-
- name: helm - import README
177-
run: cp README.md ${{ env.helmChartDir }}/README.md
178-
179-
- name: helm - package chart
180-
run: helm package --destination .artifacts/helm --version ${{ env.gitVersion_SemVer }} --app-version ${{ env.gitVersion_SemVer }} ${{ env.helmChartDir }}
181-
182-
- name: helm - template chart
183-
run: helm template --namespace kube-system ${{ env.helmChart }} .artifacts/helm/${{ env.helmChart }}-${{ env.gitVersion_SemVer }}.tgz > .artifacts/kubectl/${{ env.helmChart }}.yaml
184-
185-
- name: helm - artifacthub - repo
186-
run: install -D src/helm/artifacthub-repo.yaml .artifacts/artifacthub/artifacthub-repo.yaml
187-
188-
- name: docker - build and push
189-
uses: docker/build-push-action@v6
190-
with:
191-
context: ${{ env.containerImageBuildContext }}
192-
file: ${{ env.containerImageBuildDockerfile }}
193-
push: ${{ needs.discovery.outputs.requiresBuildPush == 'true' }}
194-
provenance: false
195-
platforms: linux/amd64,linux/arm/v7,linux/arm64
196-
labels: |
197-
org.opencontainers.image.source=https://github.com/${{ github.repository }}
198-
org.opencontainers.image.url=https://github.com/${{ github.repository }}
199-
org.opencontainers.image.vendor=${{ github.repository_owner }}
200-
org.opencontainers.image.version=${{ env.gitVersion_SemVer }}
201-
org.opencontainers.image.revision=${{ github.sha }}
202-
tags: |
203-
${{ env.dockerHubContainerImageRepository }}/${{ env.containerImage }}:${{ env.gitVersion_SemVer }}
204-
${{ env.ghcrContainerImageRepository }}/${{ env.containerImage }}:${{ env.gitVersion_SemVer }}
205-
206-
- name: helm - push - ghcr.io
207-
run: helm push .artifacts/helm/${{ env.helmChart }}-${{ env.gitVersion_SemVer }}.tgz oci://ghcr.io/${{ github.repository_owner }}/helm-charts
208-
209-
- name: docker - tag and push - latest
210-
if: ${{ needs.discovery.outputs.requiresRelease == 'true' }}
211-
run: |
212-
docker buildx imagetools create \
213-
--tag ${{ env.dockerHubContainerImageRepository }}/${{ env.containerImage }}:latest \
214-
--tag ${{ env.ghcrContainerImageRepository }}/${{ env.containerImage }}:latest \
215-
${{ env.ghcrContainerImageRepository }}/${{ env.containerImage }}:${{ env.gitVersion_SemVer }}
216-
217-
- name: oras - push - artifact hub metadata
218-
if: ${{ needs.discovery.outputs.requiresRelease == 'true' }}
219-
run: |
220-
oras push ghcr.io/${{ github.repository_owner }}/helm-charts/${{ env.helmChart }}:artifacthub.io \
221-
--config /dev/null:application/vnd.cncf.artifacthub.config.v1+yaml \
222-
.artifacts/artifacthub/artifacthub-repo.yaml:application/vnd.cncf.artifacthub.repository-metadata.layer.v1.yaml
147+
- name: dotnet test
148+
if: ${{ env.build == 'true' }}
149+
run: dotnet test --no-build --configuration Release --verbosity normal
223150

224-
- name: github - release - create
225-
if: ${{ needs.discovery.outputs.requiresRelease == 'true' }}
226-
uses: softprops/action-gh-release@v2
151+
- name: test-reporter
152+
uses: dorny/test-reporter@v2
153+
if: ${{ env.build == 'true' && github.event.pull_request.head.repo.fork == false }}
227154
with:
228-
repository: ${{ github.repository }}
229-
name: v${{ env.gitVersion_SemVer }}
230-
tag_name: v${{ env.gitVersion_SemVer }}
231-
body: The release process is automated.
232-
generate_release_notes: true
233-
token: ${{ secrets.ES_GITHUB_PAT }}
234-
files: |
235-
.artifacts/kubectl/${{ env.helmChart }}.yaml
155+
name: Test Results
156+
path: .artifacts/TestResults/*.trx
157+
reporter: dotnet-trx
158+
159+
160+
161+
# - name: tools - kubectl - install
162+
# uses: azure/setup-kubectl@v4
163+
164+
# - name: tools - oras - install
165+
# uses: oras-project/setup-oras@v1
166+
167+
# - name: tools - oras - login - ghcr.io
168+
# if: ${{ needs.discovery.outputs.requiresBuildPush == 'true' }}
169+
# run: echo "${{ secrets.ES_GITHUB_PAT }}" | oras login ghcr.io -u ${{ github.actor }} --password-stdin
170+
171+
# - name: tools - helm - install
172+
# uses: azure/setup-helm@v4
173+
174+
# - name: tools - helm - login - ghcr.io
175+
# if: ${{ needs.discovery.outputs.requiresBuildPush == 'true' }}
176+
# run: echo "${{ secrets.ES_GITHUB_PAT }}" | helm registry login ghcr.io -u ${{ github.actor }} --password-stdin
177+
178+
# - name: tools - docker - login ghcr.io
179+
# if: ${{ needs.discovery.outputs.requiresBuildPush == 'true' }}
180+
# uses: docker/login-action@v3
181+
# with:
182+
# registry: ghcr.io
183+
# username: ${{ github.actor }}
184+
# password: ${{ secrets.ES_GITHUB_PAT }}
185+
186+
# - name: tools - docker - login docker.io
187+
# if: ${{ needs.discovery.outputs.requiresBuildPush == 'true' }}
188+
# uses: docker/login-action@v3
189+
# with:
190+
# registry: docker.io
191+
# username: ${{ secrets.ES_DOCKERHUB_USERNAME }}
192+
# password: ${{ secrets.ES_DOCKERHUB_PAT }}
193+
194+
# - name: tools - docker - register QEMU
195+
# run: |
196+
# docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
197+
198+
# - name: tools - docker - setup buildx
199+
# uses: docker/setup-buildx-action@v3
200+
# with:
201+
# driver: docker-container # REQUIRED for multi-platform builds
202+
203+
# - name: artifacts - prepare directories
204+
# run: |
205+
# mkdir -p .artifacts/helm
206+
# mkdir -p .artifacts/kubectl
207+
# mkdir -p .artifacts/artifacthub
208+
209+
# - name: helm - import README
210+
# run: cp README.md ${{ env.helmChartDir }}/README.md
211+
212+
# - name: helm - package chart
213+
# run: helm package --destination .artifacts/helm --version ${{ env.gitVersion_SemVer }} --app-version ${{ env.gitVersion_SemVer }} ${{ env.helmChartDir }}
214+
215+
# - name: helm - template chart
216+
# run: helm template --namespace kube-system ${{ env.helmChart }} .artifacts/helm/${{ env.helmChart }}-${{ env.gitVersion_SemVer }}.tgz > .artifacts/kubectl/${{ env.helmChart }}.yaml
217+
218+
# - name: helm - artifacthub - repo
219+
# run: install -D src/helm/artifacthub-repo.yaml .artifacts/artifacthub/artifacthub-repo.yaml
220+
221+
# - name: docker - build and push
222+
# uses: docker/build-push-action@v6
223+
# with:
224+
# context: ${{ env.containerImageBuildContext }}
225+
# file: ${{ env.containerImageBuildDockerfile }}
226+
# push: ${{ needs.discovery.outputs.requiresBuildPush == 'true' }}
227+
# provenance: false
228+
# platforms: linux/amd64,linux/arm/v7,linux/arm64
229+
# labels: |
230+
# org.opencontainers.image.source=https://github.com/${{ github.repository }}
231+
# org.opencontainers.image.url=https://github.com/${{ github.repository }}
232+
# org.opencontainers.image.vendor=${{ github.repository_owner }}
233+
# org.opencontainers.image.version=${{ env.gitVersion_SemVer }}
234+
# org.opencontainers.image.revision=${{ github.sha }}
235+
# tags: |
236+
# ${{ env.dockerHubContainerImageRepository }}/${{ env.containerImage }}:build-${{ env.gitVersion_SemVer }}
237+
# ${{ env.ghcrContainerImageRepository }}/${{ env.containerImage }}:build-${{ env.gitVersion_SemVer }}
238+
239+
# - name: helm - push - ghcr.io
240+
# run: helm push .artifacts/helm/${{ env.helmChart }}-${{ env.gitVersion_SemVer }}.tgz oci://ghcr.io/${{ github.repository_owner }}/helm-charts
241+
242+
# - name: oras - push - artifact hub metadata
243+
# if: ${{ needs.discovery.outputs.requiresRelease == 'true' }}
244+
# run: |
245+
# oras push ghcr.io/${{ github.repository_owner }}/helm-charts/${{ env.helmChart }}:artifacthub.io \
246+
# --config /dev/null:application/vnd.cncf.artifacthub.config.v1+yaml \
247+
# .artifacts/artifacthub/artifacthub-repo.yaml:application/vnd.cncf.artifacthub.repository-metadata.layer.v1.yaml
248+
249+
# - name: docker - tag and push - latest
250+
# if: ${{ needs.discovery.outputs.requiresRelease == 'true' }}
251+
# run: |
252+
# docker buildx imagetools create \
253+
# --tag ${{ env.dockerHubContainerImageRepository }}/${{ env.containerImage }}:latest \
254+
# --tag ${{ env.ghcrContainerImageRepository }}/${{ env.containerImage }}:latest \
255+
# ${{ env.ghcrContainerImageRepository }}/${{ env.containerImage }}:${{ env.gitVersion_SemVer }}
256+
257+
258+
259+
# - name: github - release - create
260+
# if: ${{ needs.discovery.outputs.requiresRelease == 'true' }}
261+
# uses: softprops/action-gh-release@v2
262+
# with:
263+
# repository: ${{ github.repository }}
264+
# name: v${{ env.gitVersion_SemVer }}
265+
# tag_name: v${{ env.gitVersion_SemVer }}
266+
# body: The release process is automated.
267+
# generate_release_notes: true
268+
# token: ${{ secrets.ES_GITHUB_PAT }}
269+
# files: |
270+
# .artifacts/kubectl/${{ env.helmChart }}.yaml
File renamed without changes.
File renamed without changes.
Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,37 @@
1-
2-
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 17
4-
VisualStudioVersion = 17.0.31710.8
5-
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ES.Kubernetes.Reflector", "ES.Kubernetes.Reflector\ES.Kubernetes.Reflector.csproj", "{96CDE0CF-7782-490B-8AF6-4219DB0236B3}"
7-
EndProject
8-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "....Solution Items", "....Solution Items", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
9-
ProjectSection(SolutionItems) = preProject
10-
Directory.Build.props = Directory.Build.props
11-
Directory.Packages.props = Directory.Packages.props
12-
NuGet.config = NuGet.config
13-
EndProjectSection
14-
EndProject
15-
Global
16-
GlobalSection(SolutionConfigurationPlatforms) = preSolution
17-
Debug|Any CPU = Debug|Any CPU
18-
Release|Any CPU = Release|Any CPU
19-
EndGlobalSection
20-
GlobalSection(ProjectConfigurationPlatforms) = postSolution
21-
{96CDE0CF-7782-490B-8AF6-4219DB0236B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
22-
{96CDE0CF-7782-490B-8AF6-4219DB0236B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
23-
{96CDE0CF-7782-490B-8AF6-4219DB0236B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
24-
{96CDE0CF-7782-490B-8AF6-4219DB0236B3}.Release|Any CPU.Build.0 = Release|Any CPU
25-
EndGlobalSection
26-
GlobalSection(SolutionProperties) = preSolution
27-
HideSolutionNode = FALSE
28-
EndGlobalSection
29-
GlobalSection(ExtensibilityGlobals) = postSolution
30-
SolutionGuid = {3D60B4E7-B886-4E0A-BD09-2AF8EC1BA851}
31-
EndGlobalSection
32-
EndGlobal
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.0.31710.8
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "....Solution Items", "....Solution Items", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
7+
ProjectSection(SolutionItems) = preProject
8+
Directory.Build.props = Directory.Build.props
9+
Directory.Packages.props = Directory.Packages.props
10+
NuGet.config = NuGet.config
11+
EndProjectSection
12+
EndProject
13+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ES.Kubernetes.Reflector", "src\ES.Kubernetes.Reflector\ES.Kubernetes.Reflector.csproj", "{D9295E0C-D3E8-1BE3-F512-1E2579A6882C}"
14+
EndProject
15+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".src", ".src", "{868DDC6B-AB77-4639-A95B-E182CC65AF60}"
16+
EndProject
17+
Global
18+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
19+
Debug|Any CPU = Debug|Any CPU
20+
Release|Any CPU = Release|Any CPU
21+
EndGlobalSection
22+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
23+
{D9295E0C-D3E8-1BE3-F512-1E2579A6882C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24+
{D9295E0C-D3E8-1BE3-F512-1E2579A6882C}.Debug|Any CPU.Build.0 = Debug|Any CPU
25+
{D9295E0C-D3E8-1BE3-F512-1E2579A6882C}.Release|Any CPU.ActiveCfg = Release|Any CPU
26+
{D9295E0C-D3E8-1BE3-F512-1E2579A6882C}.Release|Any CPU.Build.0 = Release|Any CPU
27+
EndGlobalSection
28+
GlobalSection(SolutionProperties) = preSolution
29+
HideSolutionNode = FALSE
30+
EndGlobalSection
31+
GlobalSection(NestedProjects) = preSolution
32+
{D9295E0C-D3E8-1BE3-F512-1E2579A6882C} = {868DDC6B-AB77-4639-A95B-E182CC65AF60}
33+
EndGlobalSection
34+
GlobalSection(ExtensibilityGlobals) = postSolution
35+
SolutionGuid = {3D60B4E7-B886-4E0A-BD09-2AF8EC1BA851}
36+
EndGlobalSection
37+
EndGlobal
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)