-
Notifications
You must be signed in to change notification settings - Fork 269
164 lines (150 loc) · 5.91 KB
/
build_and_test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Build and Test
on:
pull_request: {}
push:
branches: [develop, staging, master]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
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' || '' }}
windows:
needs: fetch
name: Windows
uses: ./.github/workflows/build_windows.yaml
strategy:
matrix:
arch: [x64, x86]
with:
arch: ${{ matrix.arch }}
# 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
uses: tj-actions/changed-files@a21a533a0c244a27daac02f9dc6fcf8aeb996154 # v39
with:
files: |
dockerbuild/*
- name: Log in to the Container registry
if: steps.changed_files.outputs.any_modified == 'true'
uses: docker/login-action@a5609cb39f57be157c39b77359abfaa43aeaeb8f
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@4e4ee680f69700760d5620a94c020aef883043aa
with:
context: dockerbuild
push: true
tags: ${{ steps.docker.outputs.image }}
linux:
needs:
- fetch
- linux_docker
name: "Linux (${{ matrix.arch }}) (sqlcipher: ${{ matrix.sqlcipher }})"
uses: ./.github/workflows/build_linux.yaml
strategy:
matrix:
sqlcipher: [system, static]
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
with:
config: ${{ github.event.pull_request.base.ref == 'develop' && 'element.io/nightly' || 'element.io/release' }}
sqlcipher: ${{ matrix.sqlcipher }}
docker-image: ${{ needs.linux_docker.outputs.docker-image }}
arch: ${{ matrix.arch }}
macos:
needs: fetch
name: macOS
uses: ./.github/workflows/build_macos.yaml
test:
needs:
- macos
- linux
- windows
strategy:
matrix:
include:
- name: macOS Universal
os: macos
artifact: macos
executable: "/Volumes/Element/Element.app/Contents/MacOS/Element"
prepare_cmd: "hdiutil attach ./dist/*.dmg -mountpoint /Volumes/Element"
- name: "Linux (amd64) (sqlcipher: system)"
os: ubuntu
artifact: linux-amd64-sqlcipher-system
executable: "element-desktop"
prepare_cmd: "sudo apt install ./dist/*.deb"
- name: "Linux (amd64) (sqlcipher: static)"
os: ubuntu
artifact: linux-amd64-sqlcipher-static
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
- uses: actions/setup-node@v3
with:
cache: "yarn"
- name: Install Deps
run: "yarn install --frozen-lockfile"
- uses: actions/download-artifact@v3
with:
name: ${{ matrix.artifact }}
path: dist
- name: Prepare for tests
run: ${{ matrix.prepare_cmd }}
if: matrix.prepare_cmd
- name: Run tests
uses: coactions/setup-xvfb@b6b4fcfb9f5a895edadc3bc76318fae0ac17c8b3 # v1
timeout-minutes: 5
with:
run: "yarn test"
env:
ELEMENT_DESKTOP_EXECUTABLE: ${{ matrix.executable }}
- name: Upload Artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: ${{ matrix.artifact }}
path: test_artifacts
retention-days: 1