Skip to content

Commit

Permalink
Turborepo support (#196)
Browse files Browse the repository at this point in the history
Turborepo is now used for all the web apps.
It caches the build which is used in main-ci as well
as various deployments.
  • Loading branch information
NigelBreslaw authored Jan 22, 2024
1 parent 6ff96b5 commit 203d081
Show file tree
Hide file tree
Showing 13 changed files with 106 additions and 19 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/deploy-dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
jobs:
deploy:
runs-on: ubuntu-latest
env:
TURBO_URL: ${{ secrets.TURBO_URL }}
TURBO_CODE: ${{ secrets.TURBO_CODE }}
defaults:
run:
working-directory: gg-mono
Expand All @@ -20,7 +23,7 @@ jobs:
- name: install dependencies
run: pnpm install --frozen-lockfile
- name: build
run: cd apps/dashboard && pnpm build
run: cd apps/dashboard && pnpm build:ci
- name: deploy dashboard
uses: cloudflare/[email protected]
with:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
jobs:
deploy:
runs-on: ubuntu-latest
env:
TURBO_URL: ${{ secrets.TURBO_URL }}
TURBO_CODE: ${{ secrets.TURBO_CODE }}
defaults:
run:
working-directory: gg-mono
Expand All @@ -20,7 +23,7 @@ jobs:
- name: install dependencies
run: pnpm install --frozen-lockfile
- name: build
run: pnpm build
run: cd docs/starlight && pnpm build:ci
- name: publish docs
uses: cloudflare/[email protected]
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ jobs:

build:
runs-on: ubuntu-latest
# defaults:
# run:
# working-directory: gg-mono
env:
TURBO_URL: ${{ secrets.TURBO_URL }}
TURBO_CODE: ${{ secrets.TURBO_CODE }}
timeout-minutes: 1
steps:
- uses: actions/[email protected]
Expand All @@ -23,7 +23,7 @@ jobs:
- name: format
run: cd gg-mono && pnpm format:check
- name: build
run: cd gg-mono && pnpm build
run: cd gg-mono && pnpm build:ci
- name: install dependencies
run: cd native_gg && pnpm install --frozen-lockfile
- name: lint
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ coverage
*.njsproj
*.sln
*.sw?
.turbo

# environment variables
.env
Expand Down
1 change: 1 addition & 0 deletions gg-mono/apps/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"scripts": {
"astro": "astro",
"build": "astro build",
"build:ci": "turbo build --remote-only --api=$TURBO_URL --token=$TURBO_CODE --team=CI",
"dev": "astro dev",
"preview": "astro preview",
"start": "astro dev",
Expand Down
1 change: 1 addition & 0 deletions gg-mono/apps/dashboard/src/components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ This is where generic, composable, re-usable UI components can be extracted from

- `<Button variant="..."/>`
- `<Checkbox />`

3 changes: 2 additions & 1 deletion gg-mono/apps/react-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
"scripts": {
"analyze": "source-map-explorer dist/**/*.js",
"build": "vite build",
"build:ci": "turbo build --remote-only --api=$TURBO_URL --token=$TURBO_CODE --team=CI",
"coverage": "vitest run --coverage",
"dev": "vite",
"format:check": "biome format ./src",
"format:write": "biome format --write ./src",
"lint": "biome lint ./src",
"lint:fix": "biome check --apply ./src",
"preview": "vite preview",
"typecheck": "tsc"
"type-check": "tsc"
},
"type": "module"
}
6 changes: 4 additions & 2 deletions gg-mono/docs/starlight/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@
},
"scripts": {
"astro": "astro",
"build": "astro check && astro build",
"build": "astro build",
"build:ci": "turbo build --remote-only --api=$TURBO_URL --token=$TURBO_CODE --team=CI",
"coverage": "vitest run --coverage",
"dev": "astro dev",
"format:check": "biome format ./src",
"format:write": "biome format --write ./src",
"lint": "biome lint ./src",
"lint:fix": "biome check --apply ./src",
"preview": "astro preview",
"start": "astro dev"
"start": "astro dev",
"type-check": "astro check"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion gg-mono/docs/starlight/src/content/docs/guides/ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The CI is powered by github actions and the aims are:
1. Full CI run should only take 1 min for the entire monorepo.
2. CI costs should happily fit inside githubs free tier. That's 2000 minutes a month. However none of these minutes is currently used as runs that take under a minute don't seem to count towards this total.
3. Try and use some of the new generation of Rust based tools to keep every stage as fast as possible.

[Dependabot](https://github.com/dependabot) is enabled on the repo and runs everyday. In general the number of dependencies is kept as low as possible. However the aim is to only have items updated on a weekly basis.

[Sonarqube](https://sonarcloud.io/organizations/nigelbreslaw/projects) offers a free tier for public projects and runs as a quality gate on every PR.
Expand Down
8 changes: 5 additions & 3 deletions gg-mono/examples/default-project/package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
{
"name": "default-project",
"name": "example web app",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"build": "vite build",
"build:ci": "turbo build --remote-only --api=$TURBO_URL --token=$TURBO_CODE --team=CI",
"coverage": "vitest run --coverage",
"format:check": "biome format ./src",
"format:write": "biome format --write ./src",
"lint": "biome lint ./src",
"lint:fix": "biome check --apply ./src",
"preview": "vite preview"
"preview": "vite preview",
"type-check": "tsc"
},
"dependencies": {
"solid-js": "1.8.11"
Expand Down
12 changes: 6 additions & 6 deletions gg-mono/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
"version": "0.0.1",
"devDependencies": {
"@biomejs/biome": "1.5.2",
"syncpack": "12.3.0"
"syncpack": "12.3.0",
"turbo": "1.11.3"
},
"private": true,
"scripts": {
"build": "pnpm --stream -r build",
"build:ci": "turbo build --remote-only --api=$TURBO_URL --token=$TURBO_CODE --team=CI",
"coverage": "pnpm --stream -r coverage",
"format:check": "pnpm --stream -r format:check",
"format:write": "pnpm -r format:write",
"lint": "pnpm --stream -r lint",
"lint:fix": "pnpm -r lint:fix",
"syncpack": "syncpack format && syncpack set-semver-ranges && syncpack list-mismatches"
"syncpack": "syncpack format && syncpack set-semver-ranges && syncpack list-mismatches",
"type-check": "pnpm --stream -r type-check"
},
"type": "module",
"workspaces": [
"apps/*",
"docs/*"
]
"workspaces": ["apps/*", "docs/*"]
}
63 changes: 63 additions & 0 deletions gg-mono/pnpm-lock.yaml

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

10 changes: 10 additions & 0 deletions gg-mono/turbo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**"]
},
"type-check": {}
}
}

0 comments on commit 203d081

Please sign in to comment.