Skip to content

Commit da2529b

Browse files
committed
feat: add GitHub Actions workflows for backend, frontend, and release processes
1 parent 8eb137d commit da2529b

3 files changed

Lines changed: 234 additions & 0 deletions

File tree

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: backend-pr-ci
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "backend/**"
7+
- ".github/workflows/backend-pr-ci.yml"
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: backend-pr-ci-${{ github.event.pull_request.number || github.ref }}
15+
cancel-in-progress: true
16+
17+
env:
18+
GO_VERSION: "1.24"
19+
20+
jobs:
21+
lint:
22+
name: Lint
23+
runs-on: ubuntu-latest
24+
timeout-minutes: 10
25+
26+
defaults:
27+
run:
28+
working-directory: backend
29+
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
with:
34+
fetch-depth: 1
35+
36+
- name: Setup Go
37+
uses: actions/setup-go@v5
38+
with:
39+
go-version: ${{ env.GO_VERSION }}
40+
cache-dependency-path: backend/go.sum
41+
42+
- name: Install golangci-lint
43+
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
44+
45+
- name: Run golangci-lint
46+
run: golangci-lint run --timeout=5m
47+
48+
build:
49+
name: Build
50+
runs-on: ubuntu-latest
51+
timeout-minutes: 10
52+
53+
defaults:
54+
run:
55+
working-directory: backend
56+
57+
steps:
58+
- name: Checkout repository
59+
uses: actions/checkout@v4
60+
with:
61+
fetch-depth: 1
62+
63+
- name: Setup Go
64+
uses: actions/setup-go@v5
65+
with:
66+
go-version: ${{ env.GO_VERSION }}
67+
cache-dependency-path: backend/go.sum
68+
69+
- name: Build WASM
70+
run: GOOS=wasip1 GOARCH=wasm go build -buildmode=c-shared -o webhook.wasm .
71+
72+
test:
73+
name: Tests
74+
runs-on: ubuntu-latest
75+
timeout-minutes: 15
76+
77+
defaults:
78+
run:
79+
working-directory: backend
80+
81+
steps:
82+
- name: Checkout repository
83+
uses: actions/checkout@v4
84+
with:
85+
fetch-depth: 1
86+
87+
- name: Setup Go
88+
uses: actions/setup-go@v5
89+
with:
90+
go-version: ${{ env.GO_VERSION }}
91+
cache-dependency-path: backend/go.sum
92+
93+
- name: Run tests (race detector)
94+
run: go test -race -timeout 60s -coverprofile=coverage.out $(go list ./...)
95+
96+
- name: Upload coverage report
97+
uses: actions/upload-artifact@v4
98+
with:
99+
name: coverage-report
100+
path: backend/coverage.out
101+
retention-days: 7
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: frontend-pr-ci
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "frontend/**"
7+
- ".github/workflows/frontend-pr-ci.yml"
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: frontend-pr-ci-${{ github.event.pull_request.number || github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
web-quality:
19+
name: Typecheck and build frontend
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 20
22+
23+
defaults:
24+
run:
25+
working-directory: frontend
26+
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 1
32+
33+
- name: Setup Bun
34+
uses: oven-sh/setup-bun@v2
35+
with:
36+
bun-version: "1.2.23"
37+
38+
- name: Cache Bun packages
39+
uses: actions/cache@v4
40+
with:
41+
path: ~/.bun/install/cache
42+
key: ${{ runner.os }}-bun-${{ hashFiles('frontend/bun.lock') }}
43+
restore-keys: |
44+
${{ runner.os }}-bun-
45+
46+
- name: Install dependencies
47+
run: bun install --frozen-lockfile
48+
49+
- name: Typecheck
50+
run: bun run typecheck
51+
52+
- name: Build production bundle
53+
run: bun run build

.github/workflows/release.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Build and Release Plugin Assets
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
build-and-release:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version: "1.24"
24+
25+
- name: Setup Bun
26+
uses: oven-sh/setup-bun@v2
27+
with:
28+
bun-version: latest
29+
30+
- name: Build backend WASM
31+
working-directory: backend
32+
run: |
33+
set -euo pipefail
34+
mkdir -p ../release/backend
35+
GOOS=wasip1 GOARCH=wasm go build -buildmode=c-shared -o ../release/backend/webhook.wasm .
36+
37+
- name: Build frontend
38+
working-directory: frontend
39+
run: |
40+
set -euo pipefail
41+
bun install --frozen-lockfile
42+
bun run build
43+
44+
- name: Collect release files
45+
run: |
46+
set -euo pipefail
47+
mkdir -p release/frontend
48+
cp -R frontend/dist release/frontend/dist
49+
50+
mkdir -p release/migrations
51+
cp -R backend/migrations/. release/migrations/
52+
53+
cp plugin.json release/plugin.json
54+
55+
- name: Create archives
56+
run: |
57+
set -euo pipefail
58+
tar -czf webhook-backend-wasm.tar.gz -C release/backend webhook.wasm
59+
tar -czf webhook-frontend-dist.tar.gz -C release/frontend dist
60+
tar -czf webhook-migrations.tar.gz -C release migrations
61+
tar -czf webhook-plugin-manifest.tar.gz -C release plugin.json
62+
63+
- name: Generate checksums
64+
run: |
65+
set -euo pipefail
66+
sha256sum webhook-backend-wasm.tar.gz \
67+
webhook-frontend-dist.tar.gz \
68+
webhook-migrations.tar.gz \
69+
webhook-plugin-manifest.tar.gz > checksums.txt
70+
71+
- name: Publish GitHub Release assets
72+
uses: softprops/action-gh-release@v2
73+
with:
74+
generate_release_notes: true
75+
files: |
76+
webhook-backend-wasm.tar.gz
77+
webhook-frontend-dist.tar.gz
78+
webhook-migrations.tar.gz
79+
webhook-plugin-manifest.tar.gz
80+
checksums.txt

0 commit comments

Comments
 (0)