Skip to content

Transition to Yarn Workspaces #1548

Transition to Yarn Workspaces

Transition to Yarn Workspaces #1548

Workflow file for this run

name: On Pull Request
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: Test Actions
run: |
cd ./.github/actions
yarn test
- name: Fetch Master branch
run: git fetch origin master
- name: Get Package Information
id: info
uses: ./.github/actions/src/info
- name: Echo Information about docserver
run: echo ${{ steps.info.outputs.docserver }}
- name: Echo Information about devserver
run: echo ${{ steps.info.outputs.devserver }}
outputs:
bundles: ${{ steps.info.outputs.bundles }}
libs: ${{ steps.info.outputs.libs }}
tabs: ${{ steps.info.outputs.tabs }}
devserver: ${{ steps.info.outputs.devserver }}
docserver: ${{ steps.info.outputs.docserver }}
workflows: ${{ steps.info.outputs.workflows }}
libraries:
needs: find-packages
strategy:
fail-fast: false
matrix:
lib: ${{ fromJson(needs.find-packages.outputs.libs) }}
os: ['ubuntu-latest', 'windows-latest']
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ${{ matrix.lib.directory }}
shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }}
name: ${{ matrix.lib.name }} library (${{ matrix.os }})
steps:
- name: Check out source code
if: matrix.lib.changes
uses: actions/checkout@v4
- name: Initialize Repo
if: matrix.lib.changes
uses: ./.github/actions/src/init
with:
package-name: ${{ matrix.lib.name }}
playwright: ${{ matrix.lib.changes && matrix.lib.needsPlaywright }}
shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }}
- name: Run Tests
if: matrix.lib.changes
run: yarn test --coverage
- name: Run Auxillary Tasks
if: matrix.lib.changes
run: yarn tsc
# tabs:
# runs-on: ubuntu-latest
# needs: find-packages
# strategy:
# fail-fast: false
# matrix:
# tabInfo: ${{ fromJson(needs.find-packages.outputs.tabs) }}
# name: ${{ matrix.tabInfo.tabName }} Tab
# steps:
# - name: Check out source code
# if: matrix.tabInfo.changes
# uses: actions/checkout@v4
# - name: Initialize Repo
# if: matrix.tabInfo.changes
# uses: ./.github/actions/src/init
# with:
# package-name: ${{ matrix.tabInfo.name }}
# playwright: ${{ matrix.tabInfo.needsPlaywright && matrix.tabInfo.changes }}
# - name: Build Tab
# if: matrix.tabInfo.changes
# run: |
# cd ${{ matrix.tabInfo.directory }}
# yarn build
# - name: Upload Tab Artifact
# if: matrix.tabInfo.changes
# uses: actions/upload-artifact@v4
# with:
# name: ${{ matrix.tabInfo.tabName }} Tab
# path: ./build/tabs/${{ matrix.tabInfo.tabName }}.js
# - name: Run Tests
# # https://github.com/vitest-dev/vitest/issues/5477
# # Known Vitest issue for coverage running in browser mode
# # Momentarily disable coverage checking on Github Actions for tabs
# 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:
# runs-on: ubuntu-latest
# needs: find-packages
# strategy:
# fail-fast: false
# matrix:
# bundleInfo: ${{ fromJson(needs.find-packages.outputs.bundles) }}
# name: ${{ matrix.bundleInfo.bundleName }} Bundle
# steps:
# - name: Check out source code
# if: matrix.bundleInfo.changes
# uses: actions/checkout@v4
# - name: Initialize Repo
# if: matrix.bundleInfo.changes
# uses: ./.github/actions/src/init
# with:
# package-name: ${{ matrix.bundleInfo.name }}
# playwright: ${{ matrix.bundleInfo.needsPlaywright }}
# - name: Build Bundle
# if: matrix.bundleInfo.changes
# run: |
# cd ${{ matrix.bundleInfo.directory }}
# yarn build
# yarn tsc
# - name: Upload Compiled Bundle Artifact
# if: matrix.bundleInfo.changes
# uses: actions/upload-artifact@v4
# with:
# name: ${{ matrix.bundleInfo.bundleName }} Compiled Bundle
# path: ./build/bundles/${{ matrix.bundleInfo.bundleName }}.js
# - name: Build Bundle Docs
# if: matrix.bundleInfo.changes
# run: |
# cd ${{ matrix.bundleInfo.directory }}
# yarn buildtools build docs
# - name: Upload Compiled Bundle Docs Artifact
# if: matrix.bundleInfo.changes
# uses: actions/upload-artifact@v4
# with:
# path: ${{ matrix.bundleInfo.directory }}/dist/docs.json
# name: ${{ matrix.bundleInfo.bundleName }} Docs
# - name: Run Tests
# if: matrix.bundleInfo.changes
# run: |
# cd ${{ matrix.bundleInfo.directory }}
# yarn test --coverage
# devserver:
# name: Dev Server Tasks
# runs-on: ubuntu-latest
# needs:
# - find-packages
# - bundles
# - tabs
# if: ${{ needs.find-packages.outputs.devserver.changes }}
# 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 --coverage
# - name: Run Auxillary Tasks
# run: |
# cd ./devserver
# yarn tsc
# docserver:
# name: Docs Server Tasks
# runs-on: ubuntu-latest
# needs:
# - libraries
# - find-packages
# if: ${{ needs.find-packages.outputs.docserver.changes }}
# 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
# - name: Build Manifest
# run: yarn buildtools manifest
# - name: Upload Manifest
# uses: actions/upload-artifact@v4
# with:
# name: manifest
# path: ./build/modules.json