diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6433a8770..c85322565 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: diff --git a/package.json b/package.json index c8746de3d..036235fd0 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/turbo.json b/turbo.json index daff48b48..69747d8ef 100644 --- a/turbo.json +++ b/turbo.json @@ -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": {} } }