Transition to Yarn Workspaces #19
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: new-workflow | |
| permissions: | |
| contents: read | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| jobs: | |
| build-actions: | |
| name: Builds the github actions that will be used | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out source code | |
| uses: actions/checkout@v4 | |
| - name: Enable Corepack | |
| run: corepack enable | |
| - name: Use Node.js 💻 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: .node-version | |
| cache: yarn | |
| - name: Setup repotools | |
| run: | | |
| yarn workspaces focus @sourceacademy/modules-repotools | |
| yarn workspaces foreach -A --include @sourceacademy/modules-repotools run build | |
| - name: Install dependencies | |
| run: yarn workspaces focus @sourceacademy/modules-github-actions | |
| - name: Build | |
| run: | | |
| yarn workspaces foreach -A --include @sourceacademy/modules-github-actions run build | |
| load-packages: | |
| name: Determine the packages present in the repo for the given type | |
| needs: build-actions | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| type: ['libs', 'bundles', 'tabs'] | |
| outputs: | |
| libs: ${{ steps.find.outputs.libs }} | |
| bundles: ${{ steps.find.outputs.bundles }} | |
| tabs: ${{ steps.find.outputs.tabs }} | |
| steps: | |
| - name: Check out source code | |
| uses: actions/checkout@v4 | |
| - name: Enable Corepack | |
| run: corepack enable | |
| - name: Use Node.js 💻 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: .node-version | |
| cache: yarn | |
| - name: Find Packages | |
| id: find | |
| uses: ./.github/actions/src/info | |
| with: | |
| type: ${{ matrix.type }} | |
| test-libs: | |
| name: Test and Typecheck libraries | |
| runs-on: ubuntu-latest | |
| needs: load-packages | |
| strategy: | |
| matrix: | |
| package: ${{ fromJson(needs.load-packages.outputs.tabs) }} | |
| steps: | |
| - name: Check out source code | |
| uses: actions/checkout@v4 | |
| - name: Enable Corepack | |
| run: corepack enable | |
| - name: Use Node.js 💻 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: .node-version | |
| cache: yarn | |
| - name: Install dependencies | |
| run: yarn workspaces focus ${{ matrix.package.name }} | |
| - name: tsc and test | |
| run: | | |
| cd ${{ matrix.package.directory }} | |
| yarn tsc | |
| yarn test | |
| test-tabs: | |
| name: Test and Typecheck tabs | |
| runs-on: ubuntu-latest | |
| needs: load-packages | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| package: ${{ fromJson(needs.load-packages.outputs.tabs) }} | |
| steps: | |
| - name: Check out source code | |
| uses: actions/checkout@v4 | |
| - name: Enable Corepack | |
| run: corepack enable | |
| - name: Use Node.js 💻 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: .node-version | |
| cache: yarn | |
| - name: Filter paths | |
| uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: | | |
| changed: | |
| ${{ matrix.package.directory }}/** | |
| - name: Change into directory | |
| run: cd ${{ matrix.package.directory }} | |
| - name: Install dependencies | |
| uses: ./.github/actions/src/install-deps | |
| with: | |
| directory: ${{ matrix.package.directory }} | |
| packageName: ${{ matrix.package.name }} | |
| testRequired: ${{ steps.filter.outputs.changed == 'true' }} | |
| - name: tsc and test | |
| if: steps.filter.outputs.changed == 'true' | |
| run: | | |
| yarn tsc | |
| yarn test | |
| - name: Build | |
| run: yarn build |