-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add on push branch workflow for testing
- Loading branch information
1 parent
304ec82
commit 64b760c
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// import execSync | ||
const { execSync } = require('child_process'); | ||
|
||
// run turborepo dry run to get the list of tasks | ||
const { tasks } = JSON.parse( | ||
execSync( | ||
'yarn turbo test --only --filter="!@asap-hub/contentful-app-*" --dry-run=json', | ||
).toString(), | ||
); | ||
|
||
// create a matrix of tasks | ||
const taskList = tasks | ||
.filter((task) => task.command !== '<NONEXISTENT>') | ||
.map(({ package }) => ({ package })); | ||
|
||
// print the matrix, stringify the json | ||
console.log(`${JSON.stringify({ include: taskList })}`); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Pipeline branch - test turborepo | ||
|
||
on: | ||
push: | ||
branches: | ||
- feat/asap-285-use-turbo-for-tests | ||
|
||
jobs: | ||
setup-turbo: | ||
runs-on: ubuntu-latest | ||
environment: Branch | ||
outputs: | ||
matrix: ${{ steps.setup.outputs.matrix }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Re-Build | ||
uses: ./.github/actions/build-rebuild | ||
- name: Setup turborepo test pipeline | ||
id: setup | ||
run: | | ||
MATRIX=$(yarn node ./.github/scripts/manage-workflows/create-test-matrix.js) | ||
echo $MATRIX | ||
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT | ||
test-turbo: | ||
needs: setup-turbo | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: ${{ fromJson(needs.setup-turbo.outputs.matrix) }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Re-Build | ||
uses: ./.github/actions/build-rebuild | ||
- name: Cache .turbo | ||
uses: actions/cache@v3 | ||
with: | ||
path: .turbo | ||
key: ${{ runner.os }}-turbo-${{ matrix.package }} | ||
- name: Test ${{ matrix.package }} | ||
run: yarn turbo test --filter="${{ matrix.package }}" --cache-dir=.turbo --only |