diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml index b5774a129dea..47da65a57144 100644 --- a/.github/actions/setup-node/action.yml +++ b/.github/actions/setup-node/action.yml @@ -2,9 +2,14 @@ name: 'Setup Node' inputs: node-version: - # default: '14.21.2' required: true type: string + cache-modules: + required: false + type: boolean + install: + required: false + type: boolean outputs: node-version: @@ -14,9 +19,28 @@ runs: using: composite steps: + # - name: Cache Node Modules + # if: inputs.cache-modules + # id: cache-node-modules + # uses: actions/cache@v3 + # with: + # path: | + # node_modules + # **/node_modules + # key: node-modules-${{ hashFiles('yarn.lock') }} + # + # Could use this command to list all paths to save: + # find . -name 'node_modules' -prune | grep -v "/\.meteor/" | grep -v "/meteor/packages/" + - name: Use Node.js ${{ inputs.node-version }} id: node-version uses: actions/setup-node@v3 with: node-version: ${{ inputs.node-version }} - cache: 'yarn' + cache: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' && 'yarn' || '' }} + + - name: yarn install + # if: inputs.install && steps.cache-node-modules.outputs.cache-hit != 'true' + if: inputs.install + shell: bash + run: yarn diff --git a/.github/workflows/ci-code-check.yml b/.github/workflows/ci-code-check.yml index 29e9db7c136d..fbfd8b6e0f04 100644 --- a/.github/workflows/ci-code-check.yml +++ b/.github/workflows/ci-code-check.yml @@ -33,6 +33,8 @@ jobs: uses: ./.github/actions/setup-node with: node-version: ${{ inputs.node-version }} + cache-modules: true + install: true # - name: Free disk space # run: | @@ -40,19 +42,9 @@ jobs: # docker rmi $(docker image ls -aq) # df -h - # - name: Versions - # run: | - # npm --versions - # yarn -v - # node -v - # git version - - - name: yarn install - run: yarn - - uses: dtinth/setup-github-actions-caching-for-turbo@v1 - - name: TS typecheck + - name: TS TypeCheck if: matrix.check == 'ts' run: yarn turbo run typecheck diff --git a/.github/workflows/ci-test-e2e.yml b/.github/workflows/ci-test-e2e.yml index ea232a1fea9f..85dd51c97dd0 100644 --- a/.github/workflows/ci-test-e2e.yml +++ b/.github/workflows/ci-test-e2e.yml @@ -90,17 +90,16 @@ jobs: uses: ./.github/actions/setup-node with: node-version: ${{ inputs.node-version }} + cache-modules: true + install: true - uses: dtinth/setup-github-actions-caching-for-turbo@v1 - - name: yarn install - run: yarn - - name: yarn build run: yarn build - name: Restore build - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: build path: /tmp/build diff --git a/.github/workflows/ci-test-unit.yml b/.github/workflows/ci-test-unit.yml index 92ee971e8e7b..ab9739c68468 100644 --- a/.github/workflows/ci-test-unit.yml +++ b/.github/workflows/ci-test-unit.yml @@ -38,9 +38,8 @@ jobs: uses: ./.github/actions/setup-node with: node-version: ${{ inputs.node-version }} - - - name: yarn install - run: yarn + cache-modules: true + install: true - uses: dtinth/setup-github-actions-caching-for-turbo@v1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index be30c2a0943e..b2add856a6fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -106,6 +106,8 @@ jobs: uses: ./.github/actions/setup-node with: node-version: ${{ needs.release-versions.outputs.node-version }} + cache-modules: true + install: true # - name: Free disk space # run: | @@ -158,9 +160,6 @@ jobs: meteor node -v git version - - name: yarn install - run: yarn - - uses: dtinth/setup-github-actions-caching-for-turbo@v1 - name: Translation check @@ -175,15 +174,15 @@ jobs: if: startsWith(github.ref, 'refs/pull/') == true env: METEOR_PROFILE: 1000 - run: yarn build:ci -- --debug --directory dist + run: yarn build:ci -- --debug --directory /tmp/dist - name: Build Rocket.Chat if: startsWith(github.ref, 'refs/pull/') != true - run: yarn build:ci -- --directory dist + run: yarn build:ci -- --directory /tmp/dist - name: Prepare build run: | - cd apps/meteor/dist + cd /tmp/dist tar czf /tmp/Rocket.Chat.tar.gz bundle - name: Store build @@ -309,7 +308,7 @@ jobs: - uses: actions/checkout@v3 - name: Restore build - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: build path: /tmp/build @@ -388,7 +387,7 @@ jobs: - uses: actions/checkout@v3 - name: Restore build - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: build path: /tmp/build diff --git a/turbo.json b/turbo.json index 0ea3c386ceae..174aaa5b65ec 100644 --- a/turbo.json +++ b/turbo.json @@ -42,6 +42,10 @@ "@rocket.chat/ui-contexts#build": { "dependsOn": ["^build"], "cache": false + }, + "@rocket.chat/meteor#build:ci": { + "dependsOn": ["^build"], + "cache": false } } }