Skip to content

Transition to Yarn Workspaces #39

Transition to Yarn Workspaces

Transition to Yarn Workspaces #39

Workflow file for this run

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: Fetch Master branch
run: git fetch origin master
- 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: Libraries
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
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: 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
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
run: |
cd ${{ matrix.bundleInfo.directory }}
yarn test
- name: Run Auxillary Tasks
if: matrix.bundleInfo.changes
run: |
cd ${{ matrix.bundleInfo.directory }}
yarn tsc
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: Check constraints
run: yarn constraints
- name: Lint Everything
run: yarn lint:all