Skip to content

fix(manager): optimize video coverage query (22-47s → <1s) #1657

fix(manager): optimize video coverage query (22-47s → <1s)

fix(manager): optimize video coverage query (22-47s → <1s) #1657

Workflow file for this run

name: forge-ci
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
push:
branches:
- main
jobs:
commit-lint:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.event.pull_request.user.login != 'dependabot[bot]'
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Validate commit messages
run: pnpm exec commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }}
affected:
runs-on: ubuntu-latest
outputs:
services: ${{ steps.affected.outputs.services }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- id: affected
name: Detect affected services
run: |
BASE="${{ github.event.pull_request.base.sha || github.event.before }}"
TURBO_OUT=$(TURBO_SCM_BASE="$BASE" pnpm turbo ls --affected --output=json 2>/dev/null || echo "[]")
SERVICES=$(echo "$TURBO_OUT" | jq -c '
if type == "array" then
[ .[] | if type == "object" then (.name // .package // empty) else . end ]
elif type == "object" and (.packages? | type == "object") and (.packages.items? | type == "array") then
[ .packages.items[] | .name // .package // empty ]
elif type == "object" and (.packages? | type == "array") then
[ .packages[] | if type == "object" then (.name // .package // empty) else . end ]
elif type == "object" and (.tasks? | type == "array") then
[ .tasks[] | if type == "object" then (.name // .package // empty) else . end ]
else
[]
end
| map(select(type == "string" and startswith("@forge/")))
| unique
' 2>/dev/null || echo "[]")
echo "Affected services: $SERVICES"
echo "services=$SERVICES" >> "$GITHUB_OUTPUT"
graphql-generate:
runs-on: ubuntu-latest
needs: affected
if: needs.affected.outputs.services != '[]' && contains(fromJson(needs.affected.outputs.services), '@forge/graphql')
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Verify generated code
run: pnpm turbo run generate --filter=@forge/graphql && git diff --exit-code packages/graphql/src/graphql-env.d.ts
format:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Check format
run: pnpm run format:check
lint:
runs-on: ubuntu-latest
needs: affected
if: needs.affected.outputs.services != '[]'
strategy:
fail-fast: false
matrix:
service: ${{ fromJson(needs.affected.outputs.services) }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Load CI env files
run: |
for f in $(find apps packages -name '.env.ci' 2>/dev/null); do
cp "$f" "$(dirname "$f")/.env"
done
- name: Lint package
run: pnpm --filter "${{ matrix.service }}" run --if-present lint --max-warnings=0
- name: Typecheck
run: pnpm --filter "${{ matrix.service }}" run --if-present typecheck
test:
runs-on: ubuntu-latest
needs: affected
if: needs.affected.outputs.services != '[]'
strategy:
fail-fast: false
matrix:
service: ${{ fromJson(needs.affected.outputs.services) }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Load CI env files
run: |
for f in $(find apps packages -name '.env.ci' 2>/dev/null); do
cp "$f" "$(dirname "$f")/.env"
done
- name: Test package
run: pnpm --filter "${{ matrix.service }}" run --if-present test
build:
runs-on: ubuntu-latest
needs: affected
if: needs.affected.outputs.services != '[]'
strategy:
fail-fast: false
matrix:
service: ${{ fromJson(needs.affected.outputs.services) }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Load CI env files
run: |
for f in $(find apps packages -name '.env.ci' 2>/dev/null); do
cp "$f" "$(dirname "$f")/.env"
done
- name: Build package
run: pnpm --filter "${{ matrix.service }}" run --if-present build