ci: split pgsql shards into plain jobs, dedupe setup actions (#37802)

1. Split the psql matrix jobs into composite actions. Matrix jobs that
can skip do not work with required checks on GitHub because skipped and
unskipped emit different job names (GitHub bug
https://github.com/orgs/community/discussions/9141).
2. Dedupe node and go setup steps into composite actions

Currently test-psql branch protection is disabled, will re-enable when
merging this.

---------

Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: Claude (Opus 4.7) <noreply@anthropic.com>
Co-authored-by: Nicolas <bircni@icloud.com>
This commit is contained in:
silverwind
2026-05-22 21:07:35 +02:00
committed by GitHub
parent 7c12446c1f
commit f95c210abe
8 changed files with 143 additions and 106 deletions

23
.github/actions/go-setup/action.yml vendored Normal file
View File

@@ -0,0 +1,23 @@
name: go-setup
description: Set up go and restore caches
inputs:
cache:
description: Restore go caches
default: "true"
lint-cache:
description: Also restore the golangci-lint cache
default: "false"
runs:
using: composite
steps:
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
check-latest: true
cache: false
- if: ${{ inputs.cache == 'true' }}
uses: ./.github/actions/go-cache
with:
lint-cache: ${{ inputs.lint-cache }}

22
.github/actions/node-setup/action.yml vendored Normal file
View File

@@ -0,0 +1,22 @@
name: node-setup
description: Set up pnpm and node and restore caches
inputs:
cache:
description: Cache pnpm downloads
default: "true"
runs:
using: composite
steps:
- uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
- if: ${{ inputs.cache == 'true' }}
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- if: ${{ inputs.cache != 'true' }}
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24

40
.github/actions/pgsql-shard/action.yml vendored Normal file
View File

@@ -0,0 +1,40 @@
name: pgsql-shard
description: Run one pgsql integration test shard
inputs:
shard:
description: Shard index
required: true
total-shards:
description: Total shard count
required: true
run-migration:
description: Also run migration tests
default: "false"
runs:
using: composite
steps:
- name: Add hosts to /etc/hosts
shell: bash
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 pgsql ldap minio" | sudo tee -a /etc/hosts'
- shell: bash
run: make deps-backend
- shell: bash
run: make backend
env:
TAGS: bindata
- name: run migration tests
if: ${{ inputs.run-migration == 'true' }}
shell: bash
run: GITEA_TEST_DATABASE=pgsql make test-migration
- name: run tests
shell: bash
run: GITEA_TEST_DATABASE=pgsql make test-integration
env:
# pgsql is chosen to be the unlucky one to run with the slow "race detector", it is about 60% slower.
GOTEST_FLAGS: -race -timeout=40m
TAGS: bindata gogit
TEST_LDAP: 1
TEST_SHARD: ${{ inputs.shard }}
TEST_TOTAL_SHARDS: ${{ inputs.total-shards }}