|
9 | 9 | - master |
10 | 10 |
|
11 | 11 | jobs: |
| 12 | + setup-repo: |
| 13 | + name: Setup Repository Tooling |
| 14 | + runs-on: ubuntu-latest |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Check out source code |
| 18 | + uses: actions/checkout@v4 |
| 19 | + |
| 20 | + - name: Enable Corepack |
| 21 | + run: corepack enable |
| 22 | + |
| 23 | + - name: Use Node.js 💻 |
| 24 | + uses: actions/setup-node@v4 |
| 25 | + with: |
| 26 | + node-version-file: .node-version |
| 27 | + cache: yarn |
| 28 | + |
| 29 | + - name: Check cache for repotools |
| 30 | + uses: actions/cache@v4/restore |
| 31 | + id: cache-repotools |
| 32 | + with: |
| 33 | + path: ./lib/repotools/dist |
| 34 | + restore-keys: repotools |
| 35 | + |
| 36 | + - name: Install Repotools Dependencies |
| 37 | + run: yarn workspaces focus @sourceacademy/modules-repotools |
| 38 | + |
| 39 | + - name: Build Repotools |
| 40 | + if: steps.cache-repotools.outputs.cache-hit != 'true' |
| 41 | + run: yarn workspaces foreach -A --include @sourceacademy/modules-repotools run build |
| 42 | + |
| 43 | + - name: Cache Repotools |
| 44 | + if: steps.cache-repotools.outputs.cache-hit != 'true' |
| 45 | + uses: actions/cache@v4/save |
| 46 | + with: |
| 47 | + path: ./lib/repotools/dist |
| 48 | + key: repotools |
| 49 | + |
| 50 | + - name: Install Buildtools Dependencies |
| 51 | + run: yarn workspaces focus @sourceacademy/modules-buildtools |
| 52 | + |
| 53 | + - name: Check cache for buildtools |
| 54 | + uses: actions/cache@v4/restore |
| 55 | + id: cache-buildtools |
| 56 | + with: |
| 57 | + path: ./lib/buildtools/bin/index.js |
| 58 | + restore-keys: buildtools |
| 59 | + |
| 60 | + - name: Build Buildtools |
| 61 | + if: steps.cache-buildtools.outputs.cache-hit != 'true' |
| 62 | + run: yarn workspaces foreach -A --include @sourceacademy/modules-buildtools run build |
| 63 | + |
| 64 | + - name: Cache Buildtools |
| 65 | + if: steps.cache-repotools.outputs.cache-hit != 'true' |
| 66 | + uses: actions/cache@v4/save |
| 67 | + with: |
| 68 | + path: ./lib/buildtools/bin/index.js |
| 69 | + key: buildtools |
| 70 | + |
12 | 71 | find-packages: |
13 | 72 | name: Determine the packages present in the repo for the given type |
| 73 | + needs: setup-repo |
14 | 74 | runs-on: ubuntu-latest |
15 | 75 | strategy: |
16 | 76 | matrix: |
@@ -109,6 +169,12 @@ jobs: |
109 | 169 | - name: Change into directory for ${{ matrix.package.name }} |
110 | 170 | run: cd ${{ matrix.package.directory }} |
111 | 171 |
|
| 172 | + - name: Restore buildtools |
| 173 | + uses: actions/cache@v4/restore |
| 174 | + with: |
| 175 | + key: buildtools |
| 176 | + path: ./lib/buildtools/bin/index.js |
| 177 | + |
112 | 178 | - name: Install dependencies |
113 | 179 | uses: ./.github/actions/src/install-deps |
114 | 180 | with: |
|
0 commit comments