Skip to content

Commit

Permalink
split coverage command for workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
peterstarling committed Feb 5, 2024
1 parent 57a8385 commit 9e5e9a0
Show file tree
Hide file tree
Showing 23 changed files with 48 additions and 22 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/on-push-branch-turbo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ jobs:
id: cpu-cores
uses: SimenB/github-actions-cpu-cores@v1
- name: Test ${{ matrix.package }}
run: yarn turbo test --filter="${{ matrix.package }}" --cache-dir=.turbo --only --no-deps -- --coverage --maxWorkers=${{ steps.cpu-cores.outputs.count }} --ci
run: yarn turbo test:coverage --filter="${{ matrix.package }}" --cache-dir=.turbo --only --no-deps -- --maxWorkers=${{ steps.cpu-cores.outputs.count }} --ci
- name: move coverage
shell: bash
run: |
PACKAGE="$(echo ${{ matrix.package }} | cut -c 11-)"
mv coverage/coverage-final.json coverage/$PACKAGE.json
PACKAGE_NAME="$(echo ${{ matrix.package }} | cut -c 11-)"
## get package directory
mkdir -p coverage
yarn workspace ${{ matrix.package }} exec mv coverage/coverage-final.json ../../coverage/$PACKAGE_NAME.json
- uses: actions/upload-artifact@v3
with:
name: coverage-artifacts
Expand Down
3 changes: 2 additions & 1 deletion apps/auth0/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"deploy": "yarn sync:dependencies && yarn deploy:tennant",
"sync:dependencies": "ts-node ./scripts/dependencies-sync.ts",
"deploy:tennant": "a0deploy import --input_file ./build/tenant.yaml",
"test": "WORKSPACE_PATH=apps/auth0 yarn workspace asap-hub test:workspace"
"test": "WORKSPACE_PATH=apps/auth0 yarn workspace asap-hub test:workspace",
"test:coverage": "WORKSPACE_PATH=apps/auth0; yarn workspace asap-hub test:workspace --coverage --coverageDirectory=./$WORKSPACE_PATH/coverage/"
},
"dependencies": {
"@babel/runtime-corejs3": "7.23.8",
Expand Down
3 changes: 2 additions & 1 deletion apps/crn-auth-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"start": "cross-env PORT=3002 TSC_COMPILE_ON_ERROR=true vite",
"build": "vite build",
"typecheck": "tsc",
"test": "WORKSPACE_PATH=apps/crn-auth-frontend yarn workspace asap-hub test:workspace"
"test": "WORKSPACE_PATH=apps/crn-auth-frontend yarn workspace asap-hub test:workspace",
"test:coverage": "WORKSPACE_PATH=apps/crn-auth-frontend; yarn workspace asap-hub test:workspace --coverage --coverageDirectory=./$WORKSPACE_PATH/coverage/"
},
"dependencies": {
"@asap-hub/auth": "workspace:*",
Expand Down
1 change: 1 addition & 0 deletions apps/crn-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"build": "node ./scripts/build-unsupported-browser-page.js && vite build",
"typecheck": "tsc",
"test": "WORKSPACE_PATH=apps/crn-frontend yarn workspace asap-hub test:workspace",
"test:coverage": "WORKSPACE_PATH=apps/crn-frontend; yarn workspace asap-hub test:workspace --coverage --coverageDirectory=./$WORKSPACE_PATH/coverage/",
"release:frontend": "node ./scripts/sentry-release.js"
},
"dependencies": {
Expand Down
3 changes: 2 additions & 1 deletion apps/crn-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"watch:babel": "../../scripts/build-babel.sh watch",
"start": "node-dev ./src/server.ts",
"typecheck": "tsc",
"test": "WORKSPACE_PATH=apps/crn-server yarn workspace asap-hub test:workspace"
"test": "WORKSPACE_PATH=apps/crn-server yarn workspace asap-hub test:workspace",
"test:coverage": "WORKSPACE_PATH=apps/crn-server; yarn workspace asap-hub test:workspace --coverage --coverageDirectory=./$WORKSPACE_PATH/coverage/"
},
"dependenciesMeta": {
"serverless": {
Expand Down
3 changes: 2 additions & 1 deletion apps/gp2-auth-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"start": "cross-env PORT=3002 TSC_COMPILE_ON_ERROR=true vite",
"build": "vite build",
"typecheck": "tsc",
"test": "WORKSPACE_PATH=apps/gp2-auth-frontend yarn workspace asap-hub test:workspace"
"test": "WORKSPACE_PATH=apps/gp2-auth-frontend yarn workspace asap-hub test:workspace",
"test:coverage": "WORKSPACE_PATH=apps/gp2-auth-frontend; yarn workspace asap-hub test:workspace --coverage --coverageDirectory=./$WORKSPACE_PATH/coverage/"
},
"dependencies": {
"@asap-hub/auth": "workspace:*",
Expand Down
1 change: 1 addition & 0 deletions apps/gp2-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"build": "node ./scripts/build-unsupported-browser-page.js && vite build",
"typecheck": "tsc",
"test": "WORKSPACE_PATH=apps/gp2-frontend yarn workspace asap-hub test:workspace",
"test:coverage": "WORKSPACE_PATH=apps/gp2-frontend; yarn workspace asap-hub test:workspace --coverage --coverageDirectory=./$WORKSPACE_PATH/coverage/",
"release:frontend": "node ./scripts/sentry-release.js"
},
"dependencies": {
Expand Down
3 changes: 2 additions & 1 deletion apps/gp2-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"migrate:entity-outputs": "CONTENTFUL_ACCESS_TOKEN=$GP2_CONTENTFUL_ACCESS_TOKEN CONTENTFUL_SPACE_ID=$GP2_CONTENTFUL_SPACE_ID CONTENTFUL_ENV_ID=$GP2_CONTENTFUL_ENV_ID ts-node ./scripts/migrate-entity-outputs.ts",
"user:invitations": "ts-node ./scripts/user-invitations.ts",
"subscribe": "ts-node ./scripts/subscribe-calendar.ts",
"test": "WORKSPACE_PATH=apps/gp2-server yarn workspace asap-hub test:workspace"
"test": "WORKSPACE_PATH=apps/gp2-server yarn workspace asap-hub test:workspace",
"test:coverage": "WORKSPACE_PATH=apps/gp2-server; yarn workspace asap-hub test:workspace --coverage --coverageDirectory=./$WORKSPACE_PATH/coverage/"
},
"dependencies": {
"@asap-hub/algolia": "workspace:*",
Expand Down
3 changes: 2 additions & 1 deletion apps/orcid-user-profile-script/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"build:babel": "../../scripts/build-babel.sh build",
"watch:babel": "../../scripts/build-babel.sh watch",
"typecheck": "tsc",
"test": "WORKSPACE_PATH=apps/orcid-user-profile-script yarn workspace asap-hub test:workspace"
"test": "WORKSPACE_PATH=apps/orcid-user-profile-script yarn workspace asap-hub test:workspace",
"test:coverage": "WORKSPACE_PATH=apps/orcid-user-profile-script; yarn workspace asap-hub test:workspace --coverage --coverageDirectory=./$WORKSPACE_PATH/coverage/"
},
"dependencies": {
"jsonwebtoken": "9.0.0"
Expand Down
3 changes: 2 additions & 1 deletion packages/algolia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"scripts": {
"build:babel": "../../scripts/build-babel.sh build",
"watch:babel": "../../scripts/build-babel.sh watch",
"test": "WORKSPACE_PATH=packages/algolia yarn workspace asap-hub test:workspace"
"test": "WORKSPACE_PATH=packages/algolia yarn workspace asap-hub test:workspace",
"test:coverage": "WORKSPACE_PATH=packages/algolia; yarn workspace asap-hub test:workspace --coverage --coverageDirectory=./$WORKSPACE_PATH/coverage/"
},
"dependencies": {
"@algolia/client-common": "4.22.1",
Expand Down
3 changes: 2 additions & 1 deletion packages/auth-frontend-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"scripts": {
"build:babel": "../../scripts/build-babel.sh build",
"watch:babel": "../../scripts/build-babel.sh watch",
"test": "WORKSPACE_PATH=packages/auth-frontend-scripts yarn workspace asap-hub test:workspace"
"test": "WORKSPACE_PATH=packages/auth-frontend-scripts yarn workspace asap-hub test:workspace",
"test:coverage": "WORKSPACE_PATH=packages/auth-frontend-scripts; yarn workspace asap-hub test:workspace --coverage --coverageDirectory=./$WORKSPACE_PATH/coverage/"
},
"dependencies": {
"@babel/runtime-corejs3": "7.23.8",
Expand Down
3 changes: 2 additions & 1 deletion packages/auth-frontend-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"scripts": {
"build:babel": "../../scripts/build-babel.sh build",
"watch:babel": "../../scripts/build-babel.sh watch",
"test": "WORKSPACE_PATH=packages/auth-frontend-utils yarn workspace asap-hub test:workspace"
"test": "WORKSPACE_PATH=packages/auth-frontend-utils yarn workspace asap-hub test:workspace",
"test:coverage": "WORKSPACE_PATH=packages/auth-frontend-utils; yarn workspace asap-hub test:workspace --coverage --coverageDirectory=./$WORKSPACE_PATH/coverage/"
},
"dependencies": {
"@babel/runtime-corejs3": "7.23.8",
Expand Down
3 changes: 2 additions & 1 deletion packages/contentful/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"space:remove-webhook": "ts-node ./scripts/remove-webhook.ts",
"schema:update:crn": "APP=crn graphql-codegen --config codegen.yml && yarn run prettier --write ./src/crn/autogenerated-gql/*",
"schema:update:gp2": "APP=gp2 graphql-codegen --config codegen.yml && yarn run prettier --write ./src/gp2/autogenerated-gql/*",
"test": "WORKSPACE_PATH=packages/contentful yarn workspace asap-hub test:workspace"
"test": "WORKSPACE_PATH=packages/contentful yarn workspace asap-hub test:workspace",
"test:coverage": "WORKSPACE_PATH=packages/contentful; yarn workspace asap-hub test:workspace --coverage --coverageDirectory=./$WORKSPACE_PATH/coverage/"
},
"dependencies": {
"@asap-hub/errors": "workspace:*",
Expand Down
3 changes: 2 additions & 1 deletion packages/flags/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"scripts": {
"build:babel": "../../scripts/build-babel.sh build",
"watch:babel": "../../scripts/build-babel.sh watch",
"test": "WORKSPACE_PATH=packages/flags yarn workspace asap-hub test:workspace"
"test": "WORKSPACE_PATH=packages/flags yarn workspace asap-hub test:workspace",
"test:coverage": "WORKSPACE_PATH=packages/flags; yarn workspace asap-hub test:workspace --coverage --coverageDirectory=./$WORKSPACE_PATH/coverage/"
},
"dependencies": {
"@babel/runtime-corejs3": "7.23.8",
Expand Down
3 changes: 2 additions & 1 deletion packages/frontend-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"scripts": {
"build:babel": "../../scripts/build-babel.sh build",
"watch:babel": "../../scripts/build-babel.sh watch",
"test": "WORKSPACE_PATH=packages/frontend-utils yarn workspace asap-hub test:workspace"
"test": "WORKSPACE_PATH=packages/frontend-utils yarn workspace asap-hub test:workspace",
"test:coverage": "WORKSPACE_PATH=packages/frontend-utils; yarn workspace asap-hub test:workspace --coverage --coverageDirectory=./$WORKSPACE_PATH/coverage/"
},
"peerDependencies": {
"@asap-hub/model": "workspace:*",
Expand Down
3 changes: 2 additions & 1 deletion packages/gp2-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"scripts": {
"build:babel": "../../scripts/build-babel.sh build",
"watch:babel": "../../scripts/build-babel.sh watch",
"test": "WORKSPACE_PATH=packages/gp2-components yarn workspace asap-hub test:workspace"
"test": "WORKSPACE_PATH=packages/gp2-components yarn workspace asap-hub test:workspace",
"test:coverage": "WORKSPACE_PATH=packages/gp2-components; yarn workspace asap-hub test:workspace --coverage --coverageDirectory=./$WORKSPACE_PATH/coverage/"
},
"peerDependencies": {
"@asap-hub/react-context": "workspace:*",
Expand Down
3 changes: 2 additions & 1 deletion packages/model/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"scripts": {
"build:babel": "../../scripts/build-babel.sh build",
"watch:babel": "../../scripts/build-babel.sh watch",
"test": "WORKSPACE_PATH=packages/model yarn workspace asap-hub test:workspace"
"test": "WORKSPACE_PATH=packages/model yarn workspace asap-hub test:workspace",
"test:coverage": "WORKSPACE_PATH=packages/model; yarn workspace asap-hub test:workspace --coverage --coverageDirectory=./$WORKSPACE_PATH/coverage/"
},
"dependencies": {
"@babel/runtime-corejs3": "7.23.8",
Expand Down
3 changes: 2 additions & 1 deletion packages/react-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"scripts": {
"build:babel": "../../scripts/build-babel.sh build",
"watch:babel": "../../scripts/build-babel.sh watch",
"test": "WORKSPACE_PATH=packages/react-components yarn workspace asap-hub test:workspace"
"test": "WORKSPACE_PATH=packages/react-components yarn workspace asap-hub test:workspace",
"test:coverage": "WORKSPACE_PATH=packages/react-components; yarn workspace asap-hub test:workspace --coverage --coverageDirectory=./$WORKSPACE_PATH/coverage/"
},
"peerDependencies": {
"@asap-hub/react-context": "*",
Expand Down
3 changes: 2 additions & 1 deletion packages/react-context/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"scripts": {
"build:babel": "../../scripts/build-babel.sh build",
"watch:babel": "../../scripts/build-babel.sh watch",
"test": "WORKSPACE_PATH=packages/react-context yarn workspace asap-hub test:workspace"
"test": "WORKSPACE_PATH=packages/react-context yarn workspace asap-hub test:workspace",
"test:coverage": "WORKSPACE_PATH=packages/react-context; yarn workspace asap-hub test:workspace --coverage --coverageDirectory=./$WORKSPACE_PATH/coverage/"
},
"peerDependencies": {
"react": "^17.0.2"
Expand Down
3 changes: 2 additions & 1 deletion packages/server-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"scripts": {
"build:babel": "../../scripts/build-babel.sh build",
"watch:babel": "../../scripts/build-babel.sh watch",
"test": "WORKSPACE_PATH=packages/server-common yarn workspace asap-hub test:workspace"
"test": "WORKSPACE_PATH=packages/server-common yarn workspace asap-hub test:workspace",
"test:coverage": "WORKSPACE_PATH=packages/server-common; yarn workspace asap-hub test:workspace --coverage --coverageDirectory=./$WORKSPACE_PATH/coverage/"
},
"dependencies": {
"@asap-hub/algolia": "workspace:*",
Expand Down
3 changes: 2 additions & 1 deletion packages/services-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"scripts": {
"build:babel": "../../scripts/build-babel.sh build",
"watch:babel": "../../scripts/build-babel.sh watch",
"test": "WORKSPACE_PATH=packages/services-common yarn workspace asap-hub test:workspace"
"test": "WORKSPACE_PATH=packages/services-common yarn workspace asap-hub test:workspace",
"test:coverage": "WORKSPACE_PATH=packages/services-common; yarn workspace asap-hub test:workspace --coverage --coverageDirectory=./$WORKSPACE_PATH/coverage/"
},
"dependencies": {
"@asap-hub/errors": "workspace:*",
Expand Down
3 changes: 2 additions & 1 deletion packages/validation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"scripts": {
"build:babel": "../../scripts/build-babel.sh build",
"watch:babel": "../../scripts/build-babel.sh watch",
"test": "WORKSPACE_PATH=packages/validation yarn workspace asap-hub test:workspace"
"test": "WORKSPACE_PATH=packages/validation yarn workspace asap-hub test:workspace",
"test:coverage": "WORKSPACE_PATH=packages/validation; yarn workspace asap-hub test:workspace --coverage --coverageDirectory=./$WORKSPACE_PATH/coverage/"
},
"dependencies": {
"@asap-hub/auth": "workspace:*",
Expand Down
3 changes: 3 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
"outputs": ["build/**/*", "dist/**/*", "build-templates/**/*"]
},
"test": {
"dependsOn": ["^build:babel"]
},
"test:coverage": {
"dependsOn": ["^build:babel"],
"outputs": ["coverage/**/*"]
}
Expand Down

0 comments on commit 9e5e9a0

Please sign in to comment.