Skip to content

Commit c46782b

Browse files
authored
Merge pull request #430 from wuespace/feat/backend-go-rewrite
Full rewrite of `backend-go`
2 parents 0061cf6 + d64bb7b commit c46782b

32 files changed

Lines changed: 780 additions & 934 deletions
Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,22 @@
11
name: Backend Go CI
22

3-
# Events that trigger this workflow
4-
on: [ push, pull_request ]
3+
on: [push, pull_request]
54

65
defaults:
76
run:
87
working-directory: ./backend-go
98

109
jobs:
11-
style:
12-
name: Style
13-
runs-on: ubuntu-latest
14-
steps:
15-
- name: Checkout 📥
16-
uses: actions/checkout@v3.6.0
17-
- name: Check style 🧽
18-
run: docker compose --file docker-compose.ci.yml --profile style up --abort-on-container-exit
19-
- name: Stop containers 🛑
20-
if: always()
21-
run: docker compose --file docker-compose.ci.yml --profile style down
22-
2310
test:
2411
name: Test
2512
runs-on: ubuntu-latest
2613
steps:
2714
- name: Checkout 📥
2815
uses: actions/checkout@v3.6.0
29-
- name: Run tests 🛃
30-
run: docker compose --file docker-compose.ci.yml --profile test up --abort-on-container-exit
31-
- name: Stop containers 🛑
32-
if: always()
33-
run: docker compose --file docker-compose.ci.yml --profile test down
16+
- name: Setup Virtual Environment 🛠️
17+
run: |-
18+
../backend-features/tools/setup-venv.sh
19+
- name: Run Tests 🧪
20+
run: |-
21+
. ../backend-features/.venv/bin/activate
22+
../backend-features/run-tests.py -v .

.github/workflows/prerelease.yml

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
name: Prerelease
2+
3+
########################
4+
### Release Pipeline ###
5+
########################
6+
# This pipeline is triggered when a new tag is pushed to the repository.
7+
# This should usually be triggered by creating a GitHub Release in the repository.
8+
# We use a commitless release workflow, meaning no version numbers are written into
9+
# the repository. You can, therefore, tag any commit you want to make it a release.
10+
#
11+
# The pipeline generally consists of two stages:
12+
# 1. Test things to ensure we don't publish any broken code.
13+
# 2. Publish the code to the respective package registry or the like.
14+
#
15+
# These stages are applied to all libraries in this monorepo.
16+
17+
18+
# Only on release tags – prereleases get handled separately.
19+
on:
20+
push:
21+
tags:
22+
- "v[0-9]+.[0-9]+.[0-9]+-**"
23+
24+
# Defines which tool versions should be used in all workflow jobs
25+
env:
26+
node: '22'
27+
pnpm: '9'
28+
29+
# Add the necessary permissions:
30+
# - contents: write
31+
# - id-token: write for the publish-backend-deno job (JSR publishing)
32+
permissions:
33+
contents: write
34+
id-token: write
35+
36+
jobs:
37+
####################
38+
### backend-deno ###
39+
####################
40+
test-backend-deno:
41+
runs-on: ubuntu-latest
42+
defaults:
43+
run:
44+
working-directory: ./backend-deno
45+
steps:
46+
- name: Checkout 📥
47+
uses: actions/checkout@v3.6.0
48+
- name: Setup Virtual Environment 🛠️
49+
run: |-
50+
../backend-features/tools/setup-venv.sh
51+
- name: Run Tests 🧪
52+
run: |-
53+
. ../backend-features/.venv/bin/activate
54+
../backend-features/run-tests.py -v .
55+
publish-backend-deno:
56+
runs-on: ubuntu-latest
57+
needs: test-backend-deno
58+
defaults:
59+
run:
60+
working-directory: ./backend-deno
61+
steps:
62+
- name: Checkout 📥
63+
uses: actions/checkout@v3.6.0
64+
- name: Setup Deno
65+
uses: denolib/setup-deno@v2
66+
with:
67+
deno-version: v2.x
68+
- name: Update version in `deno.json`
69+
run: |
70+
tag=${GITHUB_REF#refs/tags/}
71+
version=${tag#v}
72+
jq --arg version "$version" '.version = $version' deno.json > tmp.$$.json
73+
mv tmp.$$.json deno.json
74+
- name: Publish to JSR
75+
run: deno publish --allow-dirty
76+
##################
77+
### backend-go ###
78+
##################
79+
test-backend-go:
80+
runs-on: ubuntu-latest
81+
defaults:
82+
run:
83+
working-directory: ./backend-go
84+
steps:
85+
- name: Checkout 📥
86+
uses: actions/checkout@v3.6.0
87+
- name: Setup Virtual Environment 🛠️
88+
run: |-
89+
../backend-features/tools/setup-venv.sh
90+
- name: Run Tests 🧪
91+
run: |-
92+
. ../backend-features/.venv/bin/activate
93+
../backend-features/run-tests.py -v .
94+
publish-backend-go:
95+
runs-on: ubuntu-latest
96+
needs: test-backend-go
97+
defaults:
98+
run:
99+
working-directory: ./backend-go
100+
steps:
101+
- name: Checkout 📥
102+
uses: actions/checkout@v3.6.0
103+
- name: Create Go Version Tag
104+
run: |
105+
tag=${GITHUB_REF#refs/tags/}
106+
git tag -a "backend-go/$tag" -m "Go Release $tag"
107+
git push origin "backend-go/$tag"
108+
######################
109+
### frontend-react ###
110+
######################
111+
test-frontend-react:
112+
runs-on: ubuntu-latest
113+
defaults:
114+
run:
115+
working-directory: ./frontend-react
116+
steps:
117+
- name: Checkout 📥
118+
uses: actions/checkout@v3.6.0
119+
- name: Setup PNPM 💿
120+
uses: pnpm/action-setup@v4
121+
with:
122+
version: ${{ env.pnpm }}
123+
- name: Setup Node 💿
124+
uses: actions/setup-node@v3.8.2
125+
with:
126+
node-version: ${{ env.node }}
127+
cache: 'pnpm'
128+
cache-dependency-path: '**/pnpm-lock.yaml'
129+
- name: Install dependencies 📚
130+
run: pnpm install
131+
- name: Run unit tests 🛃
132+
run: |
133+
pnpm run ci:test
134+
publish-frontend-react:
135+
runs-on: ubuntu-latest
136+
needs: test-frontend-react
137+
defaults:
138+
run:
139+
working-directory: ./frontend-react
140+
steps:
141+
- name: Checkout 📥
142+
uses: actions/checkout@v3.6.0
143+
- name: Setup PNPM 💿
144+
uses: pnpm/action-setup@v4
145+
with:
146+
version: ${{ env.pnpm }}
147+
- name: Setup Node 💿
148+
uses: actions/setup-node@v3.8.2
149+
with:
150+
node-version: ${{ env.node }}
151+
cache: 'pnpm'
152+
cache-dependency-path: '**/pnpm-lock.yaml'
153+
- name: Install dependencies 📚
154+
run: pnpm install
155+
- name: Build 🏗️
156+
run: pnpm run build
157+
- name: Update version in `package.json`
158+
run: |
159+
tag=${GITHUB_REF#refs/tags/}
160+
version=${tag#v}
161+
jq --arg version "$version" '.version = $version' package.json > tmp.$$.json
162+
mv tmp.$$.json package.json
163+
- name: Publish to NPM 📦
164+
run: pnpm publish --access public --no-git-checks --tag next
165+
env:
166+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
167+
NPM_CONFIG_PROVENANCE: true

.github/workflows/release.yml

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
name: Release
2+
3+
########################
4+
### Release Pipeline ###
5+
########################
6+
# This pipeline is triggered when a new tag is pushed to the repository.
7+
# This should usually be triggered by creating a GitHub Release in the repository.
8+
# We use a commitless release workflow, meaning no version numbers are written into
9+
# the repository. You can, therefore, tag any commit you want to make it a release.
10+
#
11+
# The pipeline generally consists of two stages:
12+
# 1. Test things to ensure we don't publish any broken code.
13+
# 2. Publish the code to the respective package registry or the like.
14+
#
15+
# These stages are applied to all libraries in this monorepo.
16+
17+
18+
# Only on release tags – prereleases get handled separately.
19+
on:
20+
push:
21+
tags:
22+
- "v[0-9]+.[0-9]+.[0-9]+"
23+
24+
# Defines which tool versions should be used in all workflow jobs
25+
env:
26+
node: '22'
27+
pnpm: '9'
28+
29+
# Add the necessary permissions:
30+
# - contents: write
31+
# - id-token: write for the publish-backend-deno job (JSR publishing)
32+
permissions:
33+
contents: write
34+
id-token: write
35+
36+
jobs:
37+
####################
38+
### backend-deno ###
39+
####################
40+
test-backend-deno:
41+
runs-on: ubuntu-latest
42+
defaults:
43+
run:
44+
working-directory: ./backend-deno
45+
steps:
46+
- name: Checkout 📥
47+
uses: actions/checkout@v3.6.0
48+
- name: Setup Virtual Environment 🛠️
49+
run: |-
50+
../backend-features/tools/setup-venv.sh
51+
- name: Run Tests 🧪
52+
run: |-
53+
. ../backend-features/.venv/bin/activate
54+
../backend-features/run-tests.py -v .
55+
publish-backend-deno:
56+
runs-on: ubuntu-latest
57+
needs: test-backend-deno
58+
defaults:
59+
run:
60+
working-directory: ./backend-deno
61+
steps:
62+
- name: Checkout 📥
63+
uses: actions/checkout@v3.6.0
64+
- name: Setup Deno
65+
uses: denolib/setup-deno@v2
66+
with:
67+
deno-version: v2.x
68+
- name: Update version in `deno.json`
69+
run: |
70+
tag=${GITHUB_REF#refs/tags/}
71+
version=${tag#v}
72+
jq --arg version "$version" '.version = $version' deno.json > tmp.$$.json
73+
mv tmp.$$.json deno.json
74+
- name: Publish to JSR
75+
run: deno publish --allow-dirty
76+
##################
77+
### backend-go ###
78+
##################
79+
test-backend-go:
80+
runs-on: ubuntu-latest
81+
defaults:
82+
run:
83+
working-directory: ./backend-go
84+
steps:
85+
- name: Checkout 📥
86+
uses: actions/checkout@v3.6.0
87+
- name: Setup Virtual Environment 🛠️
88+
run: |-
89+
../backend-features/tools/setup-venv.sh
90+
- name: Run Tests 🧪
91+
run: |-
92+
. ../backend-features/.venv/bin/activate
93+
../backend-features/run-tests.py -v .
94+
publish-backend-go:
95+
runs-on: ubuntu-latest
96+
needs: test-backend-go
97+
defaults:
98+
run:
99+
working-directory: ./backend-go
100+
steps:
101+
- name: Checkout 📥
102+
uses: actions/checkout@v3.6.0
103+
- name: Create Go Version Tag
104+
run: |
105+
tag=${GITHUB_REF#refs/tags/}
106+
git tag -a "backend-go/$tag" -m "Go Release $tag"
107+
git push origin "backend-go/$tag"
108+
######################
109+
### frontend-react ###
110+
######################
111+
test-frontend-react:
112+
runs-on: ubuntu-latest
113+
defaults:
114+
run:
115+
working-directory: ./frontend-react
116+
steps:
117+
- name: Checkout 📥
118+
uses: actions/checkout@v3.6.0
119+
- name: Setup PNPM 💿
120+
uses: pnpm/action-setup@v4
121+
with:
122+
version: ${{ env.pnpm }}
123+
- name: Setup Node 💿
124+
uses: actions/setup-node@v3.8.2
125+
with:
126+
node-version: ${{ env.node }}
127+
cache: 'pnpm'
128+
cache-dependency-path: '**/pnpm-lock.yaml'
129+
- name: Install dependencies 📚
130+
run: pnpm install
131+
- name: Run unit tests 🛃
132+
run: |
133+
pnpm run ci:test
134+
publish-frontend-react:
135+
runs-on: ubuntu-latest
136+
needs: test-frontend-react
137+
defaults:
138+
run:
139+
working-directory: ./frontend-react
140+
steps:
141+
- name: Checkout 📥
142+
uses: actions/checkout@v3.6.0
143+
- name: Setup PNPM 💿
144+
uses: pnpm/action-setup@v4
145+
with:
146+
version: ${{ env.pnpm }}
147+
- name: Setup Node 💿
148+
uses: actions/setup-node@v3.8.2
149+
with:
150+
node-version: ${{ env.node }}
151+
cache: 'pnpm'
152+
cache-dependency-path: '**/pnpm-lock.yaml'
153+
- name: Install dependencies 📚
154+
run: pnpm install
155+
- name: Build 🏗️
156+
run: pnpm run build
157+
- name: Update version in `package.json`
158+
run: |
159+
tag=${GITHUB_REF#refs/tags/}
160+
version=${tag#v}
161+
jq --arg version "$version" '.version = $version' package.json > tmp.$$.json
162+
mv tmp.$$.json package.json
163+
- name: Publish to NPM 📦
164+
run: pnpm publish --access public --no-git-checks
165+
env:
166+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
167+
NPM_CONFIG_PROVENANCE: true

backend-deno/deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@wuespace/telestion",
33
"license": "MIT",
4-
"version": "1.0.0-alpha.4",
4+
"version": "0.0.0-to-be-replaced-by-ci",
55
"exports": "./mod.ts",
66
"publish": {
77
"include": [

backend-deno/samples/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
FROM denoland/deno:alpine-2.1.2
2-
LABEL version="1.0.0-alpha.4" maintainer="WüSpace e. V. <telestion@wuespace.de>"
2+
LABEL maintainer="WüSpace e. V. <telestion@wuespace.de>"
33

44
# Add files
55
COPY ./mod.ts /app/mod.ts

0 commit comments

Comments
 (0)