|
9 | 9 | - master |
10 | 10 |
|
11 | 11 | jobs: |
12 | | - setup-repo: |
13 | | - name: Setup Repository Tooling |
| 12 | + setup-repotools: |
| 13 | + name: Setup Repotools package |
14 | 14 | runs-on: ubuntu-latest |
15 | 15 |
|
16 | 16 | steps: |
|
47 | 47 | path: ./lib/repotools/dist |
48 | 48 | key: repotools |
49 | 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/restore@v4 |
55 | | - id: cache-buildtools |
56 | | - with: |
57 | | - path: ./lib/buildtools/bin/index.js |
58 | | - key: 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/save@v4 |
67 | | - with: |
68 | | - path: ./lib/buildtools/bin/index.js |
69 | | - key: buildtools |
70 | | - |
71 | 50 | find-packages: |
72 | 51 | name: Determine the packages present in the repo for the given type |
73 | | - needs: setup-repo |
| 52 | + needs: setup-repotools |
74 | 53 | runs-on: ubuntu-latest |
75 | 54 | strategy: |
76 | 55 | matrix: |
@@ -103,46 +82,83 @@ jobs: |
103 | 82 | with: |
104 | 83 | type: ${{ matrix.type }} |
105 | 84 |
|
106 | | - test-libs: |
107 | | - name: Test and Typecheck libraries |
| 85 | + build-libs: |
| 86 | + name: Build and compile the libraries |
108 | 87 | runs-on: ubuntu-latest |
109 | 88 | needs: find-packages |
110 | 89 | strategy: |
111 | 90 | matrix: |
112 | | - package: ${{ fromJson(needs.find-packages.outputs.tabs) }} |
113 | | - |
114 | | - steps: |
115 | | - - name: Check out source code |
116 | | - uses: actions/checkout@v4 |
117 | | - |
118 | | - - name: Enable Corepack |
119 | | - run: corepack enable |
| 91 | + package: ${{ fromJSON(needs.find-packages.outputs.libs )}} |
120 | 92 |
|
121 | | - - name: Use Node.js 💻 |
122 | | - uses: actions/setup-node@v4 |
123 | | - with: |
124 | | - node-version-file: .node-version |
125 | | - cache: yarn |
| 93 | + defaults: |
| 94 | + run: |
| 95 | + working-directory: ${{ matrix.package.directory }} |
126 | 96 |
|
| 97 | + steps: |
127 | 98 | - name: Install dependencies |
128 | 99 | run: yarn workspaces focus ${{ matrix.package.name }} |
129 | 100 |
|
130 | | - - name: Restore repotools |
| 101 | + - name: Check cache |
131 | 102 | uses: actions/cache/restore@v4 |
| 103 | + id: cache |
132 | 104 | with: |
133 | | - path: ./lib/repotools/dist |
134 | | - key: repotools |
| 105 | + path: ${{ matrix.package.directory }}/dist |
| 106 | + key: ${{ matrix.package.name }} |
135 | 107 |
|
136 | | - - name: tsc and test |
137 | | - run: | |
138 | | - cd ${{ matrix.package.directory }} |
139 | | - yarn tsc |
140 | | - yarn test |
| 108 | + - name: Build ${{ matrix.package.name }} |
| 109 | + if: steps.cache.outputs.cache-hit != 'true' |
| 110 | + run: yarn build |
| 111 | + |
| 112 | + - name: Store in Cache |
| 113 | + if: steps.cache.outputs.cache-hit != 'true' |
| 114 | + uses: actions/cache/save@v4 |
| 115 | + with: |
| 116 | + path: ${{ matrix.package.directory }}/dist |
| 117 | + key: ${{ matrix.package.name }} |
| 118 | + |
| 119 | + # test-libs: |
| 120 | + # name: Test and Typecheck libraries |
| 121 | + # runs-on: ubuntu-latest |
| 122 | + # needs: find-packages |
| 123 | + # strategy: |
| 124 | + # matrix: |
| 125 | + # package: ${{ fromJson(needs.find-packages.outputs.tabs) }} |
| 126 | + |
| 127 | + # steps: |
| 128 | + # - name: Check out source code |
| 129 | + # uses: actions/checkout@v4 |
| 130 | + |
| 131 | + # - name: Enable Corepack |
| 132 | + # run: corepack enable |
| 133 | + |
| 134 | + # - name: Use Node.js 💻 |
| 135 | + # uses: actions/setup-node@v4 |
| 136 | + # with: |
| 137 | + # node-version-file: .node-version |
| 138 | + # cache: yarn |
| 139 | + |
| 140 | + # - name: Install dependencies |
| 141 | + # run: yarn workspaces focus ${{ matrix.package.name }} |
| 142 | + |
| 143 | + # - name: Restore repotools |
| 144 | + # uses: actions/cache/restore@v4 |
| 145 | + # with: |
| 146 | + # path: ./lib/repotools/dist |
| 147 | + # key: repotools |
| 148 | + |
| 149 | + # - name: tsc and test |
| 150 | + # run: | |
| 151 | + # cd ${{ matrix.package.directory }} |
| 152 | + # yarn tsc |
| 153 | + # yarn test |
141 | 154 |
|
142 | 155 | test-tabs: |
143 | 156 | name: Test and Typecheck tabs |
144 | 157 | runs-on: ubuntu-latest |
145 | | - needs: find-packages |
| 158 | + needs: |
| 159 | + - build-libs |
| 160 | + - find-packages |
| 161 | + |
146 | 162 | strategy: |
147 | 163 | fail-fast: false |
148 | 164 | matrix: |
@@ -178,13 +194,13 @@ jobs: |
178 | 194 | - name: Restore buildtools |
179 | 195 | uses: actions/cache/restore@v4 |
180 | 196 | with: |
181 | | - key: buildtools |
182 | | - path: ./lib/buildtools/bin/index.js |
| 197 | + key: "@sourceacademy/modules-buildtools" |
| 198 | + path: ./lib/buildtools/dist |
183 | 199 |
|
184 | 200 | - name: Restore repotools |
185 | 201 | uses: actions/cache/restore@v4 |
186 | 202 | with: |
187 | | - key: repotools |
| 203 | + key: "@sourceacademy/modules-repotools" |
188 | 204 | path: ./lib/repotools/dist |
189 | 205 |
|
190 | 206 | - name: Install dependencies |
|
0 commit comments