2022-08-25 20:04:14 +02:00
|
|
|
name: Build and Test
|
2022-04-25 19:58:34 +02:00
|
|
|
on:
|
2023-02-22 14:51:19 +01:00
|
|
|
pull_request: {}
|
|
|
|
push:
|
|
|
|
branches: [develop, staging, master]
|
2022-05-27 10:15:47 +02:00
|
|
|
concurrency:
|
2023-02-22 14:51:19 +01:00
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
2022-04-25 19:58:34 +02:00
|
|
|
jobs:
|
2023-02-22 14:51:19 +01:00
|
|
|
fetch:
|
|
|
|
uses: ./.github/workflows/build_prepare.yaml
|
|
|
|
with:
|
|
|
|
config: ${{ github.event.pull_request.base.ref == 'develop' && 'element.io/nightly' || 'element.io/release' }}
|
|
|
|
version: ${{ github.event.pull_request.base.ref == 'develop' && 'develop' || '' }}
|
2022-07-11 11:33:27 +02:00
|
|
|
|
2023-02-22 14:51:19 +01:00
|
|
|
windows:
|
|
|
|
needs: fetch
|
|
|
|
name: Windows
|
|
|
|
uses: ./.github/workflows/build_windows.yaml
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-03-23 14:22:29 +01:00
|
|
|
arch: [x64, x86]
|
2023-02-22 14:51:19 +01:00
|
|
|
with:
|
|
|
|
arch: ${{ matrix.arch }}
|
2022-04-25 19:58:34 +02:00
|
|
|
|
2023-04-14 14:00:19 +02:00
|
|
|
# This allows core contributors to test changes to the dockerbuild image within a pull request
|
|
|
|
linux_docker:
|
|
|
|
name: Linux docker
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: github.event_name == 'pull_request'
|
|
|
|
outputs:
|
|
|
|
docker-image: ${{ steps.docker.outputs.image }}
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
env:
|
|
|
|
REGISTRY: ghcr.io
|
|
|
|
IMAGE_NAME: ${{ github.repository }}-dockerbuild-pr
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: "Get modified files"
|
|
|
|
id: changed_files
|
2023-04-18 16:17:36 +02:00
|
|
|
uses: tj-actions/changed-files@7ecfc6730dff8072d1cc5215a24cc9478f55264d # v35
|
2023-04-14 14:00:19 +02:00
|
|
|
with:
|
|
|
|
files: |
|
|
|
|
dockerbuild/*
|
|
|
|
- name: Log in to the Container registry
|
|
|
|
if: steps.changed_files.outputs.any_modified == 'true'
|
|
|
|
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
|
|
|
with:
|
|
|
|
registry: ${{ env.REGISTRY }}
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- id: docker
|
|
|
|
if: steps.changed_files.outputs.any_modified == 'true'
|
|
|
|
run: |
|
|
|
|
echo "image=$IMAGE:$PR" >> $GITHUB_OUTPUT
|
|
|
|
env:
|
|
|
|
IMAGE: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
|
|
PR: ${{ github.event.pull_request.number }}
|
|
|
|
|
|
|
|
- name: Build and push Docker image
|
|
|
|
if: steps.changed_files.outputs.any_modified == 'true'
|
|
|
|
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
|
|
|
|
with:
|
|
|
|
context: dockerbuild
|
|
|
|
push: true
|
|
|
|
tags: ${{ steps.docker.outputs.image }}
|
|
|
|
|
2023-02-22 14:51:19 +01:00
|
|
|
linux:
|
2023-04-14 14:00:19 +02:00
|
|
|
needs:
|
|
|
|
- fetch
|
|
|
|
- linux_docker
|
2023-04-18 12:38:26 +02:00
|
|
|
name: "Linux (${{ matrix.arch }}) (sqlcipher: ${{ matrix.sqlcipher }})"
|
2023-02-22 14:51:19 +01:00
|
|
|
uses: ./.github/workflows/build_linux.yaml
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
sqlcipher: [system, static]
|
2023-04-18 12:38:26 +02:00
|
|
|
arch: [amd64, arm64]
|
|
|
|
exclude:
|
|
|
|
# FIXME: This combination yields a broken Seshat at this time
|
|
|
|
# Errors at launch with `undefined symbol: PKCS5_PBKDF2_HMAC
|
|
|
|
- arch: arm64
|
|
|
|
sqlcipher: static
|
2023-02-22 14:51:19 +01:00
|
|
|
with:
|
2023-03-07 16:53:53 +01:00
|
|
|
config: ${{ github.event.pull_request.base.ref == 'develop' && 'element.io/nightly' || 'element.io/release' }}
|
2023-02-22 14:51:19 +01:00
|
|
|
sqlcipher: ${{ matrix.sqlcipher }}
|
2023-04-14 14:00:19 +02:00
|
|
|
docker-image: ${{ needs.linux_docker.outputs.docker-image }}
|
2023-04-18 12:38:26 +02:00
|
|
|
arch: ${{ matrix.arch }}
|
2022-04-25 19:58:34 +02:00
|
|
|
|
2023-02-22 14:51:19 +01:00
|
|
|
macos:
|
|
|
|
needs: fetch
|
|
|
|
name: macOS
|
|
|
|
uses: ./.github/workflows/build_macos.yaml
|
2022-08-25 20:04:14 +02:00
|
|
|
|
2023-02-22 14:51:19 +01:00
|
|
|
test:
|
|
|
|
needs:
|
|
|
|
- macos
|
|
|
|
- linux
|
|
|
|
- windows
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- name: macOS Universal
|
|
|
|
os: macos
|
|
|
|
artifact: macos
|
2023-04-24 13:24:36 +02:00
|
|
|
executable: "/Volumes/Element/Element.app/Contents/MacOS/Element"
|
|
|
|
prepare_cmd: "hdiutil attach ./dist/*.dmg -mountpoint /Volumes/Element"
|
2023-04-18 12:38:26 +02:00
|
|
|
- name: "Linux (amd64) (sqlcipher: system)"
|
2023-02-22 14:51:19 +01:00
|
|
|
os: ubuntu
|
2023-04-18 12:38:26 +02:00
|
|
|
artifact: linux-amd64-sqlcipher-system
|
2023-02-22 14:51:19 +01:00
|
|
|
executable: "element-desktop"
|
|
|
|
prepare_cmd: "sudo apt install ./dist/*.deb"
|
2023-04-18 12:38:26 +02:00
|
|
|
- name: "Linux (amd64) (sqlcipher: static)"
|
2023-02-22 14:51:19 +01:00
|
|
|
os: ubuntu
|
2023-04-18 12:38:26 +02:00
|
|
|
artifact: linux-amd64-sqlcipher-static
|
2023-02-22 14:51:19 +01:00
|
|
|
executable: "element-desktop"
|
|
|
|
prepare_cmd: "sudo apt install ./dist/*.deb"
|
|
|
|
- name: Windows (x86)
|
|
|
|
os: windows
|
|
|
|
artifact: win-x86
|
|
|
|
executable: "./dist/win-ia32-unpacked/Element.exe"
|
|
|
|
- name: Windows (x64)
|
|
|
|
os: windows
|
|
|
|
artifact: win-x64
|
|
|
|
executable: "./dist/win-unpacked/Element.exe"
|
|
|
|
name: Test ${{ matrix.name }}
|
|
|
|
runs-on: ${{ matrix.os }}-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
2022-08-25 20:04:14 +02:00
|
|
|
|
2023-02-22 14:51:19 +01:00
|
|
|
- uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
cache: "yarn"
|
2022-07-11 11:33:27 +02:00
|
|
|
|
2023-02-22 14:51:19 +01:00
|
|
|
- name: Install Deps
|
2023-03-31 17:17:43 +02:00
|
|
|
run: "yarn install --frozen-lockfile"
|
2022-04-25 19:58:34 +02:00
|
|
|
|
2023-02-22 14:51:19 +01:00
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: ${{ matrix.artifact }}
|
|
|
|
path: dist
|
2022-08-25 20:04:14 +02:00
|
|
|
|
2023-02-22 14:51:19 +01:00
|
|
|
- name: Prepare for tests
|
|
|
|
run: ${{ matrix.prepare_cmd }}
|
|
|
|
if: matrix.prepare_cmd
|
2022-08-25 20:04:14 +02:00
|
|
|
|
2023-02-22 14:51:19 +01:00
|
|
|
- name: Run tests
|
2023-03-23 14:22:29 +01:00
|
|
|
uses: coactions/setup-xvfb@b6b4fcfb9f5a895edadc3bc76318fae0ac17c8b3 # v1
|
2023-02-22 14:51:19 +01:00
|
|
|
timeout-minutes: 5
|
|
|
|
with:
|
|
|
|
run: "yarn test"
|
|
|
|
env:
|
|
|
|
ELEMENT_DESKTOP_EXECUTABLE: ${{ matrix.executable }}
|
2022-08-25 20:04:14 +02:00
|
|
|
|
2023-02-22 14:51:19 +01:00
|
|
|
- name: Upload Artifacts
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
if: always()
|
|
|
|
with:
|
|
|
|
name: ${{ matrix.artifact }}
|
|
|
|
path: test_artifacts
|
|
|
|
retention-days: 1
|