Barazo default frontend barazo.forum
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

ci(web): composite setup action + lexicons cache + artifact reuse + Next.js cache (#151)

* ci(web): composite setup action, lexicons cache, artifact reuse, Next.js cache

- Extract shared setup into .github/actions/setup composite action
- Cache lexicons build keyed on pnpm-lock.yaml hash, eliminating
redundant clones across 6 jobs
- Accessibility job now downloads build artifact instead of re-running
pnpm build (saves ~2-3 min)
- Add Next.js .next/cache caching for incremental compilation
- Include public/ in build artifact for accessibility job

* fix(ci): add pnpm version to composite action

The web repo doesn't have a packageManager field in package.json, so
pnpm/action-setup needs an explicit version parameter.

* fix(ci): create .next/standalone/.next/ before copying static assets

The downloaded artifact contains .next/standalone/ at the top level but
not the .next/ subdirectory within it. Create it before copying static
assets.

* fix(ci): dereference pnpm symlinks before artifact upload

The Next.js standalone output contains pnpm symlinks in node_modules/
that break when uploaded and downloaded as GitHub Actions artifacts.
Dereference them with `cp -rL` before upload so the accessibility job
gets real files instead of broken symlinks.

Fixes: standalone server crash with "Cannot find module 'styled-jsx'"

* fix(ci): handle broken symlinks before dereferencing standalone

pnpm's .pnpm directory contains broken symlinks that cause cp -rL to
fail. Remove dangling symlinks first with find, then dereference the
valid ones for artifact upload.

* fix(ci): replace artifact reuse with Next.js build cache for accessibility

pnpm's symlinked node_modules in .next/standalone/ cannot survive
GitHub Actions artifact upload/download — broken symlinks cause the
standalone server to crash with missing module errors (styled-jsx).

Instead of artifact transfer, the accessibility job now rebuilds with
the shared Next.js build cache. Same commit = cache hit, so the
rebuild is near-instant while being fully reliable.

authored by

Guido X Jansen and committed by
GitHub
333e8c20 dd9bce4f

+60 -138
+32
.github/actions/setup/action.yml
··· 1 + name: Setup Barazo Web 2 + description: Install pnpm/Node.js, cache and build lexicons, install dependencies 3 + 4 + runs: 5 + using: composite 6 + steps: 7 + - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4 8 + with: 9 + version: 10 10 + 11 + - uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 12 + with: 13 + node-version: 24 14 + cache: 'pnpm' 15 + 16 + - name: Cache lexicons build 17 + id: lexicons-cache 18 + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 19 + with: 20 + path: ../barazo-lexicons 21 + key: lexicons-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} 22 + 23 + - name: Clone and build barazo-lexicons 24 + if: steps.lexicons-cache.outputs.cache-hit != 'true' 25 + shell: bash 26 + run: | 27 + git clone --depth 1 https://github.com/barazo-forum/barazo-lexicons.git ../barazo-lexicons 28 + cd ../barazo-lexicons && pnpm install --ignore-scripts && pnpm run build 29 + 30 + - name: Install dependencies 31 + shell: bash 32 + run: pnpm install --frozen-lockfile
+28 -138
.github/workflows/ci.yml
··· 19 19 runs-on: ubuntu-latest 20 20 timeout-minutes: 10 21 21 steps: 22 - - name: Checkout 23 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 24 - 25 - - name: Install pnpm 26 - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4 27 - with: 28 - version: 10 29 - 30 - - name: Setup Node.js 31 - uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 32 - with: 33 - node-version: '24' 34 - cache: 'pnpm' 35 - 36 - - name: Clone and build barazo-lexicons 37 - run: | 38 - git clone --depth 1 https://github.com/barazo-forum/barazo-lexicons.git ../barazo-lexicons 39 - cd ../barazo-lexicons && pnpm install --ignore-scripts && pnpm run build 40 - 41 - - name: Install dependencies 42 - run: pnpm install --frozen-lockfile 43 - 22 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 23 + - uses: ./.github/actions/setup 44 24 - name: Run ESLint 45 25 run: pnpm lint 46 - 47 26 - name: Check formatting 48 27 run: pnpm format:check 49 28 ··· 52 31 runs-on: ubuntu-latest 53 32 timeout-minutes: 10 54 33 steps: 55 - - name: Checkout 56 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 57 - 58 - - name: Install pnpm 59 - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4 60 - with: 61 - version: 10 62 - 63 - - name: Setup Node.js 64 - uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 65 - with: 66 - node-version: '24' 67 - cache: 'pnpm' 68 - 69 - - name: Clone and build barazo-lexicons 70 - run: | 71 - git clone --depth 1 https://github.com/barazo-forum/barazo-lexicons.git ../barazo-lexicons 72 - cd ../barazo-lexicons && pnpm install --ignore-scripts && pnpm run build 73 - 74 - - name: Install dependencies 75 - run: pnpm install --frozen-lockfile 76 - 34 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 35 + - uses: ./.github/actions/setup 77 36 - name: Run TypeScript 78 37 run: pnpm typecheck 79 38 ··· 82 41 runs-on: ubuntu-latest 83 42 timeout-minutes: 15 84 43 steps: 85 - - name: Checkout 86 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 87 - 88 - - name: Install pnpm 89 - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4 90 - with: 91 - version: 10 92 - 93 - - name: Setup Node.js 94 - uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 95 - with: 96 - node-version: '24' 97 - cache: 'pnpm' 98 - 99 - - name: Clone and build barazo-lexicons 100 - run: | 101 - git clone --depth 1 https://github.com/barazo-forum/barazo-lexicons.git ../barazo-lexicons 102 - cd ../barazo-lexicons && pnpm install --ignore-scripts && pnpm run build 103 - 104 - - name: Install dependencies 105 - run: pnpm install --frozen-lockfile 106 - 44 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 45 + - uses: ./.github/actions/setup 107 46 - name: Run tests 108 47 run: pnpm test 109 48 ··· 113 52 timeout-minutes: 20 114 53 needs: [lint, typecheck, test] 115 54 steps: 116 - - name: Checkout 117 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 118 - 119 - - name: Install pnpm 120 - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4 121 - with: 122 - version: 10 55 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 56 + - uses: ./.github/actions/setup 123 57 124 - - name: Setup Node.js 125 - uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 58 + - name: Cache Next.js build 59 + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 126 60 with: 127 - node-version: '24' 128 - cache: 'pnpm' 129 - 130 - - name: Clone and build barazo-lexicons 131 - run: | 132 - git clone --depth 1 https://github.com/barazo-forum/barazo-lexicons.git ../barazo-lexicons 133 - cd ../barazo-lexicons && pnpm install --ignore-scripts && pnpm run build 134 - 135 - - name: Install dependencies 136 - run: pnpm install --frozen-lockfile 61 + path: .next/cache 62 + key: nextjs-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('src/**', 'public/**', 'next.config.ts') }} 63 + restore-keys: | 64 + nextjs-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}- 65 + nextjs-${{ runner.os }}- 137 66 138 67 - name: Build application 139 68 run: pnpm build 140 69 141 - - name: Upload build artifacts 142 - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 143 - with: 144 - name: build 145 - path: | 146 - .next/standalone/ 147 - .next/static/ 148 - retention-days: 7 149 - 150 70 accessibility: 151 71 name: Accessibility Audit 152 72 runs-on: ubuntu-latest 153 73 timeout-minutes: 30 154 74 needs: build 155 75 steps: 156 - - name: Checkout 157 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 76 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 77 + - uses: ./.github/actions/setup 158 78 159 - - name: Install pnpm 160 - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4 161 - with: 162 - version: 10 79 + - name: Install Playwright browsers 80 + run: pnpm exec playwright install --with-deps chromium 163 81 164 - - name: Setup Node.js 165 - uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 82 + - name: Cache Next.js build 83 + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 166 84 with: 167 - node-version: '24' 168 - cache: 'pnpm' 169 - 170 - - name: Clone and build barazo-lexicons 171 - run: | 172 - git clone --depth 1 https://github.com/barazo-forum/barazo-lexicons.git ../barazo-lexicons 173 - cd ../barazo-lexicons && pnpm install --ignore-scripts && pnpm run build 174 - 175 - - name: Install dependencies 176 - run: pnpm install --frozen-lockfile 177 - 178 - - name: Install Playwright browsers 179 - run: pnpm exec playwright install --with-deps chromium 85 + path: .next/cache 86 + key: nextjs-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('src/**', 'public/**', 'next.config.ts') }} 87 + restore-keys: | 88 + nextjs-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}- 89 + nextjs-${{ runner.os }}- 180 90 181 91 - name: Build application 182 92 run: pnpm build ··· 231 141 runs-on: ubuntu-latest 232 142 timeout-minutes: 10 233 143 steps: 234 - - name: Checkout 235 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 236 - 237 - - name: Install pnpm 238 - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4 239 - with: 240 - version: 10 241 - 242 - - name: Setup Node.js 243 - uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 244 - with: 245 - node-version: '24' 246 - cache: 'pnpm' 247 - 248 - - name: Clone and build barazo-lexicons 249 - run: | 250 - git clone --depth 1 https://github.com/barazo-forum/barazo-lexicons.git ../barazo-lexicons 251 - cd ../barazo-lexicons && pnpm install --ignore-scripts && pnpm run build 252 - 253 - - name: Install dependencies 254 - run: pnpm install --frozen-lockfile 255 - 144 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 145 + - uses: ./.github/actions/setup 256 146 - name: Security audit with retry 257 147 run: | 258 148 for attempt in 1 2 3; do