Transition to Yarn Workspaces #1351
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 | |
| 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/**' | |
| modules: | |
| - src/{bundles,tabs}/** | |
| 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 | |
| modules: ${{ steps.filter.outputs.modules || 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 }} | |
| test: | |
| name: Verify all tests pass and build success | |
| 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: 22 | |
| cache: yarn | |
| - name: Install dependencies | |
| run: yarn install --immutable | |
| - name: Run tsc for libraries | |
| if: needs.paths-filter.outputs.libraries == 'true' | |
| run: yarn workspaces foreach -ptW --from "./lib/*" run tsc | |
| - name: Run lint for libraries | |
| if: needs.paths-filter.outputs.libraries == 'true' | |
| run: yarn eslint lib | |
| - name: Run test for libraries | |
| if: needs.paths-filter.outputs.libraries == 'true' | |
| run: yarn test:libs | |
| - name: Build, lint and run tsc for bundles and tabs | |
| if: needs.paths-filter.outputs.devserver == 'true' | |
| run: yarn workspaces foreach -j 5 -ptW --from "./src/{bundles,tabs}/*" run build --tsc --lint | |
| - name: Test bundles and tabs | |
| if: needs.paths-filter.outputs.modules == 'true' | |
| run: yarn test:modules | |
| - name: Build manifest | |
| if: needs.paths-filter.outputs.devserver == 'true' | |
| run: yarn buildtools build 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: Run Lint for Dev Server | |
| if: needs.paths-filter.outputs.devserver == 'true' | |
| run: yarn eslint devserver | |
| - name: Test Dev Server | |
| if: needs.paths-filter.outputs.devserver == 'true' | |
| run: yarn test:devserver |