Skip to content

Checks / PR 38

Checks / PR 38 #231

Workflow file for this run

name: Checks
run-name: Checks / ${{ github.event_name == 'pull_request' && format('PR {0}', github.event.pull_request.number) || github.ref_name }}
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
schedule:
- cron: "41 4 * * 1"
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
NODE_VERSION: 22.22.3
PNPM_VERSION: 11.5.0
BUN_VERSION: 1.3.8
ACTIONLINT_VERSION: 1.7.12
RUST_CACHE_SAVE_IF: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
MOON_BASE: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || '' }}
MOON_HEAD: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
defaults:
run:
shell: bash
jobs:
affected:
name: affected
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
jobs: ${{ steps.plan.outputs.jobs }}
liboliphaunt_runtime_matrix: ${{ steps.plan.outputs.liboliphaunt_runtime_matrix }}
projects: ${{ steps.plan.outputs.projects }}
tasks: ${{ steps.plan.outputs.tasks }}
reason: ${{ steps.plan.outputs.reason }}
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.sha }}
persist-credentials: false
- name: Set up Moon
uses: ./.github/actions/setup-moon
with:
install-workspace: "false"
pnpm-version: ${{ env.PNPM_VERSION }}
- name: Plan affected CI jobs
id: plan
env:
GITHUB_EVENT_NAME: ${{ github.event_name }}
MOON_BASE: ${{ github.event.pull_request.base.sha }}
MOON_HEAD: ${{ github.event.pull_request.head.sha || github.sha }}
run: python3 .github/scripts/plan-affected.py
repo:
name: repo
runs-on: ubuntu-latest
timeout-minutes: 25
permissions:
actions: read
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Moon
uses: ./.github/actions/setup-moon
with:
node-version: ${{ env.NODE_VERSION }}
pnpm-version: ${{ env.PNPM_VERSION }}
- name: Set up Rust tools
uses: ./.github/actions/setup-rust
with:
components: rustfmt
cache-save-if: ${{ env.RUST_CACHE_SAVE_IF }}
tools: prek@0.4.3,zizmor@1.25.2
- name: Install actionlint
run: tools/dev/install-actionlint.sh
- name: Run repository checks
run: |
targets=(repo:check oliphaunt-docs:check policy-tools:check release-tools:check ci-workflows:check)
.github/scripts/run-moon-ci.sh "${targets[@]}"
- name: Collect CI summary
uses: ./.github/actions/collect-ci-summary
release-intent:
name: release-intent
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.sha }}
persist-credentials: false
- name: Set up Rust tools
uses: ./.github/actions/setup-rust
with:
cache-save-if: ${{ env.RUST_CACHE_SAVE_IF }}
tools: prek@0.4.3
- name: Check PR title
if: github.event_name == 'pull_request'
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
printf '%s\n' "$PR_TITLE" > "$RUNNER_TEMP/pr-title.txt"
prek run --stage commit-msg --commit-msg-filename "$RUNNER_TEMP/pr-title.txt"
- name: Check release intent
if: github.event_name == 'pull_request'
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_BRANCH: ${{ github.event.pull_request.head.ref }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
PR_TITLE: ${{ github.event.pull_request.title }}
run: ./.github/scripts/check-release-intent.sh "$PR_TITLE" "$BASE_SHA" "$HEAD_SHA" "$HEAD_BRANCH"
- name: Check HEAD commit subject
run: |
git log -1 --pretty=%s > "$RUNNER_TEMP/head-commit.txt"
prek run --stage commit-msg --commit-msg-filename "$RUNNER_TEMP/head-commit.txt"
liboliphaunt:
name: liboliphaunt (${{ matrix.target }})
needs:
- affected
if: ${{ contains(fromJson(needs.affected.outputs.jobs), 'liboliphaunt') }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.affected.outputs.liboliphaunt_runtime_matrix) }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 120
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Moon
uses: ./.github/actions/setup-moon
with:
pnpm-version: ${{ env.PNPM_VERSION }}
- name: Set up Rust
uses: ./.github/actions/setup-rust
with:
cache-save-if: ${{ env.RUST_CACHE_SAVE_IF }}
- name: Restore native compiler cache
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809
with:
path: |
~/.ccache
${{ matrix.build-root }}
key: liboliphaunt-ccache-${{ matrix.target }}-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('src/postgres18/**', 'src/third-party/**', 'src/extensions/**', 'src/liboliphaunt/bin/**', 'src/liboliphaunt/include/**', 'src/liboliphaunt/patches/**', 'src/liboliphaunt/postgres18/source.toml', 'src/liboliphaunt/src/**') }}
restore-keys: |
liboliphaunt-ccache-${{ matrix.target }}-${{ runner.os }}-${{ runner.arch }}-
- name: Configure native compiler cache
run: .github/scripts/setup-native-build-tools.sh 2G
- name: Run liboliphaunt checks
env:
LIBOLIPHAUNT_CI_TARGET: ${{ matrix.target }}
run: |
if [[ "${LIBOLIPHAUNT_CI_TARGET}" == "windows-x64-msvc" ]]; then
targets=(liboliphaunt:release-runtime liboliphaunt:check)
else
targets=(liboliphaunt:release-runtime liboliphaunt:check liboliphaunt:test)
fi
.github/scripts/run-moon-ci.sh "${targets[@]}"
- name: Show native compiler cache stats
if: ${{ always() }}
run: |
if command -v ccache >/dev/null 2>&1; then
ccache --show-stats
fi
- name: Upload liboliphaunt build logs
if: ${{ failure() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: liboliphaunt-logs-${{ matrix.target }}
path: |
${{ matrix.build-root }}/*.log
target/liboliphaunt/**/*.log
if-no-files-found: ignore
rust-sdk:
name: rust-sdk
needs:
- affected
if: ${{ contains(fromJson(needs.affected.outputs.jobs), 'rust-sdk') }}
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Moon
uses: ./.github/actions/setup-moon
with:
pnpm-version: ${{ env.PNPM_VERSION }}
- name: Set up Rust
uses: ./.github/actions/setup-rust
with:
components: clippy,llvm-tools-preview
cache-save-if: ${{ env.RUST_CACHE_SAVE_IF }}
tools: cargo-nextest@0.9.137,cargo-llvm-cov@0.8.7
- name: Run Rust SDK checks
run: |
targets=(oliphaunt-rust:check oliphaunt-rust:test oliphaunt-rust:package oliphaunt-rust:coverage repo:test)
.github/scripts/run-moon-ci.sh "${targets[@]}"
- name: Upload Rust SDK coverage
if: ${{ hashFiles('target/coverage/oliphaunt-rust/summary.json') != '' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: coverage-oliphaunt-rust
path: target/coverage/oliphaunt-rust
if-no-files-found: error
swift-sdk:
name: swift-sdk
needs:
- affected
if: ${{ contains(fromJson(needs.affected.outputs.jobs), 'swift-sdk') }}
runs-on: macos-latest
timeout-minutes: 90
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Moon
uses: ./.github/actions/setup-moon
with:
pnpm-version: ${{ env.PNPM_VERSION }}
- name: Set up Apple
uses: ./.github/actions/setup-apple
- name: Set up Rust
uses: ./.github/actions/setup-rust
with:
cache-save-if: ${{ env.RUST_CACHE_SAVE_IF }}
- name: Run Swift SDK checks
run: |
targets=(oliphaunt-swift:check oliphaunt-swift:test oliphaunt-swift:package oliphaunt-swift:coverage)
.github/scripts/run-moon-ci.sh "${targets[@]}"
- name: Upload Swift SDK coverage
if: ${{ hashFiles('target/coverage/oliphaunt-swift/summary.json') != '' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: coverage-oliphaunt-swift
path: target/coverage/oliphaunt-swift
if-no-files-found: error
kotlin-sdk:
name: kotlin-sdk
needs:
- affected
if: ${{ contains(fromJson(needs.affected.outputs.jobs), 'kotlin-sdk') }}
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Moon
uses: ./.github/actions/setup-moon
with:
pnpm-version: ${{ env.PNPM_VERSION }}
- name: Set up Android
uses: ./.github/actions/setup-android
- name: Set up Rust
uses: ./.github/actions/setup-rust
with:
cache-save-if: ${{ env.RUST_CACHE_SAVE_IF }}
- name: Run Kotlin SDK checks
run: |
targets=(oliphaunt-kotlin:check oliphaunt-kotlin:test oliphaunt-kotlin:package oliphaunt-kotlin:coverage)
.github/scripts/run-moon-ci.sh "${targets[@]}"
- name: Upload Kotlin SDK coverage
if: ${{ hashFiles('target/coverage/oliphaunt-kotlin/summary.json') != '' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: coverage-oliphaunt-kotlin
path: target/coverage/oliphaunt-kotlin
if-no-files-found: error
react-native-sdk:
name: react-native-sdk
needs:
- affected
if: ${{ contains(fromJson(needs.affected.outputs.jobs), 'react-native-sdk') }}
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Moon
uses: ./.github/actions/setup-moon
with:
pnpm-version: ${{ env.PNPM_VERSION }}
- name: Set up Android
uses: ./.github/actions/setup-android
- name: Set up Rust
uses: ./.github/actions/setup-rust
with:
cache-save-if: ${{ env.RUST_CACHE_SAVE_IF }}
- name: Run React Native SDK checks
run: |
targets=(oliphaunt-react-native:check oliphaunt-react-native:test oliphaunt-react-native:package oliphaunt-react-native:coverage)
.github/scripts/run-moon-ci.sh "${targets[@]}"
- name: Upload React Native SDK coverage
if: ${{ hashFiles('target/coverage/oliphaunt-react-native/summary.json') != '' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: coverage-oliphaunt-react-native
path: target/coverage/oliphaunt-react-native
if-no-files-found: error
typescript-sdk:
name: typescript-sdk
needs:
- affected
if: ${{ contains(fromJson(needs.affected.outputs.jobs), 'typescript-sdk') }}
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Moon
uses: ./.github/actions/setup-moon
with:
pnpm-version: ${{ env.PNPM_VERSION }}
- name: Set up Rust
uses: ./.github/actions/setup-rust
with:
cache-save-if: ${{ env.RUST_CACHE_SAVE_IF }}
- name: Set up Bun
uses: ./.github/actions/setup-bun
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Run TypeScript SDK checks
run: |
targets=(oliphaunt-ts:check oliphaunt-ts:test oliphaunt-ts:package oliphaunt-ts:coverage)
.github/scripts/run-moon-ci.sh "${targets[@]}"
- name: Upload TypeScript SDK coverage
if: ${{ hashFiles('target/coverage/oliphaunt-ts/summary.json') != '' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: coverage-oliphaunt-ts
path: target/coverage/oliphaunt-ts
if-no-files-found: error
wasm:
name: wasm
needs:
- affected
if: ${{ contains(fromJson(needs.affected.outputs.jobs), 'wasm') }}
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Moon
uses: ./.github/actions/setup-moon
with:
pnpm-version: ${{ env.PNPM_VERSION }}
- name: Set up Rust
uses: ./.github/actions/setup-rust
with:
components: llvm-tools-preview
cache-save-if: ${{ env.RUST_CACHE_SAVE_IF }}
tools: cargo-nextest@0.9.137,cargo-llvm-cov@0.8.7
- name: Run WASM checks
run: |
targets=(oliphaunt-wasm:check oliphaunt-wasm:test oliphaunt-wasm:package oliphaunt-wasm:coverage xtask:check oliphaunt-wasm:release-check)
.github/scripts/run-moon-ci.sh "${targets[@]}"
- name: Upload WASM coverage
if: ${{ hashFiles('target/coverage/oliphaunt-wasm/summary.json') != '' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: coverage-oliphaunt-wasm
path: target/coverage/oliphaunt-wasm
if-no-files-found: error
docs:
name: docs
needs:
- affected
if: ${{ contains(fromJson(needs.affected.outputs.jobs), 'docs') }}
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Moon
uses: ./.github/actions/setup-moon
with:
pnpm-version: ${{ env.PNPM_VERSION }}
- name: Run docs checks
run: |
targets=(oliphaunt-docs:check oliphaunt-docs:test oliphaunt-docs:build)
.github/scripts/run-moon-ci.sh "${targets[@]}"
- name: Upload docs preview
if: ${{ hashFiles('target/oliphaunt-docs/build/**') != '' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: oliphaunt-docs-preview
path: target/oliphaunt-docs/build
if-no-files-found: error
coverage-summary:
name: coverage-summary
needs:
- affected
- rust-sdk
- swift-sdk
- kotlin-sdk
- react-native-sdk
- typescript-sdk
- wasm
if: ${{ always() && needs.affected.result == 'success' && contains(fromJson(needs.affected.outputs.jobs), 'coverage-summary') }}
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
persist-credentials: false
- name: Download Rust SDK coverage
continue-on-error: true
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
with:
name: coverage-oliphaunt-rust
path: target/coverage/oliphaunt-rust
- name: Download Swift SDK coverage
continue-on-error: true
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
with:
name: coverage-oliphaunt-swift
path: target/coverage/oliphaunt-swift
- name: Download Kotlin SDK coverage
continue-on-error: true
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
with:
name: coverage-oliphaunt-kotlin
path: target/coverage/oliphaunt-kotlin
- name: Download React Native SDK coverage
continue-on-error: true
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
with:
name: coverage-oliphaunt-react-native
path: target/coverage/oliphaunt-react-native
- name: Download TypeScript SDK coverage
continue-on-error: true
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
with:
name: coverage-oliphaunt-ts
path: target/coverage/oliphaunt-ts
- name: Download WASM coverage
continue-on-error: true
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
with:
name: coverage-oliphaunt-wasm
path: target/coverage/oliphaunt-wasm
- name: Summarize coverage
run: tools/coverage/summarize --allow-missing
- name: Upload aggregate coverage summary
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: coverage-summary
path: |
target/coverage/summary.json
target/coverage/summary.md
if-no-files-found: error
mobile-smoke:
name: mobile-smoke
needs:
- affected
if: ${{ (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && contains(fromJson(needs.affected.outputs.jobs), 'mobile-smoke') }}
runs-on: macos-latest
timeout-minutes: 180
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Moon
uses: ./.github/actions/setup-moon
with:
pnpm-version: ${{ env.PNPM_VERSION }}
- name: Set up Apple
uses: ./.github/actions/setup-apple
- name: Set up Android
uses: ./.github/actions/setup-android
- name: Set up Rust
uses: ./.github/actions/setup-rust
with:
cache-save-if: ${{ env.RUST_CACHE_SAVE_IF }}
- name: Run mobile smoke
run: |
cargo run -p xtask -- assets fetch
pnpm moon run oliphaunt-react-native:smoke-mobile --cache off
release-readiness:
name: release-readiness
needs:
- affected
if: ${{ contains(fromJson(needs.affected.outputs.jobs), 'release-readiness') }}
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Moon
uses: ./.github/actions/setup-moon
with:
pnpm-version: ${{ env.PNPM_VERSION }}
- name: Set up Rust
uses: ./.github/actions/setup-rust
with:
cache-save-if: ${{ env.RUST_CACHE_SAVE_IF }}
- name: Run release readiness checks
run: |
targets=(release-tools:release-check release-tools:consumer-readiness)
.github/scripts/run-moon-ci.sh "${targets[@]}"
required:
name: required
if: ${{ always() }}
needs:
- affected
- repo
- release-intent
- liboliphaunt
- rust-sdk
- swift-sdk
- kotlin-sdk
- react-native-sdk
- typescript-sdk
- wasm
- docs
- coverage-summary
- mobile-smoke
- release-readiness
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Check required jobs
env:
NEEDS_JSON: ${{ toJson(needs) }}
REQUIRED_JOBS: ${{ needs.affected.outputs.jobs }}
run: |
python3 - <<'PY'
import json
import os
import sys
needs = json.loads(os.environ["NEEDS_JSON"])
try:
required_jobs = set(json.loads(os.environ.get("REQUIRED_JOBS") or "[]"))
except json.JSONDecodeError:
required_jobs = set()
required_jobs.add("affected")
failures = []
for job, data in sorted(needs.items()):
result = data["result"]
if result == "success":
continue
if job not in required_jobs and result == "skipped":
continue
failures.append(f"{job}={result}")
if failures:
print("required job failures: " + ", ".join(failures), file=sys.stderr)
raise SystemExit(1)
print("required checks passed")
PY