Skip to content

Commit 5daf96b

Browse files
committed
add turbo check action/workflow
--no-frozen-lockfile fix again this shit
1 parent 705c90d commit 5daf96b

File tree

2 files changed

+154
-0
lines changed

2 files changed

+154
-0
lines changed
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# .github/actions/check-turbo-changes/action.yml
2+
name: Check Turbo Changes
3+
description: Check which packages are marked to build by Turbo
4+
5+
outputs:
6+
torus-wallet:
7+
description: "Whether torus-wallet changed"
8+
value: ${{ steps.changed.outputs.torus-wallet }}
9+
torus-page:
10+
description: "Whether torus-page changed"
11+
value: ${{ steps.changed.outputs.torus-page }}
12+
torus-allocator:
13+
description: "Whether torus-allocator changed"
14+
value: ${{ steps.changed.outputs.torus-allocator }}
15+
torus-cache:
16+
description: "Whether torus-cache changed"
17+
value: ${{ steps.changed.outputs.torus-cache }}
18+
torus-bridge:
19+
description: "Whether torus-bridge changed"
20+
value: ${{ steps.changed.outputs.torus-bridge }}
21+
torus-worker:
22+
description: "Whether torus-worker changed"
23+
value: ${{ steps.changed.outputs.torus-worker }}
24+
torus-governance:
25+
description: "Whether torus-governance changed"
26+
value: ${{ steps.changed.outputs.torus-governance }}
27+
28+
runs:
29+
using: "composite"
30+
steps:
31+
- uses: actions/checkout@v4
32+
with:
33+
fetch-depth: 0
34+
35+
- uses: pnpm/action-setup@v4
36+
name: Install pnpm
37+
with:
38+
run_install: false
39+
40+
- name: Install Node.js
41+
uses: actions/setup-node@v4
42+
with:
43+
node-version: 20
44+
cache: "pnpm"
45+
46+
- name: Install dependencies
47+
shell: bash
48+
id: install
49+
run: pnpm install
50+
continue-on-error: true
51+
52+
- name: Install dependencies (--no-frozen-lockfile)
53+
shell: bash
54+
if: steps.install.outcome == 'failure'
55+
run: pnpm install --no-frozen-lockfile
56+
57+
- name: Get apps list
58+
shell: bash
59+
run: |
60+
ls -d apps/* | sed 's/apps\///' | jq -R -s -c 'split("\n")[:-1]' > packages_to_track.json
61+
echo "Found packages:"
62+
cat packages_to_track.json
63+
64+
- name: Get build json (PR based)
65+
if: github.event_name == 'pull_request'
66+
shell: bash
67+
run: |
68+
pnpm exec turbo run build --filter="...[origin/${{ github.base_ref }}]" --dry-run=json 2>/dev/null > build.json
69+
70+
- name: Get build json (Push based)
71+
if: github.event_name == 'push'
72+
shell: bash
73+
run: |
74+
# Find the merge-base between current HEAD and the previous known state
75+
76+
if git rev-parse --quiet --verify ${{ github.event.before }}^{commit}; then
77+
BASE_COMMIT=$(git merge-base ${{ github.event.before }} HEAD)
78+
pnpm exec turbo run build --filter="...[${BASE_COMMIT}]" --dry-run=json 2>/dev/null > build.json
79+
else
80+
pnpm exec turbo run build --dry-run=json 2>/dev/null > build.json
81+
fi
82+
# pnpm exec turbo run build --filter="...[HEAD^1]" --dry-run=json 2>/dev/null > build.json
83+
84+
- name: Get changed packages
85+
shell: bash
86+
run: |
87+
cat build.json | jq -c '[.tasks[].package]' > package_list
88+
echo "Changed packages:"
89+
cat package_list
90+
91+
- name: Check changed packages
92+
id: changed
93+
shell: bash
94+
run: |
95+
CHANGED_PACKAGES=$(cat package_list)
96+
97+
while read -r package; do
98+
package=$(echo "$package" | tr -d '"')
99+
IS_CHANGED=$(echo $CHANGED_PACKAGES | jq -r "any(. == \"$package\")")
100+
echo "$package=$IS_CHANGED" >> $GITHUB_OUTPUT
101+
done < <(jq -c '.[]' packages_to_track.json)
102+
103+
- name: Debug outputs
104+
shell: bash
105+
run: |
106+
echo 'Changed packages status:'
107+
echo '${{ toJSON(steps.changed.outputs) }}' | jq '.'

.github/workflows/debug.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# .github/workflows/debug.yml
2+
name: Check Changes
3+
4+
on:
5+
push:
6+
pull_request:
7+
8+
jobs:
9+
pr-push-check:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
skip: ${{ github.event_name == 'push' && steps.findPr.outputs.number != '' }}
13+
steps:
14+
- uses: jwalton/gh-find-current-pr@master
15+
id: findPr
16+
17+
- name: Debug PR info
18+
run: |
19+
echo "PR exists: ${{ steps.findPr.outputs.number != '' }}"
20+
echo "PR number: ${{ steps.findPr.outputs.number }}"
21+
echo "Is push based: ${{ github.event_name == 'push' }}"
22+
23+
turbo-check:
24+
needs: pr-push-check
25+
if: needs.pr-push-check.outputs.skip == 'false'
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- uses: ./.github/actions/check-turbo-changes
31+
id: changes
32+
33+
# Simple conditional steps
34+
- name: Build torus-wallet
35+
if: steps.changes.outputs.torus-wallet == 'true'
36+
run: echo "Building torus-wallet..."
37+
38+
- name: Build torus-page
39+
if: steps.changes.outputs.torus-page == 'true'
40+
run: echo "Building torus-page... "
41+
42+
# Debug output
43+
- name: Show changes
44+
run: |
45+
# Print all outputs
46+
echo "All changes:"
47+
echo '${{ toJSON(steps.changes.outputs) }}' | jq '.'

0 commit comments

Comments
 (0)