Skip to content

Commit 63583bd

Browse files
authored
Use own workflow docker build (#1303)
1 parent 7dac41b commit 63583bd

6 files changed

Lines changed: 167 additions & 127 deletions

File tree

.dockerignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,8 @@ teammapper-frontend/node_modules
2525
teammapper-frontend/npm-debug.log
2626
teammapper-frontend/README.md
2727
README.md
28-
teammapper-backend/benchmark
28+
teammapper-backend/benchmark
29+
node_modules
30+
openspec
31+
docs
32+
coverage
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Setup pnpm + Node
2+
description: Activate Node + pnpm via corepack, restore the pnpm store cache, and run a frozen-lockfile install.
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
8+
with:
9+
node-version: '24'
10+
11+
- shell: bash
12+
run: |
13+
corepack enable
14+
corepack prepare pnpm@10.33.4 --activate
15+
16+
- uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
17+
with:
18+
path: ~/.local/share/pnpm/store
19+
key: pnpm-store-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
20+
restore-keys: |
21+
pnpm-store-${{ runner.os }}-
22+
23+
- shell: bash
24+
run: pnpm install --frozen-lockfile

.github/workflows/ci.yml

Lines changed: 14 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Docker Image CI
1+
name: CI
22

33
on:
44
push:
@@ -14,87 +14,45 @@ permissions:
1414
jobs:
1515
teammapper-backend-build:
1616
runs-on: ubuntu-latest
17-
permissions:
18-
contents: read
19-
packages: read
2017

2118
steps:
2219
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
2320

24-
- name: Set up QEMU
25-
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4
26-
2721
- name: Set up Docker Buildx
2822
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4
2923

30-
- name: Login to GitHub Container Registry
31-
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4
32-
with:
33-
registry: ghcr.io
34-
username: ${{ github.repository_owner }}
35-
password: ${{ secrets.GITHUB_TOKEN }}
36-
37-
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
38-
with:
39-
node-version: '24'
40-
41-
- run: corepack enable
42-
- run: corepack prepare pnpm@10.33.4 --activate
43-
44-
- name: Build and export to Docker
24+
- name: Build Docker image (smoke test)
4525
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7
4626
with:
4727
context: .
4828
target: production
4929
tags: |
5030
ghcr.io/b310-digital/teammapper:latest
31+
cache-from: type=gha
32+
cache-to: type=gha,mode=max
5133

5234
teammapper-backend-lint:
5335
runs-on: ubuntu-latest
5436

5537
steps:
5638
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
57-
58-
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
59-
with:
60-
node-version: '24'
61-
62-
- run: corepack enable
63-
- run: corepack prepare pnpm@10.33.4 --activate
64-
65-
- run: pnpm install --frozen-lockfile
39+
- uses: ./.github/actions/setup-pnpm
6640
- run: pnpm --filter teammapper-backend run lint
6741

6842
teammapper-frontend-lint:
6943
runs-on: ubuntu-latest
7044

7145
steps:
7246
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
73-
74-
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
75-
with:
76-
node-version: '24'
77-
78-
- run: corepack enable
79-
- run: corepack prepare pnpm@10.33.4 --activate
80-
81-
- run: pnpm install --frozen-lockfile
47+
- uses: ./.github/actions/setup-pnpm
8248
- run: pnpm --filter teammapper-frontend run lint
8349

8450
teammapper-frontend-tsc:
8551
runs-on: ubuntu-latest
8652

8753
steps:
8854
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
89-
90-
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
91-
with:
92-
node-version: '24'
93-
94-
- run: corepack enable
95-
- run: corepack prepare pnpm@10.33.4 --activate
96-
97-
- run: pnpm install --frozen-lockfile
55+
- uses: ./.github/actions/setup-pnpm
9856
- run: pnpm --filter @teammapper/mermaid-mindmap-parser run build
9957
- run: pnpm --filter teammapper-frontend run tsc
10058

@@ -103,44 +61,26 @@ jobs:
10361

10462
steps:
10563
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
106-
107-
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
108-
with:
109-
node-version: '24'
110-
111-
- run: corepack enable
112-
- run: corepack prepare pnpm@10.33.4 --activate
113-
114-
- run: pnpm install --frozen-lockfile
64+
- uses: ./.github/actions/setup-pnpm
11565
- run: pnpm --filter teammapper-backend run tsc
11666

11767
teammapper-backend-test-e2e:
11868
runs-on: ubuntu-latest
11969

12070
services:
12171
postgres:
122-
image: postgres:10.8
72+
image: postgres:15-alpine
12373
env:
12474
POSTGRES_USER: teammapper-user
12575
POSTGRES_PASSWORD: teammapper-password
12676
POSTGRES_DB: teammapper-backend-test
12777
ports:
128-
# Will assign a random free host port
12978
- 5432/tcp
130-
# Needed because the postgres container does not provide a healthcheck
13179
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
13280

13381
steps:
13482
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
135-
136-
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
137-
with:
138-
node-version: '24'
139-
140-
- run: corepack enable
141-
- run: corepack prepare pnpm@10.33.4 --activate
142-
143-
- run: pnpm install --frozen-lockfile
83+
- uses: ./.github/actions/setup-pnpm
14484
- run: pnpm --filter teammapper-backend run test
14585
env:
14686
POSTGRES_DATABASE: "teammapper-backend-test"
@@ -159,16 +99,10 @@ jobs:
15999

160100
teammapper-frontend-test:
161101
runs-on: ubuntu-latest
102+
162103
steps:
163104
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
164-
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
165-
with:
166-
node-version: '24'
167-
168-
- run: corepack enable
169-
- run: corepack prepare pnpm@10.33.4 --activate
170-
171-
- run: pnpm install --frozen-lockfile
105+
- uses: ./.github/actions/setup-pnpm
172106
- run: pnpm --filter @teammapper/mermaid-mindmap-parser run build
173107
- run: pnpm --filter teammapper-frontend run test
174108

@@ -177,15 +111,7 @@ jobs:
177111

178112
steps:
179113
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
180-
181-
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
182-
with:
183-
node-version: '24'
184-
185-
- run: corepack enable
186-
- run: corepack prepare pnpm@10.33.4 --activate
187-
188-
- run: pnpm install --frozen-lockfile
114+
- uses: ./.github/actions/setup-pnpm
189115
- name: pnpm audit (fail on high/critical production deps)
190116
run: pnpm audit --audit-level=high --prod
191117

@@ -200,4 +126,4 @@ jobs:
200126
uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0
201127
with:
202128
fail-on-severity: high
203-
allow-licenses: MIT, Apache-2.0, BSD-2-Clause, BSD-3-Clause, ISC, 0BSD, CC0-1.0, Unlicense, BlueOak-1.0.0, Zlib, CC-BY-4.0
129+
allow-licenses: MIT, Apache-2.0, BSD-2-Clause, BSD-3-Clause, ISC, 0BSD, CC0-1.0, Unlicense, BlueOak-1.0.0, Zlib, CC-BY-4.0

.github/workflows/playwright.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: Playwright Tests
22
permissions:
33
contents: read
44
on:
5+
push:
6+
branches: [main]
57
pull_request:
68
branches: [main]
79
jobs:
@@ -10,7 +12,7 @@ jobs:
1012
DB_PASSWORD: ${{ secrets.CI_POSTGRES_PASSWORD != '' && secrets.CI_POSTGRES_PASSWORD || format('fallback_ci_password_{0}', github.run_number) }}
1113
services:
1214
postgres:
13-
image: postgres
15+
image: postgres:15-alpine
1416
env:
1517
POSTGRES_USER: postgres
1618
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }}
@@ -20,19 +22,13 @@ jobs:
2022
--health-interval 10s
2123
--health-timeout 5s
2224
--health-retries 5
23-
ports:
25+
ports:
2426
- 5432:5432
25-
timeout-minutes: 60
27+
timeout-minutes: 30
2628
runs-on: ubuntu-latest
2729
steps:
2830
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
29-
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
30-
with:
31-
node-version: '24'
32-
- run: corepack enable
33-
- run: corepack prepare pnpm@10.33.4 --activate
34-
- name: Install dependencies
35-
run: pnpm install --frozen-lockfile
31+
- uses: ./.github/actions/setup-pnpm
3632
- name: Build packages
3733
run: pnpm --filter @teammapper/mermaid-mindmap-parser run build
3834
- name: Cache Playwright browsers
@@ -64,4 +60,4 @@ jobs:
6460
with:
6561
name: playwright
6662
path: teammapper-frontend/playwright
67-
retention-days: 7
63+
retention-days: 7

0 commit comments

Comments
 (0)