[web3.js][experimental] A GitHub Actions workflow that builds the new code with Turborepo (#28916)
* Enable remote cache for Turborepo * Rename `build` to `compile` and `package` to `build` * Add a workflow that builds on PRs and pushes with Turborepo * Explain how to connect to Turborepo remote caching * Upgrade to pnpm 7
This commit is contained in:
parent
20d8b5e98b
commit
2aca4160ca
|
@ -0,0 +1,49 @@
|
|||
name: Web3.js Experimental
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["master"]
|
||||
paths:
|
||||
- "web3.js-experimental/**"
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
paths:
|
||||
- "web3.js-experimental/**"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
timeout-minutes: 15
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: web3.js-experimental
|
||||
|
||||
# To use Turborepo Remote Caching, set the following environment variables for the job.
|
||||
env:
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
- uses: pnpm/action-setup@v2.0.1
|
||||
with:
|
||||
version: 7
|
||||
|
||||
- name: Setup Node.js environment
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
cache: "pnpm"
|
||||
cache-dependency-path: "web3.js-experimental/pnpm-lock.yaml"
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Build
|
||||
run: pnpm build
|
|
@ -1,2 +1,3 @@
|
|||
dist/
|
||||
node_modules/
|
||||
.turbo
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
# Solana JavaScript API
|
||||
|
||||
## Development Environment Setup
|
||||
|
||||
### Speed up build times with remote caching
|
||||
|
||||
Cache build artifacts remotely so that you, others, and the CI server can take advantage of each others' build efforts.
|
||||
|
||||
1. Log the Turborepo CLI into the Solana Vercel account
|
||||
```shell
|
||||
pnpm turbo login
|
||||
```
|
||||
2. Link the repository to the remote cache
|
||||
```shell
|
||||
pnpm turbo link
|
||||
```
|
|
@ -18,11 +18,11 @@
|
|||
"web3"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsup",
|
||||
"build:typedefs": "tsc -p ./tsconfig.declarations.json",
|
||||
"dev": "pnpm run build --watch",
|
||||
"build": "turbo run compile:js compile:typedefs lint verifyTreeShakability:browser verifyTreeShakability:native verifyTreeShakability:node",
|
||||
"compile:js": "tsup",
|
||||
"compile:typedefs": "tsc -p ./tsconfig.declarations.json",
|
||||
"dev": "pnpm run compile:js --watch",
|
||||
"lint": "eslint 'src/**'",
|
||||
"package": "turbo build build:typedefs lint verifyTreeShakability:browser verifyTreeShakability:native verifyTreeShakability:node",
|
||||
"verifyTreeShakability:browser": "agadoo dist/index.browser.esm.js",
|
||||
"verifyTreeShakability:native": "agadoo dist/index.node.esm.js",
|
||||
"verifyTreeShakability:node": "agadoo dist/index.native.esm.js"
|
||||
|
|
|
@ -1,27 +1,30 @@
|
|||
{
|
||||
"$schema": "https://turbo.build/schema.json",
|
||||
"pipeline": {
|
||||
"build": {
|
||||
"compile:js": {
|
||||
"outputs": ["dist/**"]
|
||||
},
|
||||
"build:typedefs": {
|
||||
"dependsOn": ["build"],
|
||||
"compile:typedefs": {
|
||||
"dependsOn": ["compile:js"],
|
||||
"outputs": ["dist/**"]
|
||||
},
|
||||
"lint": {
|
||||
"outputs": []
|
||||
},
|
||||
"verifyTreeShakability:browser": {
|
||||
"dependsOn": ["build"],
|
||||
"dependsOn": ["compile:js"],
|
||||
"outputs": []
|
||||
},
|
||||
"verifyTreeShakability:native": {
|
||||
"dependsOn": ["build"],
|
||||
"dependsOn": ["compile:js"],
|
||||
"outputs": []
|
||||
},
|
||||
"verifyTreeShakability:node": {
|
||||
"dependsOn": ["build"],
|
||||
"dependsOn": ["compile:js"],
|
||||
"outputs": []
|
||||
}
|
||||
},
|
||||
"remoteCache": {
|
||||
"signature": true
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue