Transition to Yarn Workspaces #1451
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: on-pull-request | |
| permissions: | |
| contents: read | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| jobs: | |
| paths-filter: | |
| name: Determine which files have changed | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out source code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Filter paths | |
| uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: | | |
| workflows: | |
| - .github/workflows/** | |
| devserver: | |
| - 'devserver/**' | |
| libraries: | |
| - 'lib/**' | |
| tabs: | |
| - src/tabs/** | |
| bundles: | |
| - src/bundles/** | |
| docs: | |
| - docs/** | |
| outputs: | |
| # if the workflow file was modified, then we rerun the entire job | |
| devserver: ${{ steps.filter.outputs.devserver || steps.filter.outputs.workflows }} | |
| # if the devserver needs to be tested bundles and tabs need to be rebuilt | |
| tabs: ${{ steps.filter.outputs.tabs || steps.filter.outputs.workflows || steps.filter.outputs.devserver }} | |
| bundles: ${{ steps.filter.outputs.bundles || steps.filter.outputs.workflows || steps.filter.outputs.devserver }} | |
| libraries: ${{ steps.filter.outputs.libraries || steps.filter.outputs.workflows }} | |
| docs: ${{ steps.filter.outputs.docs || steps.filter.outputs.workflows }} | |
| playwright: ${{ steps.filter.outputs.devserver || steps.filter.outputs.libraries || steps.filter.outputs.tabs }} | |
| test: | |
| name: Verify that all tests, linting, type-checking and building succeeds. | |
| runs-on: ubuntu-latest | |
| # execute after the paths-filter job is done | |
| needs: paths-filter | |
| steps: | |
| - name: Check out source code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Enable Corepack | |
| run: corepack enable | |
| - name: Use Node.js 💻 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: .node-version | |
| cache: yarn | |
| # For whatever reason, repotools refuses to install correctly, so we have to install it separately and | |
| # build it in its entirety before proceeding with installing everything else | |
| - 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 install --immutable | |
| - name: Install Playwright | |
| if: needs.paths-filter.outputs.playwright == 'true' | |
| run: yarn playwright install --with-deps | |
| - name: Run tsc for libraries | |
| if: needs.paths-filter.outputs.libraries == 'true' | |
| run: yarn workspaces foreach -ptW --from "./lib/*" run tsc | |
| - name: Run build for libraries | |
| run: yarn workspaces foreach -ptW --from "./lib/*" run build | |
| - name: Run test for libraries | |
| if: needs.paths-filter.outputs.libraries == 'true' | |
| run: yarn test:libs | |
| - name: Build and run tsc for bundles and tabs | |
| if: needs.paths-filter.outputs.bundles == 'true' || needs.paths-filter.outputs.tabs == 'true' | |
| run: yarn workspaces foreach -j 5 -ptW --from "./src/{bundles,tabs}/*" run build --tsc | |
| - name: Test bundles | |
| if: needs.paths-filter.outputs.bundles == 'true' | |
| run: yarn workspaces foreach -j 5 -ptW --from "./src/bundles/*" run test | |
| - name: Test tabs | |
| if: needs.paths-filter.outputs.tabs == 'true' | |
| run: yarn workspaces foreach -j 5 -ptW --from "./src/tabs/*" run test | |
| - name: Build manifest | |
| if: needs.paths-filter.outputs.devserver == 'true' | |
| run: yarn buildtools manifest | |
| - name: Build Docs Server | |
| if: needs.paths-filter.outputs.docs == 'true' | |
| run: yarn workspaces foreach -A --include "@sourceacademy/modules-docserver" run build | |
| - name: Run tsc for Dev Server | |
| if: needs.paths-filter.outputs.devserver == 'true' | |
| run: yarn tsc:devserver | |
| - name: Test Dev Server | |
| if: needs.paths-filter.outputs.devserver == 'true' | |
| run: yarn test:devserver | |
| - name: Lint Everything | |
| run: yarn buildtools lintglobal |