Skip to content

Commit f5975fd

Browse files
committed
build: add ci and deployment tooling
1 parent e64c97d commit f5975fd

File tree

8 files changed

+615
-0
lines changed

8 files changed

+615
-0
lines changed

.github/workflows/docs.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Deploy Documentation
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ main ]
7+
paths:
8+
- 'docs/**'
9+
- 'docusaurus.config.ts'
10+
- 'sidebars.ts'
11+
- 'package.json'
12+
- '.github/workflows/docs.yml'
13+
pull_request:
14+
branches: [ main ]
15+
paths:
16+
- 'docs/**'
17+
- 'docusaurus.config.ts'
18+
- 'sidebars.ts'
19+
- 'package.json'
20+
21+
permissions:
22+
contents: read
23+
pages: write
24+
id-token: write
25+
26+
concurrency:
27+
group: "pages"
28+
cancel-in-progress: false
29+
30+
jobs:
31+
build:
32+
runs-on: ubuntu-latest
33+
defaults:
34+
run:
35+
working-directory: ./docs
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v4
39+
40+
- name: Setup Node.js
41+
uses: actions/setup-node@v4
42+
with:
43+
node-version: '20'
44+
cache: npm
45+
cache-dependency-path: ./docs/package-lock.json
46+
47+
- name: Install dependencies
48+
run: npm ci
49+
50+
- name: Build website
51+
run: npm run build
52+
53+
- name: Setup Pages
54+
if: github.ref == 'refs/heads/main'
55+
uses: actions/configure-pages@v5
56+
57+
- name: Upload artifact
58+
if: github.ref == 'refs/heads/main'
59+
uses: actions/upload-pages-artifact@v3
60+
with:
61+
path: ./docs/build
62+
63+
deploy:
64+
if: github.ref == 'refs/heads/main'
65+
environment:
66+
name: github-pages
67+
url: ${{ steps.deployment.outputs.page_url }}
68+
runs-on: ubuntu-latest
69+
needs: build
70+
steps:
71+
- name: Deploy to GitHub Pages
72+
id: deployment
73+
uses: actions/deploy-pages@v4

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release MCPulse
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- 'v*'
8+
9+
permissions:
10+
contents: write
11+
packages: write
12+
13+
jobs:
14+
goreleaser:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set up Go
23+
uses: actions/setup-go@v5
24+
with:
25+
go-version: '1.24'
26+
27+
- name: Setup Node.js
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: '20'
31+
cache: npm
32+
cache-dependency-path: ./web/package-lock.json
33+
34+
- name: Login to GitHub Container Registry
35+
uses: docker/login-action@v3
36+
with:
37+
registry: ghcr.io
38+
username: ${{ github.actor }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Run GoReleaser
42+
uses: goreleaser/goreleaser-action@v6
43+
with:
44+
distribution: goreleaser
45+
version: '~> v2'
46+
args: release --clean
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Test
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ main ]
7+
pull_request:
8+
branches: [ main ]
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
go-version: [1.23, 1.24]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '20'
24+
cache: npm
25+
cache-dependency-path: ./web/package-lock.json
26+
27+
- name: Build web interface
28+
run: |
29+
cd web
30+
npm ci
31+
npm run build
32+
33+
34+
- name: Set up Go
35+
uses: actions/setup-go@v5
36+
with:
37+
go-version: ${{ matrix.go-version }}
38+
39+
- name: Cache Go modules
40+
uses: actions/cache@v4
41+
with:
42+
path: ~/go/pkg/mod
43+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
44+
restore-keys: |
45+
${{ runner.os }}-go-
46+
47+
- name: Download dependencies
48+
run: go mod download
49+
50+
- name: Run go vet
51+
run: go vet ./...
52+
53+
- name: Run golangci-lint
54+
uses: golangci/golangci-lint-action@v6
55+
with:
56+
version: latest
57+
58+
- name: Run tests with coverage
59+
run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
60+
61+
- name: Generate coverage report
62+
run: go tool cover -func=coverage.out
63+
64+
- name: Upload coverage to Codecov
65+
if: matrix.go-version == '1.24'
66+
uses: codecov/codecov-action@v4
67+
with:
68+
file: ./coverage.out
69+
flags: unittests
70+
name: codecov-umbrella
71+
fail_ci_if_error: false

0 commit comments

Comments
 (0)