sekur-chat/.github/workflows/build_and_test.yaml
Michael Telatynski b52bd45a5d
Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2025-02-17 21:03:17 +00:00

168 lines
7.5 KiB
YAML

name: Build and Test
on:
pull_request: {}
push:
branches: [develop, staging, master]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: {} # No permissions required
jobs:
fetch:
uses: ./.github/workflows/build_prepare.yaml
permissions:
contents: read
with:
config: ${{ github.event.pull_request.base.ref == 'develop' && 'element.io/nightly' || 'element.io/release' }}
version: ${{ github.event.pull_request.base.ref == 'develop' && 'develop' || '' }}
windows:
needs: fetch
name: Windows
uses: ./.github/workflows/build_windows.yaml
strategy:
matrix:
arch: [x64, ia32]
with:
arch: ${{ matrix.arch }}
linux:
needs: fetch
name: "Linux (${{ matrix.arch }}) (sqlcipher: ${{ matrix.sqlcipher }})"
uses: ./.github/workflows/build_linux.yaml
strategy:
matrix:
sqlcipher: [system, static]
arch: [amd64, arm64]
with:
config: ${{ github.event.pull_request.base.ref == 'develop' && 'element.io/nightly' || 'element.io/release' }}
sqlcipher: ${{ matrix.sqlcipher }}
arch: ${{ matrix.arch }}
macos:
needs: fetch
name: macOS
uses: ./.github/workflows/build_macos.yaml
test:
needs:
- macos
- linux
- windows
strategy:
fail-fast: false
matrix:
include:
- name: macOS Universal
os: macos-14
artifact: macos
executable: "/Users/runner/Applications/Element.app/Contents/MacOS/Element"
# We need to mount the DMG and copy the app to the Applications folder as a mounted DMG is
# read-only and thus would not allow us to override the fuses as is required for Playwright.
prepare_cmd: |
hdiutil attach ./dist/*.dmg -mountpoint /Volumes/Element &&
rsync -a /Volumes/Element/Element.app ~/Applications/ &&
hdiutil detach /Volumes/Element
- name: "Linux (amd64) (sqlcipher: system)"
os: ubuntu-22.04
artifact: linux-amd64-sqlcipher-system
executable: "/opt/Element/element-desktop"
prepare_cmd: "sudo apt-get -qq update && sudo apt install ./dist/*.deb"
- name: "Linux (amd64) (sqlcipher: static)"
os: ubuntu-22.04
artifact: linux-amd64-sqlcipher-static
executable: "/opt/Element/element-desktop"
prepare_cmd: "sudo apt-get -qq update && sudo apt install ./dist/*.deb"
- name: "Linux (arm64) (sqlcipher: system)"
os: ubuntu-22.04-arm
artifact: linux-arm64-sqlcipher-system
executable: "/opt/Element/element-desktop"
prepare_cmd: "sudo apt-get -qq update && sudo apt install -y ./dist/*.deb"
- name: "Linux (arm64) (sqlcipher: static)"
os: ubuntu-22.04-arm
artifact: linux-arm64-sqlcipher-static
executable: "/opt/Element/element-desktop"
prepare_cmd: "sudo apt-get -qq update && sudo apt install -y ./dist/*.deb"
- name: Windows (x86) Squirrel
os: windows-2022
artifact: win-ia32
executable: "$LOCALAPPDATA/element-desktop/app-1.11.91/Element.exe"
prepare_cmd: |
. "./dist/squirrel-windows*/Element Setup*.exe"
Start-Sleep -Seconds 60
- name: Windows (x86) MSI
os: windows-2022
artifact: win-ia32
# We avoid installing to Program Files as then we lack privileges to modify fuses for Playwright testing
executable: "$RUNNER_TEMP/Element/Element.exe"
prepare_cmd: |
$file = Get-Item ./dist/*.msi | Select -First 1 -ExpandProperty FullName
Start-Process $file -ArgumentList "/quiet APPLICATIONFOLDER=$env:RUNNER_TEMP/Element" -Wait
- name: Windows (x64) Squirrel
os: windows-2022
artifact: win-x64
executable: "$LOCALAPPDATA/element-desktop/app-1.11.91/Element.exe"
prepare_cmd: |
. "./dist/squirrel-windows*/Element Setup*.exe"
Start-Sleep -Seconds 60
ls $env:LOCALAPPDATA
ls $env:LOCALAPPDATA/element-desktop
- name: Windows (x64) MSI
os: windows-2022
artifact: win-x64
# We avoid installing to Program Files as then we lack privileges to modify fuses for Playwright testing
executable: "$RUNNER_TEMP/Element/Element.exe"
prepare_cmd: |
$file = Get-Item ./dist/*.msi | Select -First 1 -ExpandProperty FullName
Start-Process $file -ArgumentList "/quiet APPLICATIONFOLDER=$env:RUNNER_TEMP/Element" -Wait
ls $env:RUNNER_TEMP
Start-Sleep -Seconds 60
ls $env:RUNNER_TEMP
ls $env:RUNNER_TEMP/Element
name: Test ${{ matrix.name }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: "yarn"
- name: Install Deps
run: "yarn install --frozen-lockfile"
- uses: actions/download-artifact@v4
with:
name: ${{ matrix.artifact }}
path: dist
- name: Prepare for tests
run: ${{ matrix.prepare_cmd }}
if: matrix.prepare_cmd
# 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 npx @electron/fuses write --app ${{ matrix.executable }} EnableNodeCliInspectArguments=on
shell: bash
env:
# We need sudo on Linux as it is installed in /opt/
RUN_AS: ${{ runner.os == 'Linux' && 'sudo' || '' }}
- name: Run tests
uses: coactions/setup-xvfb@6b00cf1889f4e1d5a48635647013c0508128ee1a
timeout-minutes: 5
with:
run: "yarn test ${{ runner.os != 'Linux' && '--ignore-snapshots' || '' }}"
env:
ELEMENT_DESKTOP_EXECUTABLE: ${{ matrix.executable }}
- name: Upload HTML report
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}-test
path: playwright/html-report
retention-days: 14