name: CI on: push: branches: [main] 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 }} 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 }} forms: ${{ steps.filter.outputs.forms }} make: ${{ steps.filter.outputs.make }} ios: ${{ steps.filter.outputs.ios }} installer: ${{ steps.filter.outputs.installer }} cli-installer: ${{ steps.filter.outputs.cli-installer }} steps: - uses: actions/checkout@v4 - uses: dorny/paths-filter@v3 id: filter with: filters: | go-services: - '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/migrations/**' - 'scripts/check-migrations.sh' tracking: - 'tracking/**' realtime: - 'realtime/**' - 'deploy/docker/realtime.Dockerfile' web: - 'web/**' admin: - 'admin/**' site: - 'site/**' 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' 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' migrations-ci: name: Migrations needs: changes if: needs.changes.outputs.migrations == 'true' runs-on: ubuntu-latest 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 go-ci: name: Go CI 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: Set up protoc uses: arduino/setup-protoc@v3 with: version: "33.x" repo-token: ${{ github.token }} - name: Install required Go tools run: make setup-tools - name: Run golangci-lint run: make lint - name: Verify protobuf files are up to date run: make check-proto # The Kafka backend sits behind a build tag, so the default build never # compiles it and it can rot unnoticed. Build rather than vet: vet does # not link, and a CGO backend's characteristic failure is a link error. - name: Verify the Kafka build still compiles and links run: go build -tags kafka ./... - name: Run tests with coverage run: | go test -race -coverprofile=coverage.out -covermode=atomic ./... - name: Upload coverage uses: codecov/codecov-action@v4 with: files: coverage.out flags: go fail_ci_if_error: false 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: Lint run: pnpm lint - name: Typecheck run: pnpm typecheck - name: Run tests run: pnpm test:run - name: Build run: pnpm build 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: 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 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 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 # Validate the web/admin production Dockerfiles (build + nginx config check) # without pushing, so a broken image can't reach a release tag unnoticed. The # release workflow is the only other place these build, and only on tags. frontend-images: name: Frontend Image (${{ matrix.service }}) needs: changes if: needs.changes.outputs.web == 'true' || needs.changes.outputs.admin == '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. ci-status: name: CI Status runs-on: ubuntu-latest needs: [changes, migrations-ci, go-ci, web-ci, admin-ci, site-ci, forms-ci, installer-ci, cli-installer-ci, make-ci, rust-ci, elixir-ci, ios-ci, frontend-images] if: always() steps: - name: Check CI status if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') run: exit 1