Skip to content

Commit 5638179

Browse files
committed
Initial implementation
1 parent 0bfc9c4 commit 5638179

28 files changed

+2064
-1
lines changed

.claude/settings.local.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(rm:*)",
5+
"Bash(docker build:*)",
6+
"Bash(docker run:*)",
7+
"Bash(docker manifest inspect:*)",
8+
"Bash(docker pull:*)",
9+
"Bash(docker image inspect:*)",
10+
"Bash(docker inspect:*)",
11+
"WebFetch(domain:github.com)",
12+
"Bash(mv:*)",
13+
"WebFetch(domain:learn.microsoft.com)",
14+
"Bash(find:*)",
15+
"Bash(chmod:*)"
16+
],
17+
"deny": []
18+
}
19+
}

.gitattributes

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Set default behavior to automatically normalize line endings.
2+
* text=auto
3+
4+
# Collapse these files in PRs by default
5+
*.xlf linguist-generated=true
6+
*.lcl linguist-generated=true
7+
8+
*.jpg binary
9+
*.png binary
10+
*.gif binary
11+
12+
# Force bash scripts to always use lf line endings so that if a repo is accessed
13+
# in Unix via a file share from Windows, the scripts will work.
14+
*.in text eol=lf
15+
*.sh text eol=lf
16+
17+
# Likewise, force cmd and batch scripts to always use crlf
18+
*.cmd text eol=crlf
19+
*.bat text eol=crlf
20+
21+
*.cs text=auto diff=csharp
22+
*.vb text=auto
23+
*.resx text=auto
24+
*.c text=auto
25+
*.cpp text=auto
26+
*.cxx text=auto
27+
*.h text=auto
28+
*.hxx text=auto
29+
*.py text=auto
30+
*.rb text=auto
31+
*.java text=auto
32+
*.html text=auto
33+
*.htm text=auto
34+
*.css text=auto
35+
*.scss text=auto
36+
*.sass text=auto
37+
*.less text=auto
38+
*.js text=auto
39+
*.lisp text=auto
40+
*.clj text=auto
41+
*.sql text=auto
42+
*.php text=auto
43+
*.lua text=auto
44+
*.m text=auto
45+
*.asm text=auto
46+
*.erl text=auto
47+
*.fs text=auto
48+
*.fsx text=auto
49+
*.hs text=auto
50+
51+
*.csproj text=auto
52+
*.vbproj text=auto
53+
*.fsproj text=auto
54+
*.dbproj text=auto
55+
*.sln text=auto eol=crlf
56+
57+
# Set linguist language for .h files explicitly based on
58+
# https://github.com/github/linguist/issues/1626#issuecomment-401442069
59+
# this only affects the repo's language statistics
60+
*.h linguist-language=C

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "docker"
4+
directory: "/src"
5+
schedule:
6+
interval: "daily"
7+
open-pull-requests-limit: 15
8+
labels:
9+
- "area-dependencies"
10+
groups:
11+
all-dependencies:
12+
patterns:
13+
- "*"

.github/workflows/pipeline.yaml

Lines changed: 253 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,253 @@
1+
name: Pipeline
2+
3+
on:
4+
push:
5+
branches:
6+
- "**" # Matches all branches
7+
pull_request:
8+
branches:
9+
- "**" # Matches all branches
10+
11+
workflow_dispatch:
12+
inputs:
13+
force_build:
14+
description: "Forces a build even if no changes are detected"
15+
required: true
16+
default: "false"
17+
force_release:
18+
description: "Forces a release even if no changes are detected"
19+
required: true
20+
default: "false"
21+
22+
concurrency:
23+
group: pipeline-${{ github.ref_name }}
24+
cancel-in-progress: true
25+
26+
env:
27+
container_image: "github-actions-runner"
28+
container_image_build_context: "src"
29+
container_image_build_dockerfile: "src/Dockerfile"
30+
container_image_repository_dockerhub: "emberstack"
31+
container_image_repository_ghcr: "ghcr.io/emberstack"
32+
33+
jobs:
34+
discovery:
35+
runs-on: ubuntu-latest
36+
permissions:
37+
contents: read
38+
pull-requests: read
39+
outputs:
40+
pathsFilter_src: ${{ steps.pathsFilter.outputs.src }}
41+
gitVersion_SemVer: ${{ steps.gitversion.outputs.GitVersion_SemVer }}
42+
gitVersion_AssemblySemFileVer: ${{ steps.gitversion.outputs.GitVersion_AssemblySemFileVer }}
43+
build: ${{ steps.evaluate_build.outputs.result }}
44+
build_push: ${{ steps.evaluate_build_push.outputs.result }}
45+
build_configuration: ${{ steps.evaluate_build_configuration.outputs.result }}
46+
release: ${{ steps.evaluate_release.outputs.result }}
47+
steps:
48+
- name: checkout
49+
uses: actions/checkout@v4
50+
with:
51+
fetch-depth: 0
52+
53+
- name: tools - dotnet - install
54+
uses: actions/setup-dotnet@v4
55+
with:
56+
dotnet-version: "9.x"
57+
58+
- name: tools - gitversion - install
59+
uses: gittools/actions/gitversion/setup@v4.0.1
60+
with:
61+
versionSpec: "6.x"
62+
preferLatestVersion: true
63+
64+
- name: gitversion - execute
65+
id: gitversion
66+
uses: gittools/actions/gitversion/execute@v4.0.1
67+
with:
68+
configFilePath: GitVersion.yaml
69+
70+
- name: tools - detect changes
71+
id: pathsFilter
72+
uses: dorny/paths-filter@v3
73+
with:
74+
base: ${{ github.ref }}
75+
filters: |
76+
src:
77+
- '*.sln'
78+
- '*.slnx'
79+
- '*.props'
80+
- 'src/**'
81+
build:
82+
- '*.sln'
83+
- '*.slnx'
84+
- '*.props'
85+
- 'src/**'
86+
- 'tests/**'
87+
- 'playground/**'
88+
89+
- name: evaluate - build
90+
id: evaluate_build
91+
env:
92+
RESULT: ${{ steps.pathsFilter.outputs.build == 'true' || github.event.inputs.force_build == 'true' || github.event.inputs.force_release == 'true' }}
93+
run: echo "result=$RESULT" >> $GITHUB_OUTPUT
94+
95+
- name: evaluate - build_push
96+
id: evaluate_build_push
97+
env:
98+
RESULT: ${{ github.actor != 'dependabot[bot]' && github.event_name != 'pull_request' && (steps.pathsFilter.outputs.src == 'true' || github.event.inputs.force_build == 'true') }}
99+
run: echo "result=$RESULT" >> $GITHUB_OUTPUT
100+
101+
- name: evaluate - build_configuration
102+
id: evaluate_build_configuration
103+
env:
104+
RESULT: ${{ github.ref == 'refs/heads/main' && 'Release' || 'Debug' }}
105+
run: echo "result=$RESULT" >> $GITHUB_OUTPUT
106+
107+
- name: evaluate - release
108+
id: evaluate_release
109+
env:
110+
RESULT: ${{ github.ref == 'refs/heads/main' || github.event.inputs.force_release == 'true' }}
111+
run: echo "result=$RESULT" >> $GITHUB_OUTPUT
112+
113+
114+
build:
115+
name: build - ${{ matrix.platform }}
116+
if: ${{ needs.discovery.outputs.build == 'true' }}
117+
needs: [discovery]
118+
strategy:
119+
matrix:
120+
include:
121+
- runner: ubuntu-latest
122+
platform: linux/amd64
123+
- runner: ubuntu-24.04-arm
124+
platform: linux/arm64
125+
runs-on: ${{ matrix.runner }}
126+
env:
127+
build: ${{ needs.discovery.outputs.build }}
128+
build_push: ${{ needs.discovery.outputs.build_push }}
129+
build_configuration: ${{ needs.discovery.outputs.build_configuration }}
130+
gitVersion_SemVer: ${{ needs.discovery.outputs.gitVersion_SemVer }}
131+
gitVersion_AssemblySemFileVer: ${{ needs.discovery.outputs.gitVersion_AssemblySemFileVer }}
132+
steps:
133+
- name: checkout
134+
uses: actions/checkout@v4
135+
136+
- name: tools - docker - login ghcr.io
137+
if: ${{ env.build_push == 'true' }}
138+
uses: docker/login-action@v3
139+
with:
140+
registry: ghcr.io
141+
username: ${{ github.actor }}
142+
password: ${{ secrets.ES_GITHUB_PAT }}
143+
144+
- name: tools - docker - login docker.io
145+
if: ${{ env.build_push == 'true' }}
146+
uses: docker/login-action@v3
147+
with:
148+
registry: docker.io
149+
username: ${{ secrets.ES_DOCKERHUB_USERNAME }}
150+
password: ${{ secrets.ES_DOCKERHUB_PAT }}
151+
152+
- name: tools - docker - setup buildx
153+
uses: docker/setup-buildx-action@v3
154+
155+
- name: docker - build and push
156+
uses: docker/build-push-action@v6
157+
with:
158+
context: ${{ env.container_image_build_context }}
159+
file: ${{ env.container_image_build_dockerfile }}
160+
build-args: |
161+
BUILD_CONFIGURATION=${{ env.build_configuration }}
162+
push: ${{ env.build_push == 'true' }}
163+
provenance: false
164+
platforms: ${{ matrix.platform }}
165+
labels: |
166+
org.opencontainers.image.source=https://github.com/${{ github.repository }}
167+
org.opencontainers.image.url=https://github.com/${{ github.repository }}
168+
org.opencontainers.image.vendor=https://github.com/${{ github.repository_owner }}
169+
org.opencontainers.image.version=${{ env.gitVersion_SemVer }}
170+
org.opencontainers.image.revision=${{ github.sha }}
171+
tags: |
172+
${{ env.container_image_repository_dockerhub }}/${{ env.container_image }}:${{ env.gitVersion_SemVer }}-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
173+
${{ env.container_image_repository_ghcr }}/${{ env.container_image }}:${{ env.gitVersion_SemVer }}-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
174+
175+
manifest:
176+
name: build - manifest
177+
if: ${{ needs.discovery.outputs.build_push == 'true' }}
178+
needs: [discovery, build]
179+
runs-on: ubuntu-latest
180+
env:
181+
gitVersion_SemVer: ${{ needs.discovery.outputs.gitVersion_SemVer }}
182+
steps:
183+
- name: tools - docker - login ghcr.io
184+
uses: docker/login-action@v3
185+
with:
186+
registry: ghcr.io
187+
username: ${{ github.actor }}
188+
password: ${{ secrets.ES_GITHUB_PAT }}
189+
190+
- name: tools - docker - login docker.io
191+
uses: docker/login-action@v3
192+
with:
193+
registry: docker.io
194+
username: ${{ secrets.ES_DOCKERHUB_USERNAME }}
195+
password: ${{ secrets.ES_DOCKERHUB_PAT }}
196+
197+
- name: tools - docker - setup buildx
198+
uses: docker/setup-buildx-action@v3
199+
200+
- name: docker - create and push multi-arch manifest
201+
run: |
202+
docker buildx imagetools create \
203+
--tag ${{ env.container_image_repository_dockerhub }}/${{ env.container_image }}:${{ env.gitVersion_SemVer }} \
204+
--tag ${{ env.container_image_repository_ghcr }}/${{ env.container_image }}:${{ env.gitVersion_SemVer }} \
205+
${{ env.container_image_repository_ghcr }}/${{ env.container_image }}:${{ env.gitVersion_SemVer }}-amd64 \
206+
${{ env.container_image_repository_ghcr }}/${{ env.container_image }}:${{ env.gitVersion_SemVer }}-arm64
207+
208+
release:
209+
name: release
210+
if: ${{ needs.discovery.outputs.release == 'true' && github.ref == 'refs/heads/main' }}
211+
needs: [discovery, manifest]
212+
runs-on: ubuntu-latest
213+
env:
214+
gitVersion_SemVer: ${{ needs.discovery.outputs.gitVersion_SemVer }}
215+
gitVersion_AssemblySemFileVer: ${{ needs.discovery.outputs.gitVersion_AssemblySemFileVer }}
216+
steps:
217+
- name: tools - docker - login ghcr.io
218+
uses: docker/login-action@v3
219+
with:
220+
registry: ghcr.io
221+
username: ${{ github.actor }}
222+
password: ${{ secrets.ES_GITHUB_PAT }}
223+
224+
- name: tools - docker - login docker.io
225+
uses: docker/login-action@v3
226+
with:
227+
registry: docker.io
228+
username: ${{ secrets.ES_DOCKERHUB_USERNAME }}
229+
password: ${{ secrets.ES_DOCKERHUB_PAT }}
230+
231+
- name: tools - docker - setup buildx
232+
uses: docker/setup-buildx-action@v3
233+
234+
- name: docker - tag and push - latest
235+
run: |
236+
docker buildx imagetools create \
237+
--tag ${{ env.container_image_repository_dockerhub }}/${{ env.container_image }}:latest \
238+
--tag ${{ env.container_image_repository_ghcr }}/${{ env.container_image }}:latest \
239+
${{ env.container_image_repository_ghcr }}/${{ env.container_image }}:${{ env.gitVersion_SemVer }}
240+
241+
- name: github - release - create
242+
uses: softprops/action-gh-release@v2
243+
with:
244+
repository: ${{ github.repository }}
245+
name: v${{ env.gitVersion_SemVer }}
246+
tag_name: v${{ env.gitVersion_SemVer }}
247+
body: The release process is automated.
248+
generate_release_notes: true
249+
token: ${{ secrets.ES_GITHUB_PAT }}
250+
251+
252+
253+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: PR - Auto Merge Dependencies
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
dependabot:
14+
runs-on: ubuntu-latest
15+
if: github.event.pull_request.user.login == 'dependabot[bot]'
16+
steps:
17+
- name: Fetch Dependabot metadata
18+
id: metadata
19+
uses: dependabot/fetch-metadata@v2
20+
with:
21+
github-token: "${{ secrets.GITHUB_TOKEN }}"
22+
skip-commit-verification: true
23+
skip-verification: true
24+
25+
- name: Enable auto-merge
26+
run: gh pr merge --auto --squash "$PR_URL"
27+
env:
28+
PR_URL: ${{ github.event.pull_request.html_url }}
29+
GH_TOKEN: ${{ secrets.ES_GITHUB_PAT }}
30+
31+
- name: Approve the PR
32+
run: gh pr review --approve "$PR_URL"
33+
env:
34+
PR_URL: ${{ github.event.pull_request.html_url }}
35+
GH_TOKEN: ${{ secrets.ES_GITHUB_PAT }}

0 commit comments

Comments
 (0)