Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 20 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: CI
on:
push:
branches: [main]
tags: ["v*"]
pull_request:
branches: [main]

Expand Down Expand Up @@ -55,8 +56,13 @@ jobs:
run: |
if [[ "$EVENT_NAME" == pull_request ]]; then
bun scripts/ci-plan.mjs --base "$BASE_SHA" --head "$GITHUB_SHA"
elif [[ "$GITHUB_REF" == refs/tags/* || "$BEFORE_SHA" =~ ^0+$ || -z "$BEFORE_SHA" ]]; then
# Release tags and the first push have no usable diff base, and the
# release pipeline consumes their candidate artifacts.
bun scripts/ci-plan.mjs --full
else
bun scripts/ci-plan.mjs --full --base "$BEFORE_SHA" --head "$GITHUB_SHA"
# Main pushes plan from the pushed diff so untouched surfaces skip.
bun scripts/ci-plan.mjs --base "$BEFORE_SHA" --head "$GITHUB_SHA"
fi

policy:
Expand Down Expand Up @@ -196,35 +202,13 @@ jobs:
bun-version: ${{ env.BUN_VERSION }}
- env:
OPENPOST_GO_COVERAGE_FILE: coverage.out
OPENPOST_GO_TEST_RACE: "1"
run: bun run test -- backend
- uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
files: backend/coverage.out
fail_ci_if_error: false

backend-race:
name: Backend race tests
needs: plan
if: needs.plan.outputs.backend == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
sparse-checkout: |
/*
!/frontend/static/image-editor-models/
sparse-checkout-cone-mode: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: backend/go.mod
cache-dependency-path: backend/go.sum
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: ${{ env.BUN_VERSION }}
- env:
OPENPOST_GO_TEST_RACE: "1"
run: bun run test -- backend

hosted-data-plane:
name: Hosted PostgreSQL and object storage
needs: plan
Expand Down Expand Up @@ -794,8 +778,18 @@ jobs:
id: manifest
shell: bash
run: |
latest_tag="$(git for-each-ref --count=1 --sort=-version:refname --format='%(refname:short)' 'refs/tags/v*')"
[[ -n "$latest_tag" ]]
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
# The newest tag is the one being built, so version resolution must
# range from the previous release tag; there are no commits after it.
latest_tag="$(git describe --match 'v*' --abbrev=0 "${GITHUB_REF_NAME}^" 2>/dev/null || true)"
[[ -n "$latest_tag" ]] || {
echo "No previous release tag found before ${GITHUB_REF_NAME}." >&2
exit 1
}
else
latest_tag="$(git for-each-ref --count=1 --sort=-version:refname --format='%(refname:short)' 'refs/tags/v*')"
[[ -n "$latest_tag" ]]
fi
bun run check -- provider-certification
bun scripts/release-manifest.mjs create --changelog CHANGELOG.md --latest-tag "$latest_tag" --revision "$GITHUB_SHA" --output release-manifest.json
version="$(jq -er .version release-manifest.json)"
Expand Down Expand Up @@ -891,7 +885,6 @@ jobs:
backend-lint,
frontend-quality,
backend,
backend-race,
hosted-data-plane,
frontend-build,
marketing-build,
Expand Down
29 changes: 20 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,30 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
candidate="$(gh run list \
--repo "$GITHUB_REPOSITORY" \
--workflow CI \
--commit "$GITHUB_SHA" \
--event push \
--limit 20 \
--json databaseId,conclusion \
--jq '[.[] | select(.conclusion == "success")][0].databaseId // empty')"
# The tag-triggered CI run starts alongside this release and builds
# every candidate artifact. Wait for it, then require success.
candidate=""
for _ in $(seq 1 30); do
candidate="$(gh run list \
--repo "$GITHUB_REPOSITORY" \
--workflow CI \
--commit "$GITHUB_SHA" \
--event push \
--limit 20 \
--json databaseId,headBranch \
--jq '[.[] | select(.headBranch == "'"$GITHUB_REF_NAME"'")][0].databaseId // empty' 2>/dev/null || true)"
[[ -n "$candidate" ]] && break
sleep 20
done
[[ -n "$candidate" ]] || {
echo "No successful CI run exists for tagged SHA $GITHUB_SHA." >&2
echo "No CI run exists for tag $GITHUB_REF_NAME on SHA $GITHUB_SHA." >&2
exit 1
}
[[ "$candidate" =~ ^[0-9]+$ ]]
gh run watch "$candidate" \
--repo "$GITHUB_REPOSITORY" \
--exit-status \
--interval 30 > /dev/null
echo "run_id=$candidate" >> "$GITHUB_OUTPUT"
- name: Resolve artifacts from their successful CI attempts
id: artifacts
Expand Down
8 changes: 8 additions & 0 deletions changes/ci-surface-planning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
### Changed

- CI now runs the full release-candidate matrix for release tags instead of
every push to `main`. Main pushes plan from the pushed diff, so untouched
surfaces (for example the Android candidate) skip their jobs, and the release
workflow waits for the tag's own CI run before promoting its artifacts.
- Backend tests run once with the race detector and coverage together instead
of as two separate suites.
Loading