Skip to content
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
af9b07c
ci: add merge-base to restore-keys
colinaaa Apr 15, 2025
b2b9b91
fix: use `github.event.merge_group.{base,head}_sha`
colinaaa Apr 15, 2025
1f908b9
fix: add `origin/`
colinaaa Apr 15, 2025
2408364
retry
colinaaa Apr 15, 2025
571da7f
fix: fetch head ref
colinaaa Apr 15, 2025
3e67f13
fix: head should not fetch from origin
colinaaa Apr 15, 2025
792354f
fix: `base.ref` instead of `base_sha`
colinaaa Apr 15, 2025
8da7555
fix: use `pull_request.head.sha`
colinaaa Apr 15, 2025
d18941d
fix: use `github.sha`
colinaaa Apr 15, 2025
e4e4194
fix: merge-base base head
colinaaa Apr 15, 2025
f0be9a0
fix: error command
colinaaa Apr 15, 2025
cb29dcf
fix: use github-script
colinaaa Apr 15, 2025
ba088d0
fix: debug
colinaaa Apr 15, 2025
d108e60
fix: base ref
colinaaa Apr 15, 2025
2747628
fix: remove `--fork-point`
colinaaa Apr 15, 2025
9076ce5
fix: use another job
colinaaa Apr 15, 2025
a1139c8
fix: runs-on
colinaaa Apr 15, 2025
e8b2b0b
fix: fork repo
colinaaa Apr 15, 2025
83bd325
fix: turbo summary
colinaaa Apr 15, 2025
7d834e8
fix: report name
colinaaa Apr 15, 2025
5e25d19
fix: retry summary
colinaaa Apr 15, 2025
b88c63b
fix: first try restore from current PR
colinaaa Apr 15, 2025
56d337c
fix: include run id in cache key
colinaaa Apr 15, 2025
b983eea
retry pr id cache
colinaaa Apr 15, 2025
8b24d4a
fix: avoid template-injection
colinaaa Apr 16, 2025
1fa3709
Update .github/workflows/workflow-build.yml
colinaaa Apr 16, 2025
dee13de
Merge branch 'main' into colin/0415/cache-1
colinaaa Apr 16, 2025
f576bf3
fix: merge_group ref
colinaaa Apr 16, 2025
b211249
fix: merge group ref
colinaaa Apr 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/deploy-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ jobs:
cancel-in-progress: true
uses: ./.github/workflows/workflow-build.yml
if: github.repository == 'lynx-family/lynx-stack'
with:
runs-on: lynx-ubuntu-24.04-xlarge
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
benchmark:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ jobs:
uses: ./.github/workflows/workflow-build.yml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
runs-on: lynx-ubuntu-24.04-xlarge
benchmark:
needs: build
uses: ./.github/workflows/workflow-bench.yml
Expand Down
65 changes: 59 additions & 6 deletions .github/workflows/workflow-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,47 @@ on:
secrets:
CODECOV_TOKEN:
required: false
inputs:
runs-on:
required: true
type: string
env:
CI: 1
TURBO_TELEMETRY_DISABLED: 1
jobs:
get-merge-base:
runs-on: lynx-ubuntu-24.04-medium
env:
# We have 3 cases:
# 1. Pull request
# 2. Merge group
# 3. Push (deploy on main branch)
BASE_REF: ${{ github.base_ref || github.event.merge_group.base_ref || github.event.push.base_ref }}
HEAD_REF: ${{ github.head_ref || github.event.merge_group.head_ref || github.ref }}
outputs:
merge-base: ${{ steps.merge-base.outputs.merge-base }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ env.HEAD_REF }}
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
# Modified from https://github.com/rmacklin/fetch-through-merge-base
Comment thread Fixed
- name: Fetch
run: |
git fetch --progress --depth=1 origin "+refs/heads/$BASE_REF:refs/heads/$BASE_REF"
MAX_ATTEMPTS=10
ATTEMPT=0
while [ -z "$( git merge-base "$BASE_REF" "$HEAD_REF" )" ] && [ "$ATTEMPT" -lt "$MAX_ATTEMPTS" ]; do
git fetch -q --deepen=10 origin "$BASE_REF" "$HEAD_REF"
ATTEMPT=$((ATTEMPT + 1))
done
if [ "$ATTEMPT" -ge "$MAX_ATTEMPTS" ]; then
echo "Failed to determine merge base after $MAX_ATTEMPTS attempts." >&2
exit 1
fi
- name: Get merge base
id: merge-base
run: |
echo "merge-base=$(git merge-base origin/$BASE_REF $HEAD_REF || git rev-parse $BASE_REF)" >> $GITHUB_OUTPUT
build-all:
runs-on: ${{ inputs.runs-on }}
runs-on: lynx-ubuntu-24.04-xlarge
needs: get-merge-base
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand All @@ -25,8 +56,15 @@ jobs:
key: turbo-v3-${{ hashFiles('**/packages/**/src/**/*.rs') }}-${{ github.sha }}
# We can restore caches from
# 1. Runs in the same PR
# 2. Previous PRs
# 2. Previous commit from base branch
# 2.1 Use the merge base
# 2.2 Use the base SHA
# 3. Any cache
restore-keys: |
turbo-pull-request-${{ github.event.pull_request.number || 'non-exists' }}-${{ github.run_number }}
turbo-pull-request-${{ github.event.pull_request.number || 'non-exists' }}-
turbo-v3-${{ hashFiles('**/packages/**/src/**/*.rs') }}-${{ needs.get-merge-base.outputs.merge-base }}
turbo-v3-${{ hashFiles('**/packages/**/src/**/*.rs') }}-${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.push.before }}
turbo-v3-${{ hashFiles('**/packages/**/src/**/*.rs') }}-
- name: Install
run: |
Expand All @@ -40,6 +78,15 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
continue-on-error: true
- name: Upload turbo summary
if: runner.debug == '1'
uses: actions/upload-artifact@v4
with:
name: turbo-summary-${{ github.sha }}
path: .turbo/runs/*.json
retention-days: 1
overwrite: true
include-hidden-files: true
- name: Setup Rust and retry build if failed
if: steps.build.outcome == 'failure'
uses: actions-rust-lang/setup-rust-toolchain@v1
Expand All @@ -52,3 +99,9 @@ jobs:
pnpm turbo build --summarize
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Save turbo cache
if: github.event_name == 'pull_request'
uses: lynx-infra/cache/save@558d7c999f9f97ac02ed7e711503bb81d82ff8ee
with:
path: .turbo
key: turbo-pull-request-${{ github.event.pull_request.number }}-${{ github.run_number }}-${{ github.run_attempt }}
10 changes: 0 additions & 10 deletions .github/workflows/workflow-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,6 @@ jobs:
- name: Build
run: |
pnpm turbo build --summarize
- name: Upload Turbo Summary
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: turbo-summary-${{ github.ref }}
path: .turbo/runs
if-no-files-found: error
retention-days: 1
overwrite: true
include-hidden-files: true
- uses: ./.github/actions/setup-playwright
if: ${{ inputs.is-web }}
with:
Expand Down