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

(chore) : update turbo tooling and speed up #567

Closed
wants to merge 1 commit into from
Closed
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
86 changes: 62 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- created

env:
TURBO_TOKEN: 'turbo-token'
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ github.repository_owner }}
FORCE_COLOR: true

Expand All @@ -21,6 +21,8 @@ jobs:
permissions:
actions: read
contents: read
packages: write
id-token: write

steps:
- uses: actions/checkout@v4
Expand All @@ -33,41 +35,58 @@ jobs:
node-version: "18"
cache: 'yarn'

# Use Turborepo Remote Caching
- name: Setup Turborepo Remote Cache
uses: dtinth/setup-github-actions-caching-for-turbo@v1
- name: Configure Vercel Remote Cache
run: npx turbo login --sso-team $TURBO_TEAM
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}

- name: Setup Turborepo cache
uses: actions/cache@v3
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-

- name: Install dependencies
run: yarn install --frozen-lockfile
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false

- name: Run lint, type checks and tests
run: yarn verify --cache-dir=".turbo"
run: yarn verify
env:
TURBO_CACHE_KEY: ${{ github.sha }}
TURBO_CACHE: remote:rw
TURBO_CACHE_DIR: .turbo

- name: Build packages
run: |
yarn turbo run build \
--cache-dir=".turbo" \
--concurrency=5 \
--concurrency=8 \
--no-daemon
env:
TURBO_CACHE_KEY: ${{ github.sha }}
TURBO_CACHE: remote:rw
TURBO_CACHE_DIR: .turbo

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: packages
path: packages/**/dist
path: |
packages/**/dist
!packages/**/node_modules
compression-level: 9
retention-days: 7

pre_release:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push'
permissions:
contents: write
packages: write
id-token: write

steps:
- uses: actions/checkout@v4
Expand All @@ -81,6 +100,11 @@ jobs:
registry-url: "https://registry.npmjs.org"
cache: 'yarn'

- name: Configure Vercel Remote Cache
run: npx turbo login --sso-team $TURBO_TEAM
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}

- name: Install dependencies
run: yarn install --frozen-lockfile
env:
Expand All @@ -90,42 +114,50 @@ jobs:
run: yarn workspaces foreach --worktree --topological --exclude @kenyaemr/esm-3.x-apps version "$(node -e "console.log(require('semver').inc(require('./package.json').version, 'patch'))")-pre.${{ github.run_number }}"

- name: Build
run: yarn turbo run build --cache-dir=".turbo" --concurrency=5 --no-daemon
run: yarn turbo run build --cache-dir=".turbo" --concurrency=8 --no-daemon
env:
TURBO_CACHE_KEY: ${{ github.sha }}
TURBO_TEAM: ${{ github.repository_owner }}

- name: Configure Git
run: |
git config user.email "[email protected]"
git config user.name "KenyaEMR CI"

- name: Commit version changes
run: |
git add package.json packages/*/package.json
git commit -m "ci: version bump [skip ci]"
git push origin HEAD:main

- name: Publish pre-release
run: |
yarn config set npmAuthToken "${NODE_AUTH_TOKEN}"
yarn run ci:prepublish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
NPM_CONFIG_PROVENANCE: true
# dev server build dispatch

Trigger_server_build:
runs-on: ubuntu-latest
needs: pre_release
steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Invoke workflow without inputs. Don't wait for result
uses: aurelien-baudet/workflow-dispatch@v2
with:
workflow: KenyaEMR CI
repo: palladiumkenya/openmrs-config-kenyaemr
token: ${{ secrets.PERSONAL_TOKENS }}
wait-for-completion: false
runs-on: ubuntu-latest
needs: pre_release
steps:
- name: Invoke workflow
uses: aurelien-baudet/workflow-dispatch@v2
with:
workflow: KenyaEMR CI
repo: palladiumkenya/openmrs-config-kenyaemr
token: ${{ secrets.PERSONAL_TOKENS }}
wait-for-completion: false

release:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'release'
permissions:
contents: write
packages: write
id-token: write

steps:
- uses: actions/checkout@v4
Expand All @@ -139,6 +171,11 @@ jobs:
registry-url: "https://registry.npmjs.org"
cache: 'yarn'

- name: Configure Vercel Remote Cache
run: npx turbo login --sso-team $TURBO_TEAM
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
Expand All @@ -159,3 +196,4 @@ jobs:
yarn run ci:publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"sass": "^1.54.3",
"swc-loader": "^0.2.3",
"swr": "^2.2.4",
"turbo": "^2.1.3",
"turbo": "^2.3.4",
"typescript": "^4.0.3",
"uuid": "^9.0.1",
"webpack-cli": "^4.10.0",
Expand Down
60 changes: 30 additions & 30 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2731,7 +2731,7 @@ __metadata:
swc-loader: "npm:^0.2.3"
swr: "npm:^2.2.4"
ts-dotenv: "npm:^0.9.1"
turbo: "npm:^2.1.3"
turbo: "npm:^2.3.4"
typescript: "npm:^4.0.3"
uuid: "npm:^9.0.1"
webpack-cli: "npm:^4.10.0"
Expand Down Expand Up @@ -18594,58 +18594,58 @@ __metadata:
languageName: node
linkType: hard

"turbo-darwin-64@npm:2.1.3":
version: 2.1.3
resolution: "turbo-darwin-64@npm:2.1.3"
"turbo-darwin-64@npm:2.3.4":
version: 2.3.4
resolution: "turbo-darwin-64@npm:2.3.4"
conditions: os=darwin & cpu=x64
languageName: node
linkType: hard

"turbo-darwin-arm64@npm:2.1.3":
version: 2.1.3
resolution: "turbo-darwin-arm64@npm:2.1.3"
"turbo-darwin-arm64@npm:2.3.4":
version: 2.3.4
resolution: "turbo-darwin-arm64@npm:2.3.4"
conditions: os=darwin & cpu=arm64
languageName: node
linkType: hard

"turbo-linux-64@npm:2.1.3":
version: 2.1.3
resolution: "turbo-linux-64@npm:2.1.3"
"turbo-linux-64@npm:2.3.4":
version: 2.3.4
resolution: "turbo-linux-64@npm:2.3.4"
conditions: os=linux & cpu=x64
languageName: node
linkType: hard

"turbo-linux-arm64@npm:2.1.3":
version: 2.1.3
resolution: "turbo-linux-arm64@npm:2.1.3"
"turbo-linux-arm64@npm:2.3.4":
version: 2.3.4
resolution: "turbo-linux-arm64@npm:2.3.4"
conditions: os=linux & cpu=arm64
languageName: node
linkType: hard

"turbo-windows-64@npm:2.1.3":
version: 2.1.3
resolution: "turbo-windows-64@npm:2.1.3"
"turbo-windows-64@npm:2.3.4":
version: 2.3.4
resolution: "turbo-windows-64@npm:2.3.4"
conditions: os=win32 & cpu=x64
languageName: node
linkType: hard

"turbo-windows-arm64@npm:2.1.3":
version: 2.1.3
resolution: "turbo-windows-arm64@npm:2.1.3"
"turbo-windows-arm64@npm:2.3.4":
version: 2.3.4
resolution: "turbo-windows-arm64@npm:2.3.4"
conditions: os=win32 & cpu=arm64
languageName: node
linkType: hard

"turbo@npm:^2.1.3":
version: 2.1.3
resolution: "turbo@npm:2.1.3"
dependencies:
turbo-darwin-64: "npm:2.1.3"
turbo-darwin-arm64: "npm:2.1.3"
turbo-linux-64: "npm:2.1.3"
turbo-linux-arm64: "npm:2.1.3"
turbo-windows-64: "npm:2.1.3"
turbo-windows-arm64: "npm:2.1.3"
"turbo@npm:^2.3.4":
version: 2.3.4
resolution: "turbo@npm:2.3.4"
dependencies:
turbo-darwin-64: "npm:2.3.4"
turbo-darwin-arm64: "npm:2.3.4"
turbo-linux-64: "npm:2.3.4"
turbo-linux-arm64: "npm:2.3.4"
turbo-windows-64: "npm:2.3.4"
turbo-windows-arm64: "npm:2.3.4"
dependenciesMeta:
turbo-darwin-64:
optional: true
Expand All @@ -18661,7 +18661,7 @@ __metadata:
optional: true
bin:
turbo: bin/turbo
checksum: 10/b8e90a38f47dc5c07e5f1c0bd708f9dc6b00b744847a45c06e5de5a5379a32bb155e8ad994eb03e60f697afc87f0815dd02fc680e22c0fad83d65c0a1fb6fc96
checksum: 10/e1ea94c1977c7d907dff50796b09dca8dc4713590ef0f3a5697abb2de41b9a465e6ca25b8d417d12cadb4db5e65a2c247dd60486c85eaaf69a1888ff9f0d604a
languageName: node
linkType: hard

Expand Down
Loading