Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache tsc with turbo #258

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
38 changes: 32 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ jobs:
- folder: vite-demo
steps:
- uses: actions/checkout@v2
- name: Cache turbo
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-
- uses: pnpm/action-setup@v2
- name: Use Node.js 22
uses: actions/setup-node@v3
Expand All @@ -97,9 +104,8 @@ jobs:
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile --ignore-scripts
# TODO reuse some artifacts or something, we're doing this in multiple steps
- name: Build JS files
run: pnpm -r compile
run: pnpm compile
- name: Typecheck
run: cd ./demos/${{ matrix.target.folder }} && pnpm tsc
- name: Lint
Expand All @@ -110,6 +116,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache turbo
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-
- uses: pnpm/action-setup@v2
- name: Use Node.js 22
uses: actions/setup-node@v3
Expand All @@ -119,7 +132,7 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile --ignore-scripts
- name: Build
run: pnpm -r compile
run: pnpm compile
- name: Run unit tests
# Note: unit tests have to run after building, because the unit tests
# rely on Isograph, which relies on @isograph/react being a valid input
Expand Down Expand Up @@ -270,6 +283,13 @@ jobs:
needs: [all-checks-passed]
steps:
- uses: actions/checkout@v2
- name: Cache turbo
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v2
with:
Expand All @@ -282,9 +302,8 @@ jobs:
run: pnpm gulp setMainVersion
env:
RELEASE_COMMIT_SHA: ${{ github.sha }}
# TODO reuse this somehow?
- name: Build
run: pnpm -r compile
run: pnpm compile
- name: Download artifact isograph_cli-linux-x64
uses: actions/download-artifact@v4
with:
Expand Down Expand Up @@ -329,6 +348,13 @@ jobs:
needs: [all-checks-passed]
steps:
- uses: actions/checkout@v2
- name: Cache turbo
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v2
with:
Expand All @@ -341,7 +367,7 @@ jobs:
# run: pnpm gulp setMainVersion
# # TODO do this less hackily
- name: Build
run: pnpm -r compile
run: pnpm compile
- name: Download artifact isograph_cli-linux-x64
uses: actions/download-artifact@v4
with:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
artifacts

**/out/**

.turbo
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
{
"name": "isograph",
"private": true,
"devDependencies": {
"gulp": "4.0.2",
"prettier": "^3.2.4",
"turbo": "^2.2.3",
"typescript": "5.6.3",
"vitest": "^2.1.2"
},
"scripts": {
"watch-rs": "bacon -j build -p ./crates/",
"check-rs": "bacon -j check -p ./crates/",
"build": "cargo build",
"compile": "pnpm turbo compile --log-order=grouped",
"watch-pet-demo": "pnpm --filter=pet-demo iso-watch",
"watch-github-demo": "pnpm --filter=github-demo iso-watch",
"watch-isograph-react-demo": "pnpm --filter=@isograph/react iso-watch",
Expand Down
70 changes: 67 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion scripts/sanity-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pnpm format && \
cargo clippy && \
pnpm build-demos && \
./scripts/check-git-status.sh && \
pnpm -r compile && \
pnpm compile && \
pnpm test
if [ $? -eq 0 ]; then
echo OK
Expand Down
9 changes: 9 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://turbo.build/schema.json",
"tasks": {
"compile": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we name this something like compileTypescript or something?

(Perhaps we should also rename the other ones to indicate that they refer to the Rust side)

"dependsOn": ["^compile"],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this right? Does this mean that we're going to require the Rust compiler to be built before we build the JS?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The arrow ^ has the same meaning as pnpm -r - dependencies of each package need to be compiled first

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay TIL

"outputs": ["dist/**"]
}
}
}
Loading