|
23 | 23 | type: string |
24 | 24 | required: false |
25 | 25 | default: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || !!startsWith(github.ref, 'refs/heads/release-') }} |
| 26 | + playwright_enable: |
| 27 | + description: "Global enable for playwright" |
| 28 | + type: boolean |
| 29 | + required: false |
| 30 | + default: false |
| 31 | + playwright_run_because_flag: |
| 32 | + description: "Local flag to run playwright. Will only work if playwright_enable: true." |
| 33 | + type: boolean |
| 34 | + required: false |
| 35 | + default: false |
| 36 | + playwright_run_because_branch: |
| 37 | + description: "Branch names to run playwright on. Will only work if playwright_enable: true." |
| 38 | + # TODO: actionlint is failing as it expects true/false as default value for boolean types |
| 39 | + type: string |
| 40 | + required: false |
| 41 | + default: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || !!startsWith(github.ref, 'refs/heads/release-') }} |
26 | 42 | node_run_webpack: |
27 | 43 | description: "Flag to always run the webpack production build." |
28 | 44 | type: boolean |
|
36 | 52 | type: string |
37 | 53 | required: false |
38 | 54 | default: "ubuntu-22.04-large" |
| 55 | + playwright_runs_on: |
| 56 | + type: string |
| 57 | + required: false |
| 58 | + default: "ubuntu-22.04-large" |
39 | 59 | secrets: |
40 | 60 | DATAVISYN_BOT_REPO_TOKEN: |
41 | 61 | required: false |
@@ -63,7 +83,7 @@ permissions: |
63 | 83 | jobs: |
64 | 84 | build-node: |
65 | 85 | name: Node |
66 | | - if: ${{ !inputs.cypress_enable || (!inputs.cypress_run_because_flag && inputs.cypress_run_because_branch != 'true') }} |
| 86 | + 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')) }} |
67 | 87 | concurrency: |
68 | 88 | group: "node-${{ github.workflow }}-${{ github.ref || github.head_ref }}-${{ inputs.branch }}" |
69 | 89 | cancel-in-progress: true |
|
93 | 113 |
|
94 | 114 | build-python: |
95 | 115 | name: Python |
96 | | - if: ${{ !inputs.cypress_enable || (!inputs.cypress_run_because_flag && inputs.cypress_run_because_branch != 'true') }} |
| 116 | + 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')) }} |
97 | 117 | concurrency: |
98 | 118 | group: "python-${{ github.workflow }}-${{ github.ref || github.head_ref }}-${{ inputs.branch }}" |
99 | 119 | cancel-in-progress: true |
@@ -211,3 +231,82 @@ jobs: |
211 | 231 | # with: |
212 | 232 | # name: cypress-videos |
213 | 233 | # path: cypress/videos |
| 234 | + |
| 235 | + # If playwright is used, build node and python sequentially as it is avoiding the duplicate install overhead |
| 236 | + build-node-python-playwright: |
| 237 | + name: Node, Python, Playwright |
| 238 | + if: ${{ inputs.playwright_enable && (inputs.playwright_run_because_flag || inputs.playwright_run_because_branch == 'true') }} |
| 239 | + concurrency: |
| 240 | + group: "node-python-playwright-${{ github.workflow }}-${{ github.ref || github.head_ref }}-${{ inputs.branch }}" |
| 241 | + cancel-in-progress: true |
| 242 | + permissions: |
| 243 | + id-token: write |
| 244 | + contents: write |
| 245 | + runs-on: ${{ inputs.playwright_runs_on || inputs.runs_on }} |
| 246 | + |
| 247 | + services: |
| 248 | + postgres: |
| 249 | + image: postgres:14 |
| 250 | + env: |
| 251 | + POSTGRES_USER: admin |
| 252 | + POSTGRES_PASSWORD: admin |
| 253 | + POSTGRES_DB: db |
| 254 | + options: >- |
| 255 | + --health-cmd pg_isready |
| 256 | + --health-interval 10s |
| 257 | + --health-timeout 5s |
| 258 | + --health-retries 5 |
| 259 | + ports: |
| 260 | + - 5432:5432 |
| 261 | + |
| 262 | + steps: |
| 263 | + - name: Checkout source repository |
| 264 | + uses: actions/checkout@v3 |
| 265 | + with: |
| 266 | + ref: ${{ inputs.branch }} |
| 267 | + token: ${{ github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }} |
| 268 | + - name: Checkout github-workflows |
| 269 | + uses: actions/checkout@v3 |
| 270 | + with: |
| 271 | + repository: datavisyn/github-workflows |
| 272 | + ref: ${{ env.WORKFLOW_BRANCH }} |
| 273 | + path: ./tmp/github-workflows |
| 274 | + - name: Build node |
| 275 | + uses: ./tmp/github-workflows/.github/actions/build-node |
| 276 | + with: |
| 277 | + node_version: ${{ secrets.NODE_VERSION || env.NODE_VERSION }} |
| 278 | + npm_registry: ${{ env.NPM_REGISTRY }} |
| 279 | + github_ro_token: ${{ github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }} |
| 280 | + 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 |
| 281 | + - name: Build python |
| 282 | + uses: ./tmp/github-workflows/.github/actions/build-python |
| 283 | + with: |
| 284 | + python_version: ${{ secrets.PYTHON_VERSION || env.PYTHON_VERSION }} |
| 285 | + github_ro_token: ${{ github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }} |
| 286 | + - name: Decrypt .env.enc and <app>/.env.enc |
| 287 | + run: | |
| 288 | + yarn run env:decrypt -pass env:ENV_PASSWORD || true |
| 289 | + make env_decrypt || true |
| 290 | + env: |
| 291 | + ENV_PASSWORD: ${{ secrets.ENV_PASSWORD }} |
| 292 | + - name: Webpack build |
| 293 | + run: npm run webpack:prod |
| 294 | + shell: bash |
| 295 | + - name: Install playwright browsers |
| 296 | + run: yarn playwright install --with-deps |
| 297 | + shell: bash |
| 298 | + - name: Run playwright e2e tests |
| 299 | + run: yarn run pw:run |
| 300 | + shell: bash |
| 301 | + - name: Upload playwright report |
| 302 | + uses: actions/upload-artifact@v3 |
| 303 | + if: always() |
| 304 | + with: |
| 305 | + name: playwright-report |
| 306 | + path: playwright-report/ |
| 307 | + # - name: Upload cypress videos |
| 308 | + # uses: actions/upload-artifact@v3 |
| 309 | + # if: always() |
| 310 | + # with: |
| 311 | + # name: cypress-videos |
| 312 | + # path: cypress/videos |
0 commit comments