Skip to content

Commit ade74e8

Browse files
authored
Merge pull request #2 from wundergraph/ondrej/eng-9190-design-and-build-purpose-built-demo-federated-graph-for-2
feat: add caching to CI
2 parents 15e2845 + 28db27d commit ade74e8

2 files changed

Lines changed: 41 additions & 6 deletions

File tree

.github/actions/setup/action.yaml

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
name: "Setup environment"
22
description: "This action install node, pnpm & Go toolchain"
3+
inputs:
4+
setup-go:
5+
# TODO: wgc router plugin build downloads its own Go toolchain (1.24.x) and uses it
6+
# for compilation. When actions/setup-go runs first it sets GOTOOLCHAIN=local, which
7+
# prevents that downloaded Go from auto-upgrading to satisfy go.mod's go directive,
8+
# causing the build to fail. Disable setup-go for jobs that rely on wgc's toolchain
9+
# management until wgc supports using the system Go or exposes a flag for it.
10+
description: "Whether to install the Go toolchain"
11+
default: "false"
12+
required: false
313

414
runs:
515
using: "composite"
@@ -9,8 +19,29 @@ runs:
919
node-version: lts/*
1020

1121
- uses: pnpm/action-setup@v5.0.0
22+
id: pnpm-install
1223
with:
13-
run_install: true
14-
- uses: actions/setup-go@v5
24+
run_install: false
25+
26+
- name: Get pnpm store directory
27+
shell: bash
28+
id: pnpm-cache
29+
run: echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
30+
31+
- uses: actions/cache@v5.0.4
32+
name: Setup pnpm cache
33+
with:
34+
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
35+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
36+
restore-keys: |
37+
${{ runner.os }}-pnpm-store-
38+
39+
- name: Install dependencies
40+
shell: bash
41+
run: pnpm install
42+
43+
- uses: actions/setup-go@v6.3.0
44+
if: ${{ inputs.setup-go == 'true' }}
1545
with:
1646
go-version: 1.25.1
47+
cache-dependency-path: '**/go.sum'

.github/workflows/ci.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,19 @@ jobs:
1414
name: Build
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v6
17+
- uses: actions/checkout@v6.0.2
1818
- uses: ./.github/actions/setup
1919
- run: make build-ci
2020
lint_and_format:
2121
name: Lint & Format
2222
runs-on: ubuntu-latest
2323
steps:
24-
- uses: actions/checkout@v6
24+
- uses: actions/checkout@v6.0.2
2525
- uses: ./.github/actions/setup
26+
with:
27+
setup-go: "true"
2628
- name: golangci-lint
27-
uses: golangci/golangci-lint-action@v9
29+
uses: golangci/golangci-lint-action@v9.2.0
2830
with:
2931
version: v2.11.3
3032
install-only: true
@@ -40,6 +42,8 @@ jobs:
4042
name: Test
4143
runs-on: ubuntu-latest
4244
steps:
43-
- uses: actions/checkout@v6
45+
- uses: actions/checkout@v6.0.2
4446
- uses: ./.github/actions/setup
47+
with:
48+
setup-go: "true"
4549
- run: make test-ci

0 commit comments

Comments
 (0)