-
Notifications
You must be signed in to change notification settings - Fork 3
189 lines (172 loc) · 4.93 KB
/
build-onyx.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
name: Test Onyx Pipeline
# Remove me
on:
workflow_dispatch:
push:
branches:
- "test-onyx-caching"
jobs:
build-onyx:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: ">=1.20.0"
cache: true
cache-dependency-path: |
onyx/go.sum
- name: restore cache if exists
id: cache
uses: actions/cache/restore@v4
with:
path: |
onyx/bin
key: onyx-${{ hashFiles('onyx/**') }}
lookup-only: true
- if: steps.cache.outputs.cache-hit != 'true'
name: Build
working-directory: onyx
run: |
make setup
make build
- name: Save cache
uses: actions/cache/save@v4
with:
path: |
onyx/bin
key: ${{ steps.cache.outputs.cache-primary-key }}
build-typescript-apps:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Cache turbo build setup
uses: actions/cache@v4
with:
path: yaku-apps-typescript/.turbo
key: typescript-apps-turbo-${{ github.sha }}
restore-keys: |
typescript-apps-turbo-
- uses: actions/setup-node@v4
with:
node-version: 18
check-latest: true
cache: 'npm'
cache-dependency-path: yaku-apps-typescript/package-lock.json
- name: restore cache if exists
id: cache
uses: actions/cache/restore@v4
with:
path: yaku-apps-typescript
key: typescript-apps-${{ hashFiles('yaku-apps-typescript/**') }}
- if: steps.cache.outputs.cache-hit != 'true'
name: Install and Build
working-directory: yaku-apps-typescript
run: |
npm ci -ws --include-workspace-root
npm run build
- name: Save cache
uses: actions/cache/save@v4
with:
path: |
yaku-apps-typescript
key: ${{ steps.cache.outputs.cache-primary-key }}
build-backend:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Cache turbo build setup
uses: actions/cache@v4
with:
path: qg-api-service/.turbo
key: backend-turbo-${{ github.sha }}
restore-keys: |
backend-turbo-
- uses: actions/setup-node@v4
with:
node-version: 18.18.2
cache: "npm"
cache-dependency-path: qg-api-service/package-lock.json
- name: restore cache if exists
id: cache
uses: actions/cache/restore@v4
with:
path: qg-api-service
key: qg-api-service-${{ hashFiles('qg-api-service/**') }}
- if: steps.cache.outputs.cache-hit != 'true'
name: Install and build
working-directory: qg-api-service
run: |
npm ci -ws --include-workspace-root
npm run build
- name: Save cache
uses: actions/cache/save@v4
with:
path: |
qg-api-service
key: ${{ steps.cache.outputs.cache-primary-key }}
Build-docker-image:
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io
needs:
- build-onyx
- build-typescript-apps
- build-backend
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: restore onyx cache
uses: actions/cache/restore@v4
with:
path: |
onyx/bin
key: onyx-${{ hashFiles('onyx/**') }}
- name: restore typescript-apps cache
uses: actions/cache/restore@v4
with:
path: |
yaku-apps-typescript
key: typescript-apps-${{ hashFiles('yaku-apps-typescript/**') }}
- name: restore backend cache
uses: actions/cache/restore@v4
with:
path: |
qg-api-service
key: qg-api-service-${{ hashFiles('qg-api-service/**') }}
- name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build docker image
uses: docker/build-push-action@v5
with:
pull: true
push: true
build-args: |
BASE_IMAGE_WORKFLOW_NAME=node:22-alpine
tags: ghcr.io/b-s-f/yaku/api-image-test:test
context: ./qg-api-service
file: qg-api-service/qg-api-service/Dockerfile
platforms: linux/amd64