-
-
Notifications
You must be signed in to change notification settings - Fork 7
142 lines (121 loc) · 3.3 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: CI
on: [push]
permissions:
contents: write
issues: write
pull-requests: write
pages: write
id-token: write
jobs:
backend:
name: Backend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Vet
run: go vet ./...
- name: Test
run: go test ./... -coverprofile=coverage.txt
- name: Upload coverage
uses: paambaati/[email protected]
with:
coverageLocations: ${{github.workspace}}/coverage.txt:gocov
prefix: github.com/YuukanOO/seelf
env:
CC_TEST_REPORTER_ID: ${{ secrets.TEST_REPORTER_ID }}
frontend:
name: Frontend
runs-on: ubuntu-latest
defaults:
run:
working-directory: cmd/serve/front
steps:
- uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Install dependencies
run: npm ci
- name: Check
run: npm run check
- name: Test
run: npm test
build-docs:
name: Build docs
concurrency:
group: pages
cancel-in-progress: false
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Install dependencies
run: npm ci
- name: Build with VitePress
run: npm run docs:build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/.vitepress/dist
deploy-docs:
if: github.ref_name == 'main'
name: Deploy docs
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build-docs
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
release:
name: Release
if: github.ref_name == 'main' || github.ref_name == 'next'
runs-on: ubuntu-latest
needs: [backend, frontend]
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Release
run: npx -p @semantic-release/git -p @semantic-release/exec semantic-release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Build and push # Use a custom action to enable caching
uses: docker/build-push-action@v4
if: env.docker_publish == 'true'
with:
context: .
push: true
platforms: linux/amd64,linux/arm64/v8
tags: ${{ env.docker_tags }}
cache-from: type=gha
cache-to: type=gha,mode=max