|
87 | 87 | deploy_environment: ${{ steps.set-variables.outputs.deploy_environment }} |
88 | 88 | checkout_ref: ${{ steps.set-variables.outputs.checkout_ref }} |
89 | 89 | checkout_rev: ${{ steps.set-variables.outputs.checkout_rev }} |
| 90 | + packages: ${{ steps.discover-packages.outputs.packages }} |
90 | 91 |
|
91 | 92 | steps: |
92 | 93 | - name: Set action variables |
@@ -140,6 +141,23 @@ jobs: |
140 | 141 | echo "CHECKOUT_REF=$CHECKOUT_REF" >> $GITHUB_OUTPUT |
141 | 142 | echo "CHECKOUT_REV=$CHECKOUT_REV" >> $GITHUB_OUTPUT |
142 | 143 |
|
| 144 | + - name: Checkout for package discovery |
| 145 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4 |
| 146 | + with: |
| 147 | + sparse-checkout: | |
| 148 | + packages |
| 149 | + justfile |
| 150 | + sparse-checkout-cone-mode: false |
| 151 | + |
| 152 | + - name: Discover packages |
| 153 | + id: discover-packages |
| 154 | + run: | |
| 155 | + # Install just for package discovery |
| 156 | + curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin |
| 157 | + PACKAGES=$(just list-packages-json) |
| 158 | + echo "packages=$PACKAGES" >> $GITHUB_OUTPUT |
| 159 | + echo "Discovered packages: $PACKAGES" |
| 160 | +
|
143 | 161 | nix: |
144 | 162 | runs-on: ${{ matrix.os }} |
145 | 163 | strategy: |
@@ -189,57 +207,73 @@ jobs: |
189 | 207 | (github.event_name != 'workflow_dispatch' || |
190 | 208 | inputs.job == '' || |
191 | 209 | inputs.job == 'test') |
192 | | - runs-on: ubuntu-latest |
193 | 210 | strategy: |
194 | 211 | matrix: |
195 | | - package: |
196 | | - - name: docs |
197 | | - path: packages/docs |
| 212 | + package: ${{ fromJson(needs.set-variables.outputs.packages) }} |
198 | 213 | concurrency: |
199 | 214 | group: test-${{ matrix.package.name }}-${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref_name }} |
200 | 215 | cancel-in-progress: true |
201 | | - steps: |
202 | | - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4 |
203 | | - - name: Setup Nix |
204 | | - uses: ./.github/actions/setup-nix |
205 | | - env: |
206 | | - SOPS_AGE_KEY: ${{ secrets.SOPS_AGE_KEY }} |
207 | | - with: |
208 | | - installer: ${{ inputs.nix_installer || 'quick' }} |
209 | | - system: x86_64-linux |
210 | | - setup-cachix: true |
211 | | - - name: Install dependencies |
212 | | - run: nix develop -c just install |
213 | | - - name: Run unit tests with coverage |
214 | | - run: nix develop -c just test-coverage |
215 | | - - name: Build for E2E tests |
216 | | - run: nix develop -c just build |
217 | | - - name: Run E2E tests |
218 | | - run: nix develop -c just test-e2e |
219 | | - - name: Upload build artifacts |
220 | | - uses: actions/upload-artifact@v4 |
221 | | - with: |
222 | | - name: dist-${{ matrix.package.name }} |
223 | | - path: ${{ matrix.package.path }}/dist/ |
224 | | - retention-days: 7 |
225 | | - include-hidden-files: true |
226 | | - - name: Upload test results |
227 | | - if: always() |
228 | | - uses: actions/upload-artifact@v4 |
229 | | - with: |
230 | | - name: playwright-report-${{ matrix.package.name }} |
231 | | - path: ${{ matrix.package.path }}/playwright-report/ |
232 | | - retention-days: 7 |
233 | | - - name: Upload coverage |
234 | | - if: always() |
235 | | - uses: actions/upload-artifact@v4 |
236 | | - with: |
237 | | - name: coverage-${{ matrix.package.name }} |
238 | | - path: ${{ matrix.package.path }}/coverage/ |
239 | | - retention-days: 7 |
| 216 | + uses: ./.github/workflows/package-test.yaml |
| 217 | + with: |
| 218 | + package-name: ${{ matrix.package.name }} |
| 219 | + package-path: ${{ matrix.package.path }} |
| 220 | + debug-enabled: ${{ needs.set-variables.outputs.debug }} |
| 221 | + nix-installer: ${{ inputs.nix_installer || 'quick' }} |
| 222 | + secrets: |
| 223 | + SOPS_AGE_KEY: ${{ secrets.SOPS_AGE_KEY }} |
| 224 | + |
| 225 | + test-release-packages: |
| 226 | + needs: [set-variables, test] |
| 227 | + if: ${{ github.event_name == 'pull_request' && needs.set-variables.outputs.skip_ci != 'true' }} |
| 228 | + strategy: |
| 229 | + fail-fast: false |
| 230 | + matrix: |
| 231 | + package: ${{ fromJson(needs.set-variables.outputs.packages) }} |
| 232 | + concurrency: |
| 233 | + group: test-release-${{ matrix.package.name }}-${{ github.workflow }}-${{ github.event.pull_request.number }} |
| 234 | + cancel-in-progress: true |
| 235 | + permissions: |
| 236 | + contents: write |
| 237 | + id-token: write |
| 238 | + uses: ./.github/workflows/package-release.yaml |
| 239 | + with: |
| 240 | + package-path: ${{ matrix.package.path }} |
| 241 | + package-name: ${{ matrix.package.name }} |
| 242 | + release-dry-run: true |
| 243 | + debug-enabled: ${{ needs.set-variables.outputs.debug == 'true' }} |
| 244 | + checkout-ref: ${{ needs.set-variables.outputs.checkout_ref }} |
| 245 | + secrets: |
| 246 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 247 | + |
| 248 | + release-packages: |
| 249 | + needs: [set-variables, test, nix] |
| 250 | + if: | |
| 251 | + github.repository_owner == 'sciexp' && |
| 252 | + (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && |
| 253 | + (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta') && |
| 254 | + needs.set-variables.outputs.skip_ci != 'true' |
| 255 | + strategy: |
| 256 | + fail-fast: false |
| 257 | + matrix: |
| 258 | + package: ${{ fromJson(needs.set-variables.outputs.packages) }} |
| 259 | + concurrency: |
| 260 | + group: release-${{ matrix.package.name }}-${{ github.workflow }}-${{ github.ref_name }} |
| 261 | + cancel-in-progress: true |
| 262 | + permissions: |
| 263 | + contents: write |
| 264 | + id-token: write |
| 265 | + uses: ./.github/workflows/package-release.yaml |
| 266 | + with: |
| 267 | + package-path: ${{ matrix.package.path }} |
| 268 | + package-name: ${{ matrix.package.name }} |
| 269 | + release-dry-run: false |
| 270 | + debug-enabled: ${{ needs.set-variables.outputs.debug == 'true' }} |
| 271 | + checkout-ref: ${{ needs.set-variables.outputs.checkout_ref }} |
| 272 | + secrets: |
| 273 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
240 | 274 |
|
241 | 275 | deploy: |
242 | | - needs: [set-variables, nix, test] |
| 276 | + needs: [set-variables, nix, test, release-packages] |
243 | 277 | if: | |
244 | 278 | !cancelled() && |
245 | 279 | needs.set-variables.outputs.skip_ci != 'true' && |
|
0 commit comments