Skip to content

Commit

Permalink
(chore) Cache tasks in CI using turbo
Browse files Browse the repository at this point in the history
  • Loading branch information
denniskigen committed Apr 3, 2023
1 parent 8fb7f79 commit c85c1a3
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
34 changes: 29 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,41 @@ env:
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 turbo 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",
"prettier": "prettier --config prettier.config.js --write \"src/**/*.{ts,tsx}\"",
"typescript": "tsc",
"test": "jest --config ./jest.config.js --passWithNoTests",
Expand Down
3 changes: 3 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
"dev": {
"cache": false,
"persistent": true
},
"verify": {
"outputs": []
}
}
}

0 comments on commit c85c1a3

Please sign in to comment.