Merge pull request #153 from RahulARanger/name-description-hooks #103
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: 'test-build' | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- build | |
paths: | |
- "handshake-nodejs-reporters/**" | |
- "handshake/**" | |
- ".github/**" | |
- "__test__/**" | |
- "noxfile.py" | |
- "**test-build.yml" | |
- "poetry.toml" | |
- "pyproject.toml" | |
- "poetry.lock" | |
jobs: | |
decide: | |
# TODO: skip decide job if manually triggered | |
runs-on: ubuntu-latest | |
outputs: | |
# dashboard: ${{ steps.filter.outputs.dashboard }} | |
py: ${{ steps.filter.outputs.py }} | |
# common_nodejs_reporters: ${{ steps.filter.outputs.common_nodejs_reporters }} | |
# wdio_reporter: ${{ steps.filter.outputs.wdio_reporter }} | |
name: decides which job to run based on the file changes | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
dashboard: | |
- 'handshake-nodejs-reporters/packages/handshake-dashboard/**' | |
py: | |
- 'handshake/**' | |
- "poetry.toml" | |
- "pyproject.toml" | |
- "poetry.lock" | |
common_nodejs_reporters: | |
- 'handshake-nodejs-reporters/packages/common-handshakes/**' | |
wdio_reporter: | |
- 'handshake-nodejs-reporters/apps/test-wdio-*' | |
- 'handshake-nodejs-reporters/packages/wdio-handshake-reporter/**' | |
test-dashboard: | |
needs: decide | |
name: testing the dashboard build | |
runs-on: 'ubuntu-latest' | |
if: ${{ needs.decide.outputs.dashboard == 'true' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
version: 8 | |
run_install: false | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.9.0 | |
cache: 'pnpm' | |
cache-dependency-path: handshake-nodejs-reporters/pnpm-lock.yaml | |
- name: Installing node packages | |
working-directory: ./handshake-nodejs-reporters/packages/handshake-dashboard | |
run: pnpm install && pnpm install @swc/cli @swc/core wait-on concurrently http-server playwright && npx playwright install --with-deps | |
- name: Building storybook | |
working-directory: ./handshake-nodejs-reporters/packages/handshake-dashboard | |
run: pnpm build-storybook --quiet | |
- name: Conducting Component Tests | |
working-directory: ./handshake-nodejs-reporters/packages/handshake-dashboard | |
run: npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \ | |
"npx http-server storybook-static --port 6006 --silent" \ | |
"npx wait-on tcp:6006 && pnpm test" | |
- name: Building Dashboard | |
working-directory: ./handshake-nodejs-reporters/packages/handshake-dashboard | |
run: pnpm build | |
test-handshakes: | |
needs: decide | |
name: check if the py-build for handshake is stable | |
runs-on: ${{ matrix.os }} | |
if: ${{ needs.decide.outputs.py == 'true' }} | |
strategy: | |
matrix: | |
os: ['macos-latest', 'windows-latest', 'ubuntu-latest'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: If in ubuntu, Install sqlite3 3.45.0 | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
bash ./.github/scripts/build-sqlite.sh | |
- name: if not Windows, Set up Python 3.11 & 3.12 | |
if: ${{ matrix.os != 'windows-latest' }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: | | |
3.11 | |
3.12 | |
- name: if Windows, Set up Python 3.11 | |
if: ${{ matrix.os == 'windows-latest' }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Set up venv | |
run: | | |
python -m venv venv | |
- name: Activate venv for non-Windows System | |
if: ${{ matrix.os != 'windows-latest' }} | |
run: | | |
source ./venv/bin/activate | |
- name: Activate venv if Windows System | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: ./venv/scripts/activate | |
# for macOS, we install deps but not extra ones | |
- name: Install dependencies without optional dependencies | |
if: ${{ matrix.os == 'macos-latest' }} | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry nox | |
poetry install | |
# for windows and linux, we install deps with all extras | |
- name: Install dependencies with optional dependencies | |
if: ${{ matrix.os != 'macos-latest' }} | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry nox | |
poetry install --all-extras | |
# for macOS, we conduct tests which doesn't depend on optional dependencies | |
# for linux, we conduct tests including the ones that depend on optional dependencies | |
# and run those on both 3.12 and 3.11 | |
- name: Regression Test without optional dependencies | |
if: ${{ matrix.os != 'windows-latest' }} | |
run: nox -s test | |
# for windows, we conduct tests including the ones that depend on optional dependencies but run it only on 3.11 | |
- name: Regression Test with optional dependencies | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: pytest __test__ | |
test-common-nodejs-reporters: | |
needs: [decide, test-dashboard, test-handshakes] | |
name: test the common-nodejs-reporters build | |
runs-on: "windows-latest" | |
if: ${{ !failure() && ( needs.decide.outputs.common_nodejs_reporters == 'true' || needs.decide.outputs.wdio_reporter == 'true' ) }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
version: 8 | |
run_install: false | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.9.0 | |
cache: 'pnpm' | |
cache-dependency-path: handshake-nodejs-reporters/pnpm-lock.yaml | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: | | |
3.11 | |
- name: Set up venv | |
run: | | |
python -m venv venv | |
- name: Install dependencies | |
# please note, nox is not installed, here. | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry | |
poetry install | |
- name: Activate venv | |
run: ./venv/scripts/activate | |
- name: Setup Turbo Repo. | |
working-directory: ./handshake-nodejs-reporters | |
run: | |
pnpm install | |
- name: Building files | |
working-directory: ./handshake-nodejs-reporters | |
run: pnpm build | |
- name: conduct tests | |
working-directory: ./handshake-nodejs-reporters/packages/common-handshakes | |
if: ${{ needs.decide.outputs.common_nodejs_reporters == 'true' }} | |
# NOTE: common-handshakes tests alone can be triggered if required | |
run: npm run test | |
- name: conduct e2e tests | |
working-directory: ./handshake-nodejs-reporters | |
if: ${{ needs.decide.outputs.wdio_reporter == 'true' }} | |
continue-on-error: true | |
run: pnpm run test-wdio |