mirror of
https://github.com/warmbly/warmbly.git
synced 2026-11-28 08:05:45 +00:00
770 lines
25 KiB
YAML
770 lines
25 KiB
YAML
name: CI
|
|
|
|
# main only receives what the merge queue already tested at the same commit,
|
|
# so the merge_group run is the gate and nothing reruns it after the merge.
|
|
on:
|
|
pull_request:
|
|
branches: [main]
|
|
merge_group:
|
|
types: [checks_requested]
|
|
|
|
# Default token only gets `contents: read` on PRs from forks; the
|
|
# dorny/paths-filter action needs to list PR files via the GitHub
|
|
# API, which requires `pull-requests: read`. Without this the
|
|
# "Detect Changes" job dies with "Bad credentials" and every
|
|
# downstream language CI is skipped.
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
changes:
|
|
name: Detect Changes
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
go-services: ${{ steps.filter.outputs.go-services }}
|
|
migrations: ${{ steps.filter.outputs.migrations }}
|
|
aws-deployment: ${{ steps.filter.outputs.aws-deployment }}
|
|
tracking: ${{ steps.filter.outputs.tracking }}
|
|
realtime: ${{ steps.filter.outputs.realtime }}
|
|
web: ${{ steps.filter.outputs.web }}
|
|
admin: ${{ steps.filter.outputs.admin }}
|
|
site: ${{ steps.filter.outputs.site }}
|
|
docs: ${{ steps.filter.outputs.docs }}
|
|
forms: ${{ steps.filter.outputs.forms }}
|
|
portal: ${{ steps.filter.outputs.portal }}
|
|
portal-image: ${{ steps.filter.outputs.portal-image }}
|
|
frontend-images: ${{ steps.filter.outputs.frontend-images }}
|
|
qa: ${{ steps.filter.outputs.qa }}
|
|
make: ${{ steps.filter.outputs.make }}
|
|
ios: ${{ steps.filter.outputs.ios }}
|
|
installer: ${{ steps.filter.outputs.installer }}
|
|
cli-installer: ${{ steps.filter.outputs.cli-installer }}
|
|
pages: ${{ steps.filter.outputs.pages }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dorny/paths-filter@v3
|
|
id: filter
|
|
with:
|
|
filters: |
|
|
go-services:
|
|
- '.github/workflows/ci.yml'
|
|
- 'go.mod'
|
|
- 'go.sum'
|
|
- 'internal/**'
|
|
- 'cmd/**'
|
|
# make lint runs the join-script checks, so a change to the
|
|
# checker itself has to trigger the job that runs it.
|
|
- 'scripts/check-join-script.sh'
|
|
# make lint also checks that every Dockerfile COPY names a path
|
|
# that exists. Nothing else does: build-push.yml runs only on
|
|
# push to main, so a COPY of a file the same PR deleted is green
|
|
# here and breaks main on merge. Both halves of that have to
|
|
# trigger the job: the Dockerfiles, and the trees they copy from.
|
|
- 'scripts/**'
|
|
- 'deploy/docker/**'
|
|
migrations:
|
|
- 'internal/infrastructure/db/**'
|
|
- 'cmd/migrate/**'
|
|
- 'scripts/check-migrations.sh'
|
|
aws-deployment:
|
|
- '.github/workflows/ci.yml'
|
|
- '.github/workflows/deploy-aws.yml'
|
|
- '.github/workflows/configure-backend-aws.yml'
|
|
- '.github/workflows/rotate-keys.yml'
|
|
- '.github/scripts/aws-deploy*.cjs'
|
|
- '.github/scripts/aws-backend-config*.cjs'
|
|
- '.github/scripts/aws-rotate*.cjs'
|
|
- '.github/aws-deploy/**'
|
|
- 'deploy/terraform/aws/runtime/rotate/**'
|
|
tracking:
|
|
- 'tracking/**'
|
|
realtime:
|
|
- 'realtime/**'
|
|
- 'deploy/docker/realtime.Dockerfile'
|
|
web:
|
|
- 'web/**'
|
|
admin:
|
|
- 'admin/**'
|
|
site:
|
|
- 'site/**'
|
|
docs:
|
|
- 'docs/**'
|
|
forms:
|
|
- 'forms/**'
|
|
# The mirrored design engine has a copy in web/; editing only
|
|
# that side must still run the drift check below.
|
|
- 'web/src/components/app/forms/designCore.ts'
|
|
- 'web/src/components/app/forms/form-theme.css'
|
|
- 'scripts/check-forms-mirror.sh'
|
|
portal:
|
|
- 'portal/**'
|
|
- 'deploy/cloudflare/portal/**'
|
|
- 'deploy/docker/portal.Dockerfile'
|
|
- 'deploy/docker/portal/**'
|
|
portal-image:
|
|
- 'deploy/docker/portal.Dockerfile'
|
|
- 'deploy/docker/portal/**'
|
|
# web-ci and admin-ci already build the apps; the image build only
|
|
# adds the Dockerfile and nginx config, so it runs when those change.
|
|
frontend-images:
|
|
- 'web/Dockerfile'
|
|
- 'web/nginx*.conf'
|
|
- 'web/docker-entrypoint.sh'
|
|
- 'web/.dockerignore'
|
|
- 'admin/Dockerfile'
|
|
- 'admin/nginx*.conf'
|
|
- 'admin/docker-entrypoint.sh'
|
|
- 'admin/.dockerignore'
|
|
qa:
|
|
- 'qa/**'
|
|
make:
|
|
- 'integrations/make/**'
|
|
ios:
|
|
- 'ios/**'
|
|
installer:
|
|
- 'site/public/install.sh'
|
|
- 'site/public/install.sh.sha256'
|
|
- 'scripts/check-installer.sh'
|
|
cli-installer:
|
|
- 'site/public/cli.sh'
|
|
- 'site/public/cli.sh.sha256'
|
|
- 'site/public/cli.ps1'
|
|
- 'scripts/check-cli-installer.sh'
|
|
- 'scripts/build-cli.sh'
|
|
pages:
|
|
- '.github/workflows/static-assets.yml'
|
|
- 'deploy/cloudflare/**'
|
|
- '.github/scripts/pages-*'
|
|
- '.github/workflows/release.yml'
|
|
- '.github/workflows/ci.yml'
|
|
- 'web/docker-entrypoint.sh'
|
|
- 'admin/docker-entrypoint.sh'
|
|
- 'web/package.json'
|
|
- 'admin/package.json'
|
|
- 'site/package.json'
|
|
- 'docs/package.json'
|
|
- 'docs/next.config.mjs'
|
|
|
|
pages-ci:
|
|
name: Pages release configuration
|
|
needs: changes
|
|
if: needs.changes.outputs.pages == 'true'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22"
|
|
- name: Check production configuration import
|
|
run: node --test .github/scripts/pages-*.test.mjs deploy/cloudflare/*.test.mjs
|
|
|
|
# Every migration applied in order to an empty database, the way a fresh
|
|
# self-host and the hosted migration task both run them.
|
|
migrations-ci:
|
|
name: Migrations
|
|
needs: changes
|
|
if: needs.changes.outputs.migrations == 'true'
|
|
runs-on: ubuntu-latest
|
|
services:
|
|
postgres:
|
|
image: postgres:16
|
|
env:
|
|
POSTGRES_USER: warmbly
|
|
POSTGRES_PASSWORD: warmbly
|
|
POSTGRES_DB: warmbly
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd "pg_isready -U warmbly -d warmbly"
|
|
--health-interval 2s
|
|
--health-timeout 5s
|
|
--health-retries 30
|
|
env:
|
|
PRIMARY_DB: postgres://warmbly:warmbly@127.0.0.1:5432/warmbly?sslmode=disable
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Check migration versions
|
|
# Runs on the PR's merge commit, so it sees main's versions too. That
|
|
# only holds while the branch is current, so this needs "Require
|
|
# branches to be up to date before merging" in branch protection.
|
|
run: ./scripts/check-migrations.sh
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
cache: true
|
|
|
|
- name: Apply every migration to an empty database
|
|
run: go run ./cmd/migrate
|
|
|
|
- name: Re-run is a no-op
|
|
run: go run ./cmd/migrate
|
|
|
|
go-lint:
|
|
name: Go lint
|
|
needs: changes
|
|
if: needs.changes.outputs.go-services == 'true'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
cache: true
|
|
|
|
# golangci-lint has to be built with the module's Go to read its export
|
|
# data, so the built tools are cached by version instead of rebuilt.
|
|
- name: Tool versions
|
|
id: versions
|
|
run: echo "key=$({ grep -E '^(toolchain|go) ' go.mod; grep -E '^[A-Z_]+_VERSION \?=' Makefile; } | sha256sum | cut -c1-16)" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Restore Go tools
|
|
id: tools
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/go/bin
|
|
key: go-tools-${{ runner.os }}-${{ steps.versions.outputs.key }}
|
|
|
|
- name: Install required Go tools
|
|
if: steps.tools.outputs.cache-hit != 'true'
|
|
run: make setup-tools
|
|
|
|
# A cached protoc skips the download; one whose digest no longer matches is fetched again below.
|
|
- name: Restore protoc
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ runner.temp }}/protoc
|
|
key: protoc-33.6-linux-x86_64-bdf948836dcd45f5
|
|
|
|
# A pinned release verified by digest; Maven Central publishes the same binary as a fallback.
|
|
- name: Set up protoc
|
|
env:
|
|
PROTOC_VERSION: "33.6"
|
|
PROTOC_BIN_SHA256: bdf948836dcd45f5595eb45e0824867965ac1227cc430e957b0482b4fe876d01
|
|
run: |
|
|
set -eu
|
|
dir="$RUNNER_TEMP/protoc/bin"
|
|
bin="$dir/protoc"
|
|
if ! echo "${PROTOC_BIN_SHA256} ${bin}" | sha256sum -c --status - 2>/dev/null; then
|
|
mkdir -p "$dir"
|
|
archive="$RUNNER_TEMP/protoc.zip"
|
|
if curl -fsSL --connect-timeout 10 --max-time 30 --retry 1 --retry-all-errors -o "$archive" \
|
|
"https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip" \
|
|
&& unzip -q -o -j "$archive" bin/protoc -d "$dir"; then
|
|
echo "protoc from GitHub releases"
|
|
else
|
|
echo "GitHub release download failed; fetching protoc ${PROTOC_VERSION} from Maven Central"
|
|
curl -fsSL --connect-timeout 10 --max-time 120 --retry 5 --retry-all-errors -o "$bin" \
|
|
"https://repo1.maven.org/maven2/com/google/protobuf/protoc/4.${PROTOC_VERSION}/protoc-4.${PROTOC_VERSION}-linux-x86_64.exe"
|
|
fi
|
|
echo "${PROTOC_BIN_SHA256} ${bin}" | sha256sum -c -
|
|
chmod +x "$bin"
|
|
fi
|
|
echo "$dir" >> "$GITHUB_PATH"
|
|
|
|
- name: Run golangci-lint
|
|
run: make lint
|
|
|
|
- name: Verify protobuf files are up to date
|
|
run: make check-proto
|
|
|
|
go-test:
|
|
name: Go test
|
|
needs: changes
|
|
if: needs.changes.outputs.go-services == 'true'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
cache: true
|
|
|
|
- name: Run tests
|
|
run: go test ./...
|
|
|
|
# The Kafka images sit behind a build tag the default build never
|
|
# compiles; build rather than vet, because a CGO backend fails at link.
|
|
- name: Verify the Kafka build still compiles and links
|
|
run: go build -tags kafka ./...
|
|
|
|
web-ci:
|
|
name: Web CI
|
|
needs: changes
|
|
if: needs.changes.outputs.web == 'true'
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: web
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: ./.github/actions/setup-pnpm
|
|
with:
|
|
working-directory: web
|
|
|
|
- name: Pages route and asset separation
|
|
run: node scripts/check-pages-routing.mjs
|
|
|
|
- name: Lint
|
|
run: pnpm lint
|
|
|
|
- name: Typecheck
|
|
run: pnpm typecheck
|
|
|
|
- name: Run tests
|
|
run: pnpm test:run
|
|
|
|
- name: Build
|
|
run: pnpm build
|
|
|
|
# The proof harness records against a live local stack, so CI only checks that it compiles and its flows load.
|
|
qa-ci:
|
|
name: QA harness CI
|
|
needs: changes
|
|
if: needs.changes.outputs.qa == 'true'
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: qa
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: ./.github/actions/setup-pnpm
|
|
with:
|
|
working-directory: qa
|
|
node-version: "24"
|
|
|
|
- name: Typecheck
|
|
run: pnpm typecheck
|
|
|
|
- name: Flows load
|
|
run: pnpm exec playwright test --list
|
|
|
|
admin-ci:
|
|
name: Admin CI
|
|
needs: changes
|
|
if: needs.changes.outputs.admin == 'true'
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: admin
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: ./.github/actions/setup-pnpm
|
|
with:
|
|
working-directory: admin
|
|
|
|
- name: Lint
|
|
run: pnpm lint
|
|
|
|
- name: Typecheck
|
|
run: pnpm typecheck
|
|
|
|
- name: Run tests
|
|
run: pnpm test:run
|
|
|
|
- name: Build
|
|
run: pnpm build
|
|
|
|
site-ci:
|
|
name: Site CI
|
|
needs: changes
|
|
if: needs.changes.outputs.site == 'true'
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: site
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: ./.github/actions/setup-pnpm
|
|
with:
|
|
working-directory: site
|
|
node-version: "22"
|
|
|
|
- name: Exception filtering regressions
|
|
run: pnpm test
|
|
|
|
- name: Build
|
|
# Astro project; build catches type errors, broken imports,
|
|
# missing assets. No separate lint/typecheck script is wired
|
|
# in package.json today.
|
|
run: pnpm build
|
|
|
|
docs-ci:
|
|
name: Docs CI
|
|
needs: changes
|
|
if: needs.changes.outputs.docs == 'true'
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: docs
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: ./.github/actions/setup-pnpm
|
|
with:
|
|
working-directory: docs
|
|
node-version: "22"
|
|
|
|
- name: Typecheck
|
|
run: pnpm types:check
|
|
|
|
- name: Lint
|
|
run: pnpm lint
|
|
|
|
forms-ci:
|
|
name: Forms CI
|
|
needs: changes
|
|
if: needs.changes.outputs.forms == 'true'
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: forms
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Check forms mirror
|
|
working-directory: .
|
|
run: ./scripts/check-forms-mirror.sh
|
|
|
|
- uses: ./.github/actions/setup-pnpm
|
|
with:
|
|
working-directory: forms
|
|
|
|
- name: Lint
|
|
run: pnpm lint
|
|
|
|
- name: Typecheck
|
|
run: pnpm typecheck
|
|
|
|
- name: Build
|
|
run: pnpm build
|
|
|
|
# The portal service: the client page app, the service that serves it (portal/worker) and its Cloudflare config.
|
|
portal-ci:
|
|
name: Portal CI
|
|
needs: changes
|
|
if: needs.changes.outputs.portal == 'true'
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: portal
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: ./.github/actions/setup-pnpm
|
|
with:
|
|
working-directory: portal
|
|
node-version: "22"
|
|
|
|
- name: Lint
|
|
run: pnpm lint
|
|
|
|
- name: Typecheck
|
|
run: pnpm typecheck
|
|
|
|
- name: Service tests
|
|
run: pnpm test
|
|
|
|
- name: Build
|
|
run: pnpm build
|
|
|
|
- name: Cloudflare Worker configuration
|
|
working-directory: .
|
|
run: pnpm dlx wrangler@4.45.0 deploy --dry-run --config deploy/cloudflare/portal/wrangler.jsonc --outdir "$RUNNER_TEMP/portal-worker"
|
|
|
|
# The self-host image runs the same modules on workerd; release.yml is the only other place it builds.
|
|
- name: Set up Docker Buildx
|
|
if: needs.changes.outputs.portal-image == 'true'
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build the self-host image (no push)
|
|
if: needs.changes.outputs.portal-image == 'true'
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: deploy/docker/portal.Dockerfile
|
|
push: false
|
|
load: true
|
|
tags: warmbly-portal:ci
|
|
platforms: linux/amd64
|
|
cache-from: type=gha,scope=ci-portal
|
|
cache-to: type=gha,mode=max,scope=ci-portal
|
|
|
|
- name: Self-host image answers
|
|
if: needs.changes.outputs.portal-image == 'true'
|
|
working-directory: .
|
|
run: |
|
|
set -euo pipefail
|
|
docker run -d --name portal-ci -p 127.0.0.1:8095:8095 -e API_ORIGIN=http://127.0.0.1:9 \
|
|
-e PORTAL_DOMAIN=portal.ci.test -e PORTAL_EDGE_TOKEN=ci-portal-edge-token-0123456789abcdef warmbly-portal:ci
|
|
for _ in $(seq 30); do docker exec portal-ci wget -q -O /dev/null http://127.0.0.1:8096/ && break; sleep 1; done
|
|
curl -fsS -o /dev/null -H 'Host: portal.ci.test' http://127.0.0.1:8095/embed.js
|
|
test "$(curl -s -o /dev/null -w '%{http_code}' -H 'Host: portal.ci.test' http://127.0.0.1:8095/)" = 404
|
|
# An unknown host needs a backend lookup, which fails here, so it is a 503 rather than a 404.
|
|
test "$(curl -s -o /dev/null -w '%{http_code}' -H 'Host: other.ci.test' http://127.0.0.1:8095/)" = 503
|
|
docker rm -f portal-ci
|
|
|
|
# The installer is served verbatim from site/public, so what CI checks is
|
|
# exactly what a `curl | sh` executes. The checksum is published next to it
|
|
# for anyone who would rather download, verify and read before running, and
|
|
# it is only useful if it cannot drift.
|
|
installer-ci:
|
|
name: Installer CI
|
|
needs: changes
|
|
if: needs.changes.outputs.installer == 'true'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Check the installer
|
|
run: ./scripts/check-installer.sh
|
|
|
|
cli-installer-ci:
|
|
name: CLI Installer CI
|
|
needs: changes
|
|
if: needs.changes.outputs.cli-installer == 'true'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
# dash is what /bin/sh is on Debian and Ubuntu, which is what most people
|
|
# will pipe this into. Ubuntu runners already have shellcheck and pwsh.
|
|
- name: Install dash
|
|
run: sudo apt-get update && sudo apt-get install -y dash
|
|
|
|
- name: Check the CLI installer
|
|
run: ./scripts/check-cli-installer.sh
|
|
|
|
make-ci:
|
|
name: Make App CI
|
|
needs: changes
|
|
if: needs.changes.outputs.make == 'true'
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: integrations/make
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
|
|
- name: Validate Make app
|
|
# IML is interpreted by Make (no compile step); validate.mjs checks the
|
|
# manifest, JSON validity, code-file references, and component enums.
|
|
run: node scripts/validate.mjs
|
|
|
|
rust-ci:
|
|
name: Rust CI
|
|
needs: changes
|
|
if: needs.changes.outputs.tracking == 'true'
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: tracking
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
# The default tracking build is NATS-only (pure Rust, rustls TLS), so it
|
|
# needs no librdkafka / libcurl / libsasl system headers. Those are only
|
|
# required for the optional `--features kafka` build.
|
|
|
|
# Pinned to whatever the image builds with, not to `stable`. A dependency
|
|
# that raises its rust-version above the builder's is invisible to a
|
|
# `stable` job and surfaces only when the release tries to build the
|
|
# image, which is the worst place to find out.
|
|
- name: Read the builder's Rust version
|
|
id: rust-version
|
|
run: echo "version=$(sed -n 's/^FROM rust:\([0-9.]*\)-alpine.*/\1/p' Dockerfile | head -1)" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Set up Rust
|
|
uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: ${{ steps.rust-version.outputs.version }}
|
|
components: rustfmt, clippy
|
|
|
|
- name: Cache Cargo
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: tracking
|
|
|
|
- name: Check formatting
|
|
run: cargo fmt --check
|
|
|
|
- name: Run Clippy
|
|
run: cargo clippy -- -D warnings
|
|
|
|
- name: Run tests
|
|
run: cargo test
|
|
|
|
# The Kafka publisher is behind a cargo feature, so none of the steps
|
|
# above compile it: `cargo clippy` on the default build never opens
|
|
# kafka.rs. That file ships as the published tracking:*-kafka image, so a
|
|
# break in it would otherwise surface at release time rather than here.
|
|
# This is the Rust half of the `go build -tags kafka` step above.
|
|
# The Debian equivalents of what tracking/Dockerfile installs on alpine
|
|
# for this build. libcurl is needed even though rdkafka-sys configures
|
|
# with -DWITH_CURL=0: librdkafka's rdkafka_conf.c includes curl/curl.h
|
|
# unconditionally, so the build fails at the first object without it.
|
|
- name: Install librdkafka build dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y --no-install-recommends \
|
|
cmake pkg-config libssl-dev libcurl4-openssl-dev libsasl2-dev zlib1g-dev
|
|
|
|
- name: Run Clippy (kafka feature)
|
|
run: cargo clippy --features kafka --all-targets -- -D warnings
|
|
|
|
elixir-ci:
|
|
name: Elixir CI
|
|
needs: changes
|
|
if: needs.changes.outputs.realtime == 'true'
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: realtime
|
|
env:
|
|
MIX_ENV: test
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Elixir
|
|
# mix.exs requires `elixir: "~> 1.18"`. Bumped here to match.
|
|
# Phoenix 1.8 + plug 1.19 also expect a recent OTP.
|
|
uses: erlef/setup-beam@v1
|
|
with:
|
|
elixir-version: "1.18"
|
|
otp-version: "27"
|
|
|
|
- name: Cache deps
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
realtime/deps
|
|
realtime/_build
|
|
key: ${{ runner.os }}-mix-${{ hashFiles('realtime/mix.lock') }}
|
|
restore-keys: ${{ runner.os }}-mix-
|
|
|
|
- name: Install dependencies
|
|
run: mix deps.get
|
|
|
|
- name: Check formatting
|
|
run: mix format --check-formatted
|
|
|
|
- name: Run Credo
|
|
# credo isn't in mix.exs yet; skip when the binary isn't
|
|
# available so CI doesn't false-fail. Re-enable once it's
|
|
# added as a dev dep.
|
|
run: mix help credo > /dev/null 2>&1 && mix credo --strict || echo "credo not installed; skipping"
|
|
|
|
- name: Compile
|
|
# Don't fail the build on transitive warnings — jose/CAStore
|
|
# and a couple of our own files emit deprecation warnings on
|
|
# Elixir 1.18 that aren't fixable without forking deps.
|
|
# Real compile errors still fail the step.
|
|
run: mix compile
|
|
|
|
- name: Run tests
|
|
run: mix test
|
|
|
|
ios-ci:
|
|
name: iOS CI
|
|
needs: changes
|
|
if: needs.changes.outputs.ios == 'true'
|
|
# macOS minutes are 10x Linux; the paths filter keeps this off
|
|
# non-iOS PRs. The app needs the iOS 26 SDK and the Icon Composer
|
|
# .icon app icon, so it must be a macos-26 image.
|
|
runs-on: macos-26
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Select newest Xcode
|
|
run: |
|
|
sudo xcode-select -s "$(ls -d /Applications/Xcode*.app | sort -V | tail -1)"
|
|
xcodebuild -version
|
|
|
|
- name: Build (iOS Simulator, no signing)
|
|
# arm64 only: the generic destination otherwise also builds the
|
|
# x86_64 slice, doubling build time for a compile check.
|
|
run: |
|
|
set -o pipefail
|
|
xcodebuild build \
|
|
-project ios/Warmbly.xcodeproj \
|
|
-scheme Warmbly \
|
|
-destination 'generic/platform=iOS Simulator' \
|
|
ARCHS=arm64 ONLY_ACTIVE_ARCH=YES \
|
|
CODE_SIGNING_ALLOWED=NO
|
|
|
|
# The web/admin production Dockerfiles (build + nginx config check), only
|
|
# when the image side changes; the app build itself is covered above.
|
|
frontend-images:
|
|
name: Frontend Image (${{ matrix.service }})
|
|
needs: changes
|
|
if: needs.changes.outputs.frontend-images == 'true'
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
service: [web, admin]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build image (no push)
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: ./${{ matrix.service }}
|
|
file: ./${{ matrix.service }}/Dockerfile
|
|
push: false
|
|
platforms: linux/amd64
|
|
cache-from: type=gha,scope=ci-${{ matrix.service }}
|
|
cache-to: type=gha,mode=max,scope=ci-${{ matrix.service }}
|
|
|
|
# The one job to mark required in branch protection. Skipped jobs pass
|
|
# (their tree did not change); anything failed or cancelled fails it.
|
|
# Dependency scanning lives in security.yml, off the PR path on purpose.
|
|
aws-deployment-ci:
|
|
name: AWS deployment gates
|
|
needs: changes
|
|
if: needs.changes.outputs.aws-deployment == 'true'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22"
|
|
- name: Install deployment client
|
|
run: npm ci --prefix .github/aws-deploy --omit=dev --ignore-scripts --no-audit --no-fund
|
|
- name: Check deploy, rollback and rotation gates
|
|
env:
|
|
NODE_PATH: ${{ github.workspace }}/.github/aws-deploy/node_modules
|
|
run: node --test .github/scripts/aws-deploy.test.cjs .github/scripts/aws-backend-config.test.cjs .github/scripts/aws-rotate.test.cjs deploy/terraform/aws/runtime/rotate/rotate.test.cjs
|
|
|
|
ci-status:
|
|
name: CI Status
|
|
runs-on: ubuntu-latest
|
|
needs: [changes, migrations-ci, go-lint, go-test, web-ci, qa-ci, admin-ci, site-ci, docs-ci, forms-ci, portal-ci, installer-ci, cli-installer-ci, make-ci, rust-ci, elixir-ci, ios-ci, frontend-images, pages-ci, aws-deployment-ci]
|
|
if: always()
|
|
steps:
|
|
- name: Check CI status
|
|
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
|
|
run: exit 1
|