Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
df93b46
CI: give each Go test job its own build cache key
silverwind Apr 23, 2026
57dd81a
CI: drop -coverprofile from unit-tests to enable Go test result cache
silverwind Apr 23, 2026
2c590a1
restart ci
silverwind Apr 23, 2026
32e46ab
CI: rotate Go cache key per-run so new entries persist
silverwind Apr 23, 2026
536377d
CI: drop trailing hyphens from Go cache restore-keys
silverwind Apr 23, 2026
a91e03e
restart ci
silverwind Apr 23, 2026
37290d2
CI: split Go module cache to shared, add arch, cover e2e + lint jobs
silverwind Apr 23, 2026
9309543
CI: drop -race from pgsql and mysql integration tests
silverwind Apr 23, 2026
1c09071
CI: drop per-job build cache on checks-backend and test-e2e
silverwind Apr 23, 2026
f896743
CI: consolidate Go caches into composite action
silverwind Apr 23, 2026
3df7952
CI: share gobuild cache slot and add main-branch seeder
silverwind Apr 23, 2026
12f0856
CI: fix lint-yaml in cache-seeder matrix
silverwind Apr 23, 2026
80ce1eb
Apply suggestion from @silverwind
silverwind Apr 23, 2026
9313735
CI: restore description field on composite action
silverwind Apr 23, 2026
b41542d
CI: extend test-unit cache fallback to shared seeded slot
silverwind Apr 23, 2026
a6193b1
restart ci
silverwind Apr 23, 2026
c650c36
Merge branch 'main' into ci-go-cache-per-job-key
silverwind Apr 23, 2026
74c7cb8
CI: narrow cache-seeder paths to keys that actually invalidate the seed
silverwind Apr 23, 2026
6c77c7c
CI: rename composite action input 'name' to 'cache-name'
silverwind Apr 24, 2026
2d6206b
CI: document PR cache consumption path in seeder header
silverwind Apr 24, 2026
42d438a
Apply suggestion from @silverwind
silverwind Apr 24, 2026
9820fae
Merge branch 'main' into ci-go-cache-per-job-key
silverwind Apr 24, 2026
ad3bf75
CI: reword boolean input descriptions to 'Whether to …' form
silverwind Apr 24, 2026
39fa0ce
Merge branch 'main' into ci-go-cache-per-job-key
silverwind Apr 24, 2026
e0e4e59
CI: pin third-party actions to commit hashes
silverwind Apr 26, 2026
de9cad5
Merge branch 'main' into ci-go-cache-per-job-key
bircni Apr 26, 2026
d233488
Merge branch 'main' into ci-go-cache-per-job-key
GiteaBot Apr 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/actions/go-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: go-caches
description: Restore and save go module, build, and golangci-lint caches

inputs:
cache-name:
description: Short identifier used in the per-caller build cache key
required: true
build-cache:
description: Whether to include ~/.cache/go-build
default: "true"
build-cache-rotate:
description: Whether to rotate the build cache key per run so Go's test result cache can accumulate across runs
default: "false"
lint-cache:
description: Whether to include ~/.cache/golangci-lint
default: "false"

runs:
using: composite
steps:
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/go/pkg/mod
key: gomod-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('go.sum') }}
restore-keys: gomod-${{ runner.os }}-${{ runner.arch }}
- if: ${{ inputs.build-cache == 'true' && inputs.build-cache-rotate == 'true' }}
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.cache/go-build
key: gobuild-${{ runner.os }}-${{ runner.arch }}-${{ inputs.cache-name }}-${{ hashFiles('go.sum') }}-${{ github.run_id }}
restore-keys: |
gobuild-${{ runner.os }}-${{ runner.arch }}-${{ inputs.cache-name }}-${{ hashFiles('go.sum') }}
gobuild-${{ runner.os }}-${{ runner.arch }}-${{ inputs.cache-name }}
gobuild-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('go.sum') }}
gobuild-${{ runner.os }}-${{ runner.arch }}
Comment thread
silverwind marked this conversation as resolved.
- if: ${{ inputs.build-cache == 'true' && inputs.build-cache-rotate != 'true' }}
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.cache/go-build
key: gobuild-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('go.sum') }}
restore-keys: gobuild-${{ runner.os }}-${{ runner.arch }}
Comment thread
silverwind marked this conversation as resolved.
- if: ${{ inputs.lint-cache == 'true' }}
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.cache/golangci-lint
key: golangci-${{ runner.os }}-${{ runner.arch }}-${{ inputs.cache-name }}-${{ hashFiles('go.sum', '.golangci.yml') }}
restore-keys: golangci-${{ runner.os }}-${{ runner.arch }}-${{ inputs.cache-name }}
75 changes: 75 additions & 0 deletions .github/workflows/cache-seeder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Populates the go module, build, and golangci-lint caches under the default
# branch's cache scope so that PR runs have a warm fallback to restore from.
#
# GitHub Actions caches are scoped per ref: a PR run can only write to its own
# branch's scope, but can read from the base branch's scope as a fallback.
# PRs therefore cannot seed main's scope themselves. Running the same cache
# steps on push-to-main is the only opportunity to populate that fallback
# scope so fresh PR branches start with a useful cache on first run.

# A PR job's exact key lives in its own PR-scope (empty on first run, filled
Comment thread
silverwind marked this conversation as resolved.
# by later runs of the same PR); on miss, actions/cache's restore-keys fall
# back to prefix matches against entries this seeder saves in main's scope.

name: cache-seeder
Comment thread
wxiaoguang marked this conversation as resolved.

on:
push:
branches:
- main
paths:
- "go.sum"
- ".golangci.yml"
- ".github/actions/go-cache/action.yml"
- ".github/workflows/cache-seeder.yml"

concurrency:
group: cache-seeder
cancel-in-progress: true

jobs:
gobuild:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
check-latest: true
cache: false
- uses: ./.github/actions/go-cache
with:
cache-name: seed
- run: make deps-backend
- run: TAGS="bindata" make backend
- run: TAGS="bindata sqlite sqlite_unlock_notify" make backend
- run: TAGS="bindata gogit sqlite sqlite_unlock_notify" GOEXPERIMENT="" make backend
Comment thread
silverwind marked this conversation as resolved.

lint:
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- { job: lint-backend, tags: "bindata sqlite sqlite_unlock_notify", target: "lint-backend" }
- { job: lint-go-windows, tags: "bindata sqlite sqlite_unlock_notify", target: "lint-go-windows" }
- { job: lint-go-gogit, tags: "bindata sqlite sqlite_unlock_notify gogit", target: "lint-go" }
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
check-latest: true
cache: false
- uses: ./.github/actions/go-cache
with:
cache-name: ${{ matrix.job }}
lint-cache: "true"
- run: make deps-backend deps-tools
- run: make ${{ matrix.target }}
env:
TAGS: ${{ matrix.tags }}
24 changes: 24 additions & 0 deletions .github/workflows/pull-compliance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ jobs:
with:
go-version-file: go.mod
check-latest: true
cache: false
- uses: ./.github/actions/go-cache
with:
cache-name: lint-backend
lint-cache: "true"
- run: make deps-backend deps-tools
- run: make lint-backend
env:
Expand Down Expand Up @@ -123,6 +128,11 @@ jobs:
with:
go-version-file: go.mod
check-latest: true
cache: false
- uses: ./.github/actions/go-cache
with:
cache-name: lint-go-windows
lint-cache: "true"
- run: make deps-backend deps-tools
- run: make lint-go-windows
env:
Expand All @@ -142,6 +152,11 @@ jobs:
with:
go-version-file: go.mod
check-latest: true
cache: false
- uses: ./.github/actions/go-cache
with:
cache-name: lint-go-gogit
lint-cache: "true"
- run: make deps-backend deps-tools
- run: make lint-go
env:
Expand All @@ -159,6 +174,11 @@ jobs:
with:
go-version-file: go.mod
check-latest: true
cache: false
- uses: ./.github/actions/go-cache
with:
cache-name: checks-backend
build-cache: "false"
- run: make deps-backend deps-tools
- run: make --always-make checks-backend # ensure the "go-licenses" make target runs

Expand Down Expand Up @@ -194,6 +214,10 @@ jobs:
with:
go-version-file: go.mod
check-latest: true
cache: false
- uses: ./.github/actions/go-cache
with:
cache-name: backend
# no frontend build here as backend should be able to build
# even without any frontend files
- run: make deps-backend
Expand Down
29 changes: 25 additions & 4 deletions .github/workflows/pull-db-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
with:
go-version-file: go.mod
check-latest: true
cache: false
- uses: ./.github/actions/go-cache
with:
cache-name: pgsql
- name: Add hosts to /etc/hosts
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 pgsql ldap minio" | sudo tee -a /etc/hosts'
- run: make deps-backend
Expand All @@ -60,7 +64,6 @@ jobs:
timeout-minutes: 50
env:
TAGS: bindata gogit
RACE_ENABLED: true
TEST_TAGS: gogit
TEST_LDAP: 1

Expand All @@ -76,6 +79,10 @@ jobs:
with:
go-version-file: go.mod
check-latest: true
cache: false
- uses: ./.github/actions/go-cache
with:
cache-name: sqlite
- run: make deps-backend
- run: GOEXPERIMENT='' make backend
env:
Expand Down Expand Up @@ -135,23 +142,30 @@ jobs:
with:
go-version-file: go.mod
check-latest: true
cache: false
- uses: ./.github/actions/go-cache
with:
cache-name: unit
build-cache-rotate: "true"
Comment thread
silverwind marked this conversation as resolved.
- name: Add hosts to /etc/hosts
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 minio devstoreaccount1.azurite.local mysql elasticsearch meilisearch smtpimap" | sudo tee -a /etc/hosts'
- run: make deps-backend
- run: make backend
env:
TAGS: bindata
- name: unit-tests
run: make unit-test-coverage test-check
run: make test-backend test-check
env:
TAGS: bindata
RACE_ENABLED: true
GOTESTFLAGS: -timeout=20m
GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }}
- name: unit-tests-gogit
run: GOEXPERIMENT='' make unit-test-coverage test-check
run: GOEXPERIMENT='' make test-backend test-check
env:
TAGS: bindata gogit
RACE_ENABLED: true
GOTESTFLAGS: -timeout=20m
GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }}

test-mysql:
Expand Down Expand Up @@ -190,6 +204,10 @@ jobs:
with:
go-version-file: go.mod
check-latest: true
cache: false
- uses: ./.github/actions/go-cache
with:
cache-name: mysql
- name: Add hosts to /etc/hosts
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts'
- run: make deps-backend
Expand All @@ -203,7 +221,6 @@ jobs:
run: make test-mysql
env:
TAGS: bindata
RACE_ENABLED: true
TEST_INDEXER_CODE_ES_URL: "http://elastic:changeme@elasticsearch:9200"

test-mssql:
Expand Down Expand Up @@ -231,6 +248,10 @@ jobs:
with:
go-version-file: go.mod
check-latest: true
cache: false
- uses: ./.github/actions/go-cache
with:
cache-name: mssql
- name: Add hosts to /etc/hosts
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mssql devstoreaccount1.azurite.local" | sudo tee -a /etc/hosts'
- run: make deps-backend
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/pull-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ jobs:
with:
go-version-file: go.mod
check-latest: true
cache: false
- uses: ./.github/actions/go-cache
with:
cache-name: e2e
build-cache: "false"
- uses: pnpm/action-setup@v5
- uses: actions/setup-node@v6
with:
Expand Down