Suites e2e #51
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
name: Automock E2E | |
on: | |
workflow_dispatch: | |
inputs: | |
target_branch: | |
description: 'E2E Target Branch' | |
required: true | |
jobs: | |
build: | |
name: Build, Prepare and Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
e2e-project: ['e2e/jest/nestjs', 'e2e/sinon/nestjs'] | |
node-version: [14.x, 16.x, 18.x, 20.x] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.inputs.target_branch }} | |
- name: Use Node ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- uses: actions/cache@v2 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | |
- name: Yarn | |
run: yarn --frozen-lockfile | |
- name: Build | |
run: yarn build | |
- name: Pack | |
run: lerna exec -- npm pack | |
- name: Move Tarballs | |
run: | | |
mkdir -p $PWD/e2e/tarballs | |
lerna exec -- mv "*.tgz" $PWD/e2e/tarballs | |
- name: Extract & Copy Tarballs | |
run: | | |
for file in $PWD/e2e/tarballs/automock-*.tgz; do | |
[[ $file =~ automock-(.+)-[0-9]+\.[0-9]+\.[0-9]+(-dev\.[0-9]+)?\.tgz ]] | |
new_name="${BASH_REMATCH[1]}.tgz" | |
mv "$file" $PWD/e2e/tarballs/$new_name | |
done | |
cp -r "$PWD/e2e/tarballs" "$PWD/e2e/jest/nestjs" | |
cp -r "$PWD/e2e/tarballs" "$PWD/e2e/sinon/nestjs" | |
rm -rf "$PWD/e2e/sinon/nestjs/tarballs/jest.tgz" | |
rm -rf "$PWD/e2e/jest/nestjs/tarballs/sinon.tgz" | |
- name: Install Packages in E2E | |
run: npm install --no-package-lock --no-cache | |
working-directory: ${{ matrix.e2e-project }} | |
- name: Test e2e | |
run: npm run test | |
working-directory: ${{ matrix.e2e-project }} |