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) Cache tasks in CI using turbo #9

Merged
merged 2 commits into from
Apr 4, 2023
Merged
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
35 changes: 29 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,44 @@ on:
env:
ESM_NAME: "openmrs-form-engine-lib"
JS_NAME: "openmrs-form-engine-lib.js"

jobs:
build:
runs-on: ubuntu-latest
env:
TURBO_API: 'http://127.0.0.1:9080'
TURBO_TOKEN: ${{ secrets.TURBO_SERVER_TOKEN }}
TURBO_TEAM: ${{ github.repository_owner }}

steps:
- uses: actions/checkout@v3
- name: Use Node.js
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- run: yarn install
- run: yarn lint
- run: yarn run test
- run: yarn build

- name: Cache dependencies
id: cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn

- name: Setup local cache server for Turborepo
uses: felixmosh/turborepo-gh-artifacts@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
server-token: ${{ secrets.TURBO_SERVER_TOKEN }}

- name: Run tests, lint and typechecking
run: yarn verify

- name: Run build
run: yarn turbo build --color --concurrency=5

- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"homepage": "https://github.com/openmrs/openmrs-form-engine-lib#readme",
"scripts": {
"lint": "eslint src --ext tsx --fix",
"verify": "turbo run lint && turbo run typescript && yarn run test",
"verify": "turbo lint typescript && yarn run test",
"prettier": "prettier --config prettier.config.js --write \"src/**/*.{ts,tsx}\"",
"typescript": "tsc",
"test": "jest --config ./jest.config.js --passWithNoTests",
Expand Down
18 changes: 2 additions & 16 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,13 @@
"$schema": "https://turborepo.org/schema.json",
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**"]
},
"test": {
"dependsOn": ["build"],
"outputs": [],
"inputs": ["src/**/*.tsx", "src/**/*.ts", "test/**/*.ts", "test/**/*.tsx"]
},
"lint": {
"outputs": []
},
"typescript": {
"dependsOn": [],
"outputs": []
},
"extract-translations": {
"outputs": []
},
"dev": {
"cache": false,
"persistent": true
}
"lint": {},
"typescript": {}
}
}