From 3ff5c6b860e17cd21c64d8687aec26bf15609cb4 Mon Sep 17 00:00:00 2001 From: Dominic Saadi Date: Fri, 2 Jun 2023 21:16:32 -0700 Subject: [PATCH] chore(ci): deduplicate yarn cache by removing the `set-up-job` action (#8504) * chore(ci): remove set up job action This avoids caching yarn dependencies under two different keys. * same for canary release workflows --- .github/actions/set-up-job/action.yml | 36 ----------- .github/workflows/ci.yml | 63 ++++++++++++++++--- .github/workflows/publish-canary.yml | 14 ++++- .../workflows/publish-release-candidate.yml | 14 ++++- 4 files changed, 77 insertions(+), 50 deletions(-) delete mode 100644 .github/actions/set-up-job/action.yml diff --git a/.github/actions/set-up-job/action.yml b/.github/actions/set-up-job/action.yml deleted file mode 100644 index 20e5ddf68566..000000000000 --- a/.github/actions/set-up-job/action.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: ๐Ÿงถ Set up job -description: | - Set up node and yarn cache, then install. This sequence of steps appeared often enough - in many of Redwood's jobs to make it worth abstracting. - -inputs: - node-version: - default: 18 - github-token: - default: ${{ github.token }} - -runs: - using: composite - steps: - - uses: actions/setup-node@v3 - with: - node-version: ${{ inputs.node-version }} - - # From https://github.com/actions/cache/blob/main/examples.md#node---yarn-2. - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - shell: bash - - - uses: actions/cache@v3 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock', '.yarnrc.yml') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - run: yarn install - shell: bash - env: - GITHUB_TOKEN: ${{ inputs.github-token }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ecf449b35d0f..8428281bc10f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,12 +22,16 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - name: โฌข Set up Node.js + uses: actions/setup-node@v3 with: node-version: 18 - - run: yarn install + - name: ๐Ÿˆ Yarn install working-directory: ./.github/actions/only_doc_changes + run: yarn install --inline-builds + env: + GITHUB_TOKEN: ${{ github.token }} - name: ๐Ÿ“– Only doc changes? id: only-doc-changes @@ -40,11 +44,17 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + + - name: โฌข Set up Node.js + uses: actions/setup-node@v3 with: node-version: 18 - - run: yarn install + + - name: ๐Ÿˆ Yarn install working-directory: ./tasks/check + run: yarn install --inline-builds + env: + GITHUB_TOKEN: ${{ github.token }} - name: โœ… Check constraints, dependencies, and package.json's uses: ./tasks/check @@ -71,8 +81,19 @@ jobs: run: echo "echo "::remove-matcher owner=tsc::"" - uses: actions/checkout@v3 - - name: ๐Ÿงถ Set up job - uses: ./.github/actions/set-up-job + + - name: โฌข Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: ๐Ÿˆ Set up yarn cache + uses: ./.github/actions/set-up-yarn-cache + + - name: ๐Ÿˆ Yarn install + run: yarn install --inline-builds + env: + GITHUB_TOKEN: ${{ github.token }} - name: ๐Ÿ”จ Build run: yarn build @@ -109,8 +130,19 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - name: ๐Ÿงถ Set up job - uses: ./.github/actions/set-up-job + + - name: โฌข Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: ๐Ÿˆ Set up yarn cache + uses: ./.github/actions/set-up-yarn-cache + + - name: ๐Ÿˆ Yarn install + run: yarn install --inline-builds + env: + GITHUB_TOKEN: ${{ github.token }} - name: ๐Ÿ“ Create a temporary directory id: createpath @@ -378,8 +410,19 @@ jobs: REDWOOD_REDIRECT_TELEMETRY: "http://127.0.0.1:48619" # Random port steps: - uses: actions/checkout@v3 - - name: ๐Ÿงถ Set up job - uses: ./.github/actions/set-up-job + + - name: โฌข Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: ๐Ÿˆ Set up yarn cache + uses: ./.github/actions/set-up-yarn-cache + + - name: ๐Ÿˆ Yarn install + run: yarn install --inline-builds + env: + GITHUB_TOKEN: ${{ github.token }} - name: ๐Ÿ”จ Build run: yarn build diff --git a/.github/workflows/publish-canary.yml b/.github/workflows/publish-canary.yml index beb0b2ba735e..94450949ab3f 100644 --- a/.github/workflows/publish-canary.yml +++ b/.github/workflows/publish-canary.yml @@ -28,8 +28,18 @@ jobs: with: fetch-depth: 0 - - name: ๐Ÿงถ Set up job - uses: ./.github/actions/set-up-job + - name: โฌข Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: ๐Ÿˆ Set up yarn cache + uses: ./.github/actions/set-up-yarn-cache + + - name: ๐Ÿˆ Yarn install + run: yarn install --inline-builds + env: + GITHUB_TOKEN: ${{ github.token }} - name: โœ… Check constraints, dependencies, and package.json's uses: ./tasks/check diff --git a/.github/workflows/publish-release-candidate.yml b/.github/workflows/publish-release-candidate.yml index 6a534d39ec77..0cceff6881a4 100644 --- a/.github/workflows/publish-release-candidate.yml +++ b/.github/workflows/publish-release-candidate.yml @@ -62,8 +62,18 @@ jobs: # This is required because lerna uses tags to determine the version. fetch-depth: 0 - - name: ๐Ÿงถ Set up job - uses: ./.github/actions/set-up-job + - name: โฌข Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: ๐Ÿˆ Set up yarn cache + uses: ./.github/actions/set-up-yarn-cache + + - name: ๐Ÿˆ Yarn install + run: yarn install --inline-builds + env: + GITHUB_TOKEN: ${{ github.token }} - name: โœ… Check constraints, dependencies, and package.json's uses: ./tasks/check