Skip to content

improve performance of the graph aggregation #1082

improve performance of the graph aggregation

improve performance of the graph aggregation #1082

name: JS Package Tests
on:
push:
branches: [main]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
actions: write
contents: read
pull-requests: read
jobs:
determine_jobs:
name: Determine jobs to run
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: CI related changes
id: ci
uses: technote-space/get-diff-action@v6
with:
PATTERNS: |
.github/actions/**
.github/workflows/test-js-packages.yml
- name: /packages related changes
id: packages
uses: technote-space/get-diff-action@v6
with:
PATTERNS: |
packages/**
- name: Docs related changes
id: docs
uses: technote-space/get-diff-action@v6
with:
PATTERNS: |
docs/**
outputs:
ci: ${{ steps.ci.outputs.diff != ''}}
packages: ${{ steps.packages.outputs.diff != '' }}
docs: ${{ steps.docs.outputs.diff != '' }}
js_packages:
name: JS Package Tests
timeout-minutes: 30
if: needs.determine_jobs.outputs.ci == 'true' || needs.determine_jobs.outputs.packages == 'true' || needs.determine_jobs.outputs.docs == 'true'
needs: [determine_jobs]
runs-on: ${{ matrix.os.runner }}
strategy:
fail-fast: false
matrix:
os:
- name: ubuntu
runner:
- "self-hosted"
- "linux"
- "x64"
- "metal"
- name: macos
runner: macos-12
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
TURBO_REMOTE_ONLY: true
steps:
# on main -> current + prev commit
# pr -> pr commits + base commit
- name: Determine fetch depth
id: fetch-depth
run: |
echo "depth=$(( ${{ github.event.pull_request.commits || 1 }} + 1 ))" >> $GITHUB_OUTPUT
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
fetch-depth: ${{ steps.fetch-depth.outputs.depth }}
- name: Setup Turborepo Environment
uses: ./.github/actions/setup-turborepo-environment
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
node-version: "20"
- name: Install Global Turbo
uses: ./.github/actions/install-global-turbo
- name: Run tests
# We manually set TURBO_API to an empty string to override Hetzner env
# We filter out turborepo-repository because it's a native package and needs
# to run when turbo core changes. This job (`js_packages`) does not run on turborpeo core
# changes, and we don't want to enable that beahvior for _all_ our JS packages.
run: |
TURBO_API= turbo run check-types test --filter="!turborepo-repository" --filter={./packages/*}...[${{ github.event.pull_request.base.sha || 'HEAD^1' }}] --color --env-mode=strict
summary:
name: Turborepo JS Test Summary
runs-on: ubuntu-latest
if: always()
needs:
- determine_jobs
- js_packages
steps:
- name: Compute info
id: info
if: always()
run: |
cancelled=false
failure=false
subjob () {
local result=$1
if [ "$result" = "cancelled" ]; then
cancelled=true
elif [ "$result" != "success" ] && [ "$result" != "skipped" ]; then
failure=true
fi
}
subjob ${{needs.determine_jobs.result}}
subjob ${{needs.js_packages.result}}
if [ "$cancelled" = "true" ]; then
echo "cancelled=true" >> $GITHUB_OUTPUT
elif [ "$failure" = "true" ]; then
echo "failure=true" >> $GITHUB_OUTPUT
else
echo "success=true" >> $GITHUB_OUTPUT
fi
- name: Failed
if: steps.info.outputs.failure == 'true'
run: exit 1
- name: Succeeded
if: steps.info.outputs.success == 'true'
run: echo Ok