Transition to Yarn Workspaces #24
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: | |
| find-packages: | |
| name: Get packages within the repository | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out source code | |
| uses: actions/checkout@v4 | |
| - name: Initialize Repo | |
| uses: ./.github/actions/src/init | |
| with: | |
| package-name: '@sourceacademy/modules-github-actions' | |
| - name: Build actions | |
| run: | | |
| cd ./.github/actions | |
| yarn build | |
| - name: Get Package Information | |
| id: info | |
| uses: ./.github/actions/src/info | |
| outputs: | |
| bundles: ${{ steps.info.outputs.bundles }} | |
| libs: ${{ steps.info.outputs.libs }} | |
| tabs: ${{ steps.info.outputs.tabs }} | |
| libraries: | |
| name: Libaries | |
| runs-on: ubuntu-latest | |
| needs: find-packages | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| lib: ${{ fromJson(needs.find-packages.outputs.libs) }} | |
| steps: | |
| - name: Check out source code | |
| uses: actions/checkout@v4 | |
| - name: Initialize Repo | |
| uses: ./.github/actions/src/init | |
| with: | |
| package-name: ${{ matrix.lib.name }} | |
| playwright: ${{ matrix.lib.changes && matrix.lib.needsPlaywright }} | |
| - name: Run Tests | |
| if: matrix.lib.changes | |
| run: | | |
| cd ${{ matrix.lib.directory }} | |
| yarn test | |
| - name: Run Auxillary Tasks | |
| if: matrix.lib.changes | |
| run: | | |
| cd ${{ matrix.lib.directory }} | |
| yarn tsc | |
| yarn lint | |
| tabs: | |
| name: Tabs | |
| runs-on: ubuntu-latest | |
| needs: find-packages | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| tabInfo: ${{ fromJson(needs.find-packages.outputs.tabs) }} | |
| steps: | |
| - name: Check out source code | |
| uses: actions/checkout@v4 | |
| - name: Initialize Repo | |
| uses: ./.github/actions/src/init | |
| with: | |
| package-name: ${{ matrix.tabInfo.name }} | |
| playwright: ${{ matrix.tabInfo.needsPlaywright && matrix.tabInfo.changes }} | |
| - name: Install Dependencies | |
| run: yarn workspaces focus ${{ matrix.tabInfo.name }} | |
| - name: Build Tab | |
| run: yarn workspaces foreach -A --include ${{ matrix.tabInfo.name }} run build | |
| - name: Cache Tab | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: ./build/tabs/${{ matrix.tabInfo.tabName }}.js | |
| key: ${{ matrix.tabInfo.name }} | |
| - name: Run Tests | |
| if: matrix.tabInfo.changes | |
| run: | | |
| cd ${{ matrix.tabInfo.directory }} | |
| yarn test | |
| - name: Run Auxillary Tasks | |
| if: matrix.tabInfo.changes | |
| run: | | |
| cd ${{ matrix.tabInfo.directory }} | |
| yarn tsc | |
| yarn lint | |
| bundles: | |
| name: Bundles | |
| runs-on: ubuntu-latest | |
| needs: find-packages | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| bundleInfo: ${{ fromJson(needs.find-packages.outputs.bundles) }} | |
| steps: | |
| - name: Check out source code | |
| uses: actions/checkout@v4 | |
| - name: Initialize Repo | |
| uses: ./.github/actions/src/init | |
| with: | |
| package-name: ${{ matrix.bundleInfo.name }} | |
| - name: Build Bundle | |
| run: | | |
| cd ${{ matrix.bundleInfo.directory }} | |
| yarn build | |
| yarn tsc | |
| - name: Cache Buildtools Compiled Bundle | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: ./build/bundles/${{ matrix.bundleInfo.bundleName }}.js | |
| key: ${{ matrix.bundleInfo.name }}-buildtools | |
| - name: Cache tsc Compiled Bundle | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: ${{ matrix.bundleInfo.directory }}/dist | |
| key: ${{ matrix.bundleInfo.name }}-tsc | |
| - name: Run Tests | |
| if: matrix.bundleInfo.changes == 'true' | |
| run: | | |
| cd ${{ matrix.bundleInfo.directory }} | |
| yarn test | |
| - name: Run Auxillary Tasks | |
| if: matrix.bundleInfo.changes == 'true' | |
| run: | | |
| cd ${{ matrix.bundleInfo.directory }} | |
| yarn tsc | |
| yarn lint | |
| devserver: | |
| name: Dev Server Tests | |
| runs-on: ubuntu-latest | |
| needs: | |
| - bundles | |
| - tabs | |
| steps: | |
| - name: Check out source code | |
| uses: actions/checkout@v4 | |
| - name: Initialize Repo | |
| uses: ./.github/actions/src/init | |
| with: | |
| package-name: '@sourceacademy/modules-devserver' | |
| playwright: true | |
| - name: Build all tabs | |
| run: yarn workspaces foreach -ptW --from "./src/tabs/*" run build | |
| - name: Run tests | |
| run: | | |
| cd ./devserver | |
| yarn test | |
| - name: Run Auxillary Tasks | |
| run: | | |
| cd ./devserver | |
| yarn tsc | |
| docserver: | |
| name: Docs Server Tests | |
| runs-on: ubuntu-latest | |
| needs: libraries | |
| steps: | |
| - name: Check out source code | |
| uses: actions/checkout@v4 | |
| - name: Initialize Repo | |
| uses: ./.github/actions/src/init | |
| with: | |
| package-name: '@sourceacademy/modules-docserver' | |
| - name: Build Docs | |
| run: | | |
| cd ./docs | |
| yarn build | |
| repo-tasks: | |
| name: Repo Wide Tasks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out source code | |
| uses: actions/checkout@v4 | |
| - name: Initialize Repo | |
| uses: ./.github/actions/src/init | |
| with: | |
| package-name: '@sourceacademy/modules' | |
| - name: Lint Everything | |
| run: yarn lint:all |