Skip to content

Commit

Permalink
Merge pull request #29 from datavisyn/new_deployment_playwright
Browse files Browse the repository at this point in the history
feat: Add playwright option next to cypress option
  • Loading branch information
puehringer authored Nov 1, 2023
2 parents 3ec02ba + 1a21515 commit 4a5e7dd
Showing 1 changed file with 95 additions and 2 deletions.
97 changes: 95 additions & 2 deletions .github/workflows/build-node-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,22 @@ on:
type: string
required: false
default: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || !!startsWith(github.ref, 'refs/heads/release-') }}
playwright_enable:
description: "Global enable for playwright"
type: boolean
required: false
default: false
playwright_run_because_flag:
description: "Local flag to run playwright. Will only work if playwright_enable: true."
type: boolean
required: false
default: false
playwright_run_because_branch:
description: "Branch names to run playwright on. Will only work if playwright_enable: true."
# TODO: actionlint is failing as it expects true/false as default value for boolean types
type: string
required: false
default: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || !!startsWith(github.ref, 'refs/heads/release-') }}
node_run_webpack:
description: "Flag to always run the webpack production build."
type: boolean
Expand All @@ -36,6 +52,10 @@ on:
type: string
required: false
default: "ubuntu-22.04-large"
playwright_runs_on:
type: string
required: false
default: "ubuntu-22.04-large"
secrets:
DATAVISYN_BOT_REPO_TOKEN:
required: false
Expand Down Expand Up @@ -63,7 +83,7 @@ permissions:
jobs:
build-node:
name: Node
if: ${{ !inputs.cypress_enable || (!inputs.cypress_run_because_flag && inputs.cypress_run_because_branch != 'true') }}
if: ${{ (!inputs.cypress_enable || (!inputs.cypress_run_because_flag && inputs.cypress_run_because_branch != 'true')) && (!inputs.playwright_enable || (!inputs.playwright_run_because_flag && inputs.playwright_run_because_branch != 'true')) }}
concurrency:
group: "node-${{ github.workflow }}-${{ github.ref || github.head_ref }}-${{ inputs.branch }}"
cancel-in-progress: true
Expand Down Expand Up @@ -93,7 +113,7 @@ jobs:

build-python:
name: Python
if: ${{ !inputs.cypress_enable || (!inputs.cypress_run_because_flag && inputs.cypress_run_because_branch != 'true') }}
if: ${{ (!inputs.cypress_enable || (!inputs.cypress_run_because_flag && inputs.cypress_run_because_branch != 'true')) && (!inputs.playwright_enable || (!inputs.playwright_run_because_flag && inputs.playwright_run_because_branch != 'true')) }}
concurrency:
group: "python-${{ github.workflow }}-${{ github.ref || github.head_ref }}-${{ inputs.branch }}"
cancel-in-progress: true
Expand Down Expand Up @@ -211,3 +231,76 @@ jobs:
# with:
# name: cypress-videos
# path: cypress/videos

# If playwright is used, build node and python sequentially as it is avoiding the duplicate install overhead
build-node-python-playwright:
name: Node, Python, Playwright
if: ${{ inputs.playwright_enable && (inputs.playwright_run_because_flag || inputs.playwright_run_because_branch == 'true') }}
concurrency:
group: "node-python-playwright-${{ github.workflow }}-${{ github.ref || github.head_ref }}-${{ inputs.branch }}"
cancel-in-progress: true
permissions:
id-token: write
contents: write
runs-on: ${{ inputs.playwright_runs_on || inputs.runs_on }}

services:
postgres:
image: postgres:14
env:
POSTGRES_USER: admin
POSTGRES_PASSWORD: admin
POSTGRES_DB: db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- name: Checkout source repository
uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}
token: ${{ github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }}
- name: Checkout github-workflows
uses: actions/checkout@v3
with:
repository: datavisyn/github-workflows
ref: ${{ env.WORKFLOW_BRANCH }}
path: ./tmp/github-workflows
- name: Build node
uses: ./tmp/github-workflows/.github/actions/build-node
with:
node_version: ${{ secrets.NODE_VERSION || env.NODE_VERSION }}
npm_registry: ${{ env.NPM_REGISTRY }}
github_ro_token: ${{ github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }}
run_webpack: false # Disable the build here and call afterwards, as otherwise the yarn run env:decrypt will fail due to a missing yarn install
- name: Build python
uses: ./tmp/github-workflows/.github/actions/build-python
with:
python_version: ${{ secrets.PYTHON_VERSION || env.PYTHON_VERSION }}
github_ro_token: ${{ github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }}
- name: Decrypt .env.enc and <app>/.env.enc
run: |
yarn run env:decrypt -pass env:ENV_PASSWORD || true
make env_decrypt || true
env:
ENV_PASSWORD: ${{ secrets.ENV_PASSWORD }}
- name: Webpack build
run: npm run webpack:prod
shell: bash
- name: Install playwright browsers
run: yarn playwright install --with-deps chromium
shell: bash
- name: Run playwright e2e tests
run: yarn run pw:run
shell: bash
- name: Upload playwright report
uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/

0 comments on commit 4a5e7dd

Please sign in to comment.