Skip to content

chore: sync intra-repo requires for the catalog refresh release (#250) #1

chore: sync intra-repo requires for the catalog refresh release (#250)

chore: sync intra-repo requires for the catalog refresh release (#250) #1

Workflow file for this run

name: ci
on:
push:
branches: [main]
pull_request:
branches: [main]
# After Phase 8 the repo has no root go.mod. Each job iterates the workspace
# modules (discovered via scripts/release.sh modules) and runs the job there.
# Go workspace mode handles cross-module replaces during build.
env:
GO_VERSION: '1.25.8'
jobs:
build:
name: Build all modules
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: '**/go.sum'
- name: Bootstrap go.work
run: |
if [ ! -f go.work ]; then cp go.work.example go.work; fi
- name: Build every module (excluding examples/)
run: |
set -e
fails=0
for dir in $(scripts/release.sh modules); do
case "$dir" in
examples/*) continue ;;
esac
echo "::group::build $dir"
(cd "$dir" && go build ./...) || { fails=$((fails+1)); echo "::error::$dir failed"; }
echo "::endgroup::"
done
[ "$fails" -eq 0 ] || exit 1
unit-test:
name: Unit tests (per module)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: '**/go.sum'
- name: Bootstrap go.work
run: |
if [ ! -f go.work ]; then cp go.work.example go.work; fi
- name: Test every module (excluding tests/, cmd/, examples/)
run: |
set -e
fails=0
for dir in $(scripts/release.sh modules); do
case "$dir" in
tests|tests/*|cmd/*|examples/*) continue ;;
esac
echo "::group::test $dir"
(cd "$dir" && go test -short ./...) || { fails=$((fails+1)); echo "::error::$dir failed"; }
echo "::endgroup::"
done
[ "$fails" -eq 0 ] || exit 1
integration-test:
name: Integration tests (tests/)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: '**/go.sum'
- name: Bootstrap go.work
run: |
if [ ! -f go.work ]; then cp go.work.example go.work; fi
- name: Cache Go build artifacts
uses: actions/cache@v4
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.mod', '**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-build-
- name: Compile test binaries
run: |
cd tests && go test -run ^$ ./...
- name: Run integration tests
run: |
cd tests && go test -v -timeout 300s -count=1 ./...
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: '**/go.sum'
- name: Bootstrap go.work
run: |
if [ ! -f go.work ]; then cp go.work.example go.work; fi
- name: Check goimports across the workspace
run: |
go install golang.org/x/tools/cmd/goimports@latest
output=$(goimports -l .)
if [ -n "$output" ]; then
echo "Files not formatted:"
echo "$output"
exit 1
fi
lint:
name: Lint (per module)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: '**/go.sum'
- name: Bootstrap go.work
run: |
if [ ! -f go.work ]; then cp go.work.example go.work; fi
- name: Install golangci-lint
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.5.0
- name: Cache golangci-lint analysis
uses: actions/cache@v4
with:
path: |
~/.cache/golangci-lint
key: ${{ runner.os }}-golangci-lint-v2.5.0-${{ hashFiles('**/go.sum', '.golangci.yml') }}
restore-keys: |
${{ runner.os }}-golangci-lint-v2.5.0-
- name: Lint every module (excluding examples/)
run: |
set -e
fails=0
for dir in $(scripts/release.sh modules); do
case "$dir" in
examples/*) continue ;;
esac
echo "::group::lint $dir"
(cd "$dir" && golangci-lint run --timeout=5m ./...) \
|| { fails=$((fails+1)); echo "::error::$dir failed"; }
echo "::endgroup::"
done
[ "$fails" -eq 0 ] || exit 1
deps-drift:
name: Intra-repo version drift
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check require lines match latest module tags
run: scripts/sync-deps.sh --check
release-tag:
name: Validate release tag
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/tags/main'
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: '**/go.sum'
- name: Bootstrap go.work
run: |
if [ ! -f go.work ]; then cp go.work.example go.work; fi
- name: Verify the tagged module builds and tests cleanly
run: |
# Tag format: <module-dir>/vX.Y.Z (e.g. llm/openai/v0.1.0)
tag="${GITHUB_REF#refs/tags/}"
mod_dir="${tag%/v*}"
if [ "$mod_dir" = "$tag" ]; then
echo "::warning::Tag $tag is not in <module>/vX.Y.Z form; skipping"
exit 0
fi
if [ ! -f "$mod_dir/go.mod" ]; then
echo "::error::Tag $tag points at $mod_dir but $mod_dir/go.mod is missing"
exit 1
fi
(cd "$mod_dir" && go build ./... && go test -short ./...)