Skip to content

Commit f44fe9d

Browse files
committed
ci: vercel build test
1 parent 346f928 commit f44fe9d

File tree

7 files changed

+132
-49
lines changed

7 files changed

+132
-49
lines changed

.github/workflows/build-and-test-pr.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,13 @@ jobs:
9797
build-web-tools:
9898
name: "Build Web Tools"
9999
needs: determine-affected
100-
if: ${{contains(needs.determine-affected.outputs.paths, 'apps/web-tools') && !github.event.pull_request.head.repo.fork}}
101-
uses: LedgerHQ/ledger-live/.github/workflows/build-web-tools-reusable.yml@develop
100+
if: ${{!github.event.pull_request.head.repo.fork}}
101+
uses: LedgerHQ/ledger-live/.github/workflows/build-web-tools-reusable.yml@support/vercel-retirement
102102
secrets: inherit
103+
with:
104+
build_web_tools: ${{ contains(needs.determine-affected.outputs.paths, 'apps/web-tools') }}
105+
build_native_storybook: ${{ contains(needs.determine-affected.outputs.paths, 'libs/native-ui') }}
106+
build_react_storybook: ${{ contains(needs.determine-affected.outputs.paths, 'libs/react-ui') }}
103107

104108
test-cli:
105109
name: "Test CLI"

.github/workflows/build-web-tools-reusable.yml

Lines changed: 100 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,37 @@ on:
1010
have the "normal" scenario involving checking out a merge commit between your branch and the base branch.
1111
If you want to run only on a branch or specific commit, you can use either the sha or the branch name instead (prefer the first verion for PRs).
1212
required: false
13+
build_web_tools:
14+
description: Whether to build web tools
15+
required: false
16+
default: true
17+
build_native_storybook:
18+
description: Whether to native storybook
19+
required: false
20+
default: true
21+
build_react_storybook:
22+
description: Whether to react storybook
23+
required: false
24+
default: true
1325

1426
permissions:
1527
id-token: write
1628
contents: read
1729

1830
jobs:
31+
1932
build-web-tools:
20-
name: "Web Tools Build"
2133
env:
22-
NODE_OPTIONS: "--max-old-space-size=7168"
23-
FORCE_COLOR: 3
24-
runs-on: ubuntu-22.04
34+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
35+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
36+
name: "Web Tools Build"
37+
if: ${{ inputs.build_web_tools != 'false' }}
38+
runs-on: ubuntu-24.04
2539
steps:
2640
- uses: actions/checkout@v4
2741
with:
2842
ref: ${{ inputs.ref || github.sha }}
43+
2944
- name: Setup the caches
3045
uses: LedgerHQ/ledger-live/tools/actions/composites/setup-caches@develop
3146
id: setup-caches
@@ -36,52 +51,91 @@ jobs:
3651
roleName: ${{ secrets.AWS_CACHE_ROLE_NAME }}
3752
region: ${{ secrets.AWS_CACHE_REGION }}
3853
turbo-server-token: ${{ secrets.TURBOREPO_SERVER_TOKEN }}
54+
55+
- name: Vercel build test
56+
run: npx vercel build
57+
env:
58+
TURBO_TEAM: "foo"
59+
TURBO_TOKEN: ${{ secrets.TURBOREPO_SERVER_TOKEN }}
60+
TURBO_API: http://127.0.0.1:${{ steps.setup-caches.outputs.port }}
61+
VERCEL_ORG_ID: ${{ secrets.VERCEL_LEDGER_WALLET_TEAM_ID }}
62+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_WEBTOOLS }}
63+
64+
- name: Exit
65+
run: |
66+
exit 1
67+
3968
- name: Install dependencies
4069
run: pnpm i -F "web-tools..." -F "ledger-live"
41-
- name: build web-tools
42-
run: pnpm turbo run build --filter="@ledgerhq/web-tools" --api="http://127.0.0.1:${{ steps.setup-caches.outputs.port }}" --token="${{ secrets.TURBOREPO_SERVER_TOKEN }}" --team="foo"
43-
- name: typecheck web-tools
70+
71+
- name: Typecheck web-tools
4472
run: pnpm turbo run typecheck --filter="@ledgerhq/web-tools" --api="http://127.0.0.1:${{ steps.setup-caches.outputs.port }}" --token="${{ secrets.TURBOREPO_SERVER_TOKEN }}" --team="foo"
4573

46-
report:
47-
needs: build-web-tools
48-
name: "Web Tools Build > Report"
49-
if: ${{ !cancelled() && github.event_name == 'workflow_dispatch' }}
50-
runs-on: ubuntu-22.04
74+
- name: Vercel build test
75+
76+
- name: Build web-tools
77+
run: pnpm turbo run build --filter="@ledgerhq/web-tools" --api="http://127.0.0.1:${{ steps.setup-caches.outputs.port }}" --token="${{ secrets.TURBOREPO_SERVER_TOKEN }}" --team="foo"
78+
79+
- name: Prepare directory
80+
run: |
81+
mkdir -p .vercel/output/static
82+
cp -r dist/* .vercel/output/static
83+
cp vercel_prebuilt_config.json .vercel/output/config.json
84+
working-directory: apps/web-tools
85+
86+
- name: Deploy
87+
run: DEPLOYMENT_URL=$(npx vercel deploy --prebuilt --yes)
88+
env:
89+
VERCEL_TOKEN: ${{ secrets.VERCEL_LEDGER_WALLET_TOKEN }}
90+
VERCEL_ORG_ID: ${{ secrets.VERCEL_LEDGER_WALLET_TEAM_ID }}
91+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_WEBTOOLS }}
92+
93+
working-directory: apps/web-tools
94+
95+
build-native-storybook:
96+
name: "Native Storybook Build"
97+
if: ${{ inputs.build_native_storybook != 'false' }}
98+
runs-on: ubuntu-24.04
5199
steps:
52-
- uses: actions/download-artifact@v4
53-
with:
54-
pattern: outputs-*
55-
merge-multiple: true
56-
path: outputs
57-
- uses: actions/github-script@v6
58-
name: build summary
100+
- uses: actions/checkout@v4
101+
102+
- name: Setup the caches
103+
uses: LedgerHQ/ledger-live/tools/actions/composites/setup-caches@develop
104+
id: caches
59105
with:
60-
script: |
61-
const fs = require("fs");
62-
const statuses = {
63-
tool: {
64-
pass: ${{ needs.build-web-tools.result == 'success' }},
65-
status: "${{ needs.build-web-tools.result }}",
66-
}
67-
};
68-
69-
const summary = `### Web Tools
70-
71-
${statuses.tool.pass ? "Web Tools are fine" : "Web Tools build or typecheck failed"}
72-
- ${statuses.tool.pass ? "✅" : "❌"} **Web Tools** ended with status \`${statuses.tool.status}\`
73-
`;
74-
75-
const actions = [];
76-
77-
const output = {
78-
summary,
79-
actions
80-
};
81-
82-
fs.writeFileSync("summary-web-tools.json", JSON.stringify(output), "utf-8");
83-
- uses: actions/upload-artifact@v4
84-
name: Upload output
106+
install-proto: "true"
107+
skip-turbo-cache: "false"
108+
accountId: ${{ secrets.AWS_ACCOUNT_ID_PROD }}
109+
roleName: ${{ secrets.AWS_CACHE_ROLE_NAME }}
110+
region: ${{ secrets.AWS_CACHE_REGION }}
111+
turbo-server-token: ${{ secrets.TURBOREPO_SERVER_TOKEN }}
112+
113+
- name: Install dependencies
114+
run: pnpm i -F "@ledgerhq/native-ui..." -F "ledger-live"
115+
116+
- name: Build storybook
117+
run: pnpm turbo run build:storybook --filter="@ledgerhq/native-ui" --api="http://127.0.0.1:${{ steps.caches.outputs.port }}" --token="${{ secrets.TURBOREPO_SERVER_TOKEN }}" --team="foo"
118+
119+
build-react-storybook:
120+
name: "React Storybook Build"
121+
if: ${{ inputs.build_react_storybook != 'false' }}
122+
runs-on: ubuntu-24.04
123+
steps:
124+
- uses: actions/checkout@v4
125+
126+
- name: Setup the caches
127+
uses: LedgerHQ/ledger-live/tools/actions/composites/setup-caches@develop
128+
id: caches
85129
with:
86-
path: ${{ github.workspace }}/summary-web-tools.json
87-
name: summary-web-tools.json
130+
install-proto: "true"
131+
skip-turbo-cache: "false"
132+
accountId: ${{ secrets.AWS_ACCOUNT_ID_PROD }}
133+
roleName: ${{ secrets.AWS_CACHE_ROLE_NAME }}
134+
region: ${{ secrets.AWS_CACHE_REGION }}
135+
turbo-server-token: ${{ secrets.TURBOREPO_SERVER_TOKEN }}
136+
137+
- name: Install dependencies
138+
run: pnpm i -F "./libs/ui/**" -F "ledger-live"
139+
140+
- name: Build storybook
141+
run: pnpm turbo run build:storybook --filter="@ledgerhq/react-ui" --api="http://127.0.0.1:${{ steps.caches.outputs.port }}" --token="${{ secrets.TURBOREPO_SERVER_TOKEN }}" --team="foo"

apps/web-tools/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
dist/
2+
.vercel
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"version": 3,
3+
"framework": null,
4+
"outputDirectory": "dist",
5+
"routes": [
6+
{ "handle": "filesystem" },
7+
{ "src": "/(.*)", "dest": "/index.html" }
8+
]
9+
}

libs/ui/packages/native/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ lib/
1212

1313
# macOS
1414
.DS_Store
15+
16+
storybook-static/

libs/ui/packages/native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"android": "expo start --android",
4040
"build": "tsc -p tsconfig.prod.json && node scripts/postBuild",
4141
"prebuild:storybook": "pnpm -F ui-shared -F icons-ui -F crypto-icons-ui build",
42-
"build:storybook": "storybook build -c .storybook-web -o web-build",
42+
"build:storybook": "storybook build -c .storybook-web",
4343
"watch": "tsc -p tsconfig.prod.json --watch",
4444
"clean": "rimraf lib",
4545
"eject": "expo eject",

turbo.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,19 @@
8181
],
8282
"ui": "tui",
8383
"tasks": {
84+
"build:storybook": {
85+
"dependsOn": [
86+
"prebuild:storybook"
87+
],
88+
"outputs": [
89+
"storybook-static/**"
90+
]
91+
},
92+
"prebuild:storybook" : {
93+
"dependsOn": [
94+
"^build"
95+
]
96+
},
8497
"build": {
8598
"dependsOn": [
8699
"^build"

0 commit comments

Comments
 (0)