1fb6b778e7
* Update pnpm to v11 * Handle breaking changes * Attach pnpm hash * Remove redundant packageManager fields * Make lint-staged happy * Lockfile pnpm itself too * Update pnpm/action-setup for better v11 compatibility * Specify types to make tsc happier * Fix permissions * Check ulimit * Specify minimumReleaseAgeExclude * Run desktop tests * Revert "Run desktop tests" This reverts commit 911eb0ba2e9237d4b28e3bdaaf8f10ba6f22e827. * Revert "Check ulimit" This reverts commit f09eb59d715ba30a2e7fc5dba17dde092bd9bf17. * Reapply "Check ulimit" This reverts commit 83227c19ff5d07db91b6586f407f56870b00c041. * Run desktop tests * Switch nodeLinker & remove app-builder-lib patch * Fix webpack.config.ts * Fix .stylelintrc.cjs * Fix `events` package * Makes types happier * Make knip happy * Fix hak build * Make jest happy * Make pnpm-link happy * Remove dead file * Run playwright tests * Fix linux hak permissions in ci * Test * Remove ulimit checks * Disable skip * Update nx * Tweak line endings * Update screenshot * Iterate * Webpack fallback `events` --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
121 lines
5.0 KiB
YAML
121 lines
5.0 KiB
YAML
# This action helps run Playwright tests within one of the build_* stages.
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
runs-on:
|
|
type: string
|
|
required: true
|
|
description: "The runner image to use"
|
|
artifact:
|
|
type: string
|
|
required: true
|
|
description: "The name of the artifact to download"
|
|
project:
|
|
type: string
|
|
required: true
|
|
description: "The Playwright project to use for testing"
|
|
executable:
|
|
type: string
|
|
required: true
|
|
description: "Path to the executable to test"
|
|
prepare_cmd:
|
|
type: string
|
|
required: false
|
|
description: "Command to run to prepare the executable or environment for testing"
|
|
blob_report:
|
|
type: boolean
|
|
default: false
|
|
description: "Whether to upload a blob report instead of the HTML report"
|
|
args:
|
|
type: string
|
|
required: false
|
|
description: "Additional arguments to pass to playwright, for e.g. skipping specific tests"
|
|
permissions: {}
|
|
jobs:
|
|
test:
|
|
name: Test ${{ inputs.project }}
|
|
runs-on: ${{ inputs.runs-on }}
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
with:
|
|
repository: element-hq/element-web
|
|
persist-credentials: false
|
|
|
|
- uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
|
|
id: pnpm
|
|
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
|
with:
|
|
node-version-file: apps/desktop/.node-version
|
|
cache: "pnpm"
|
|
|
|
- name: Install Deps
|
|
run: "pnpm install --frozen-lockfile --filter element-desktop"
|
|
|
|
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
|
with:
|
|
name: ${{ inputs.artifact }}
|
|
path: apps/desktop/dist
|
|
|
|
- name: Prepare for tests
|
|
working-directory: apps/desktop
|
|
# This is set by the caller of the reusable workflow, they have the ability to run the command they specify
|
|
# directly without our help so this is fine.
|
|
run: ${{ inputs.prepare_cmd }} # zizmor: ignore[template-injection]
|
|
if: inputs.prepare_cmd
|
|
|
|
- name: Expand executable path
|
|
id: executable
|
|
working-directory: apps/desktop
|
|
shell: bash
|
|
env:
|
|
EXECUTABLE: ${{ inputs.executable }}
|
|
run: |
|
|
FILES=($EXECUTABLE)
|
|
echo "path=${FILES[0]}" >> $GITHUB_OUTPUT
|
|
|
|
# We previously disabled the `EnableNodeCliInspectArguments` fuse, but Playwright requires
|
|
# it to be enabled to test Electron apps, so turn it back on.
|
|
- name: Set EnableNodeCliInspectArguments fuse enabled
|
|
run: $RUN_AS $PNPM_PATH/pnpm exec electron-fuses write --app "$EXECUTABLE" EnableNodeCliInspectArguments=on
|
|
working-directory: apps/desktop
|
|
shell: bash
|
|
env:
|
|
# We need sudo on Linux as it is installed in /opt/
|
|
RUN_AS: ${{ runner.os == 'Linux' && 'sudo' || '' }}
|
|
PNPM_PATH: ${{ steps.pnpm.outputs.bin_dest }}
|
|
EXECUTABLE: ${{ steps.executable.outputs.path }}
|
|
|
|
- name: Run tests
|
|
timeout-minutes: 20
|
|
shell: bash
|
|
working-directory: apps/desktop
|
|
run: |
|
|
$PREFIX pnpm playwright test \
|
|
${{ runner.os != 'Linux' && '--ignore-snapshots' || '' }} \
|
|
${{ inputs.blob_report == false && '--reporter=html' || '' }} \
|
|
$ARGS
|
|
env:
|
|
PREFIX: ${{ runner.os == 'Linux' && 'xvfb-run' || '' }}
|
|
PW_TAG: ${{ inputs.project }}
|
|
ELEMENT_DESKTOP_EXECUTABLE: ${{ steps.executable.outputs.path }}
|
|
ARGS: ${{ inputs.args }}
|
|
DEBUG: pw:browser
|
|
|
|
- name: Upload blob report
|
|
if: always() && inputs.blob_report
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
with:
|
|
name: blob-report-${{ inputs.artifact }}
|
|
path: apps/desktop/blob-report
|
|
retention-days: 1
|
|
if-no-files-found: error
|
|
|
|
- name: Upload HTML report
|
|
if: always() && inputs.blob_report == false
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
with:
|
|
name: ${{ inputs.artifact }}-test
|
|
path: apps/desktop/playwright-report
|
|
retention-days: 14
|
|
if-no-files-found: error
|