Skip to content

Commit 4519930

Browse files
authored
Merge pull request #1574 from session-foundation/build-bins-ci-2
chore: allow to build bins for qa
2 parents 3f9d057 + 4738a16 commit 4519930

File tree

2 files changed

+67
-51
lines changed

2 files changed

+67
-51
lines changed

.github/workflows/build-binaries.yml

Lines changed: 57 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,33 @@ jobs:
8787
strategy:
8888
fail-fast: false
8989
matrix:
90-
# this needs to be a valid target of https://www.electron.build/linux#target
91-
pkg_to_build: ['deb', 'rpm', 'freebsd', 'AppImage']
90+
# `electron_target` needs to be a valid target of https://www.electron.build/linux#target
91+
include:
92+
- identifier: deb
93+
electron_target: deb
94+
cache_suffix: linux-deb
95+
is_qa: false
96+
- identifier: rpm
97+
electron_target: rpm
98+
cache_suffix: linux-rpm
99+
is_qa: false
100+
- identifier: freebsd
101+
electron_target: freebsd
102+
cache_suffix: linux-freebsd
103+
is_qa: false
104+
- identifier: AppImage
105+
electron_target: AppImage
106+
cache_suffix: linux-AppImage
107+
is_qa: false
108+
- identifier: deb-qa
109+
electron_target: deb
110+
cache_suffix: linux-deb
111+
is_qa: true
112+
name: '${{ matrix.identifier }}'
92113

93114
env:
94115
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
116+
95117
steps:
96118
- run: git config --global core.autocrlf false
97119

@@ -100,10 +122,14 @@ jobs:
100122
with:
101123
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }}
102124

125+
- name: Custom build for QA if needed
126+
if: ${{ matrix.is_qa == true }}
127+
uses: ./actions/sed_for_qa
128+
103129
- name: Setup & Build
104130
uses: ./actions/setup_and_build
105131
with:
106-
cache_suffix: ${{ matrix.pkg_to_build }}
132+
cache_suffix: ${{ matrix.cache_suffix }}
107133

108134
- name: Lint Files
109135
# no need to lint files on all platforms
@@ -116,41 +142,41 @@ jobs:
116142
- name: Unit Test
117143
run: yarn test
118144

119-
- name: Make release build but do not publish ${{ matrix.pkg_to_build }}
145+
- name: Make release build but do not publish ${{ matrix.identifier }}
120146
# we do want this part to run only when version_tag is unset (i.e. we are not making a release)
121147
if: ${{ needs.create_draft_release_if_needed.outputs.version_tag == '' }}
122148
run: |
123-
sed -i 's/"target": "deb"/"target": "${{ matrix.pkg_to_build }}"/g' package.json && yarn build-release
149+
sed -i 's/"target": "deb"/"target": "${{ matrix.electron_target }}"/g' package.json && yarn build-release
124150
125-
- name: Upload artefacts ${{ matrix.pkg_to_build }}
151+
- name: Upload artefacts ${{ matrix.identifier }}
126152
# we do want this part to run only when version_tag is unset (i.e. we are not making a release)
127153
if: ${{ needs.create_draft_release_if_needed.outputs.version_tag == '' }}
128154
uses: ./actions/upload_prod_artefacts
129155
with:
130-
upload_prefix: ${{ runner.os }}-${{ runner.arch }}-${{ matrix.pkg_to_build }}
156+
upload_prefix: ${{ runner.os }}-${{ runner.arch }}-${{ matrix.identifier }}
131157

132-
- name: Make release build & publish ${{ matrix.pkg_to_build }}
158+
- name: Make release build & publish ${{ matrix.identifier }}
133159
if: ${{ needs.create_draft_release_if_needed.outputs.version_tag != '' }}
134160
run: |
135-
sed -i 's/"target": "deb"/"target": "${{ matrix.pkg_to_build }}"/g' package.json && yarn build-release-publish
161+
sed -i 's/"target": "deb"/"target": "${{ matrix.electron_target }}"/g' package.json && yarn build-release-publish
136162
137163
- name: Backup release metadata
138164
# only run this on "push" to "master" or alpha releases
139165
# Note: The jobs are overwriting each other's latest-linux.yml.
140166
# So, we upload all of them as artifacts, and then merge them (see `post_build_linux`)
141167
# note: freebsd does not generate a latest-linux.yml file so we exclude it
142-
if: ${{ needs.create_draft_release_if_needed.outputs.version_tag != '' && matrix.pkg_to_build != 'freebsd' }}
168+
if: ${{ needs.create_draft_release_if_needed.outputs.version_tag != '' && matrix.identifier != 'freebsd' }}
143169
shell: bash
144170
run: |
145-
mv dist/latest-linux.yml dist/latest-linux-${{ matrix.pkg_to_build }}-${{ github.sha }}.yml
171+
mv dist/latest-linux.yml dist/latest-linux-${{ matrix.electron_target }}-${{ github.sha }}.yml
146172
147173
- name: Upload release metadata
148174
# only run this on "push" to "master" or alpha releases
149-
if: ${{ needs.create_draft_release_if_needed.outputs.version_tag != '' && matrix.pkg_to_build != 'freebsd' }}
175+
if: ${{ needs.create_draft_release_if_needed.outputs.version_tag != '' && matrix.identifier != 'freebsd' }}
150176
uses: actions/upload-artifact@v4
151177
with:
152-
name: latest-linux-${{ matrix.pkg_to_build }}-${{ github.sha }}.yml
153-
path: dist/latest-linux-${{ matrix.pkg_to_build }}-${{ github.sha }}.yml
178+
name: latest-linux-${{ matrix.electron_target }}-${{ github.sha }}.yml
179+
path: dist/latest-linux-${{ matrix.electron_target }}-${{ github.sha }}.yml
154180

155181
post_build_linux:
156182
needs: [create_draft_release_if_needed, build_linux]
@@ -199,6 +225,7 @@ jobs:
199225
needs: [create_draft_release_if_needed]
200226
env:
201227
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
228+
name: 'windows x64'
202229
steps:
203230
- run: git config --global core.autocrlf false
204231

@@ -234,41 +261,20 @@ jobs:
234261

235262
# We want both arm64 and intel mac builds, and according to this https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources macos-14 and above is always arm64 and macos-13 is the last intel runner
236263
# NOTE x64 builds made on an arm64 host will not bundle the native modules correctly https://github.com/electron-userland/electron-builder/issues/8646
237-
build_mac_arm64:
238-
needs: [create_draft_release_if_needed]
239-
runs-on: macos-14
240-
env:
241-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
242-
MAC_CERTIFICATE: ${{ secrets.MAC_CERTIFICATE }}
243-
MAC_CERTIFICATE_PASSWORD: ${{ secrets.MAC_CERTIFICATE_PASSWORD }}
244-
SIGNING_APPLE_ID: ${{ secrets.SIGNING_APPLE_ID }}
245-
SIGNING_APP_PASSWORD: ${{ secrets.SIGNING_APP_PASSWORD }}
246-
SIGNING_TEAM_ID: ${{ secrets.SIGNING_TEAM_ID }}
247-
steps:
248-
- run: git config --global core.autocrlf false
249-
250-
- name: Checkout git repo
251-
uses: actions/checkout@v4
252-
with:
253-
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target_branch || github.ref }}
254-
255-
- name: Setup & Build
256-
uses: ./actions/setup_and_build
257-
with:
258-
cache_suffix: mac-arm64
259-
260-
# we want to test on all platforms since some are testing the rendered menus (and are dependent on the platform)
261-
- name: Unit Test
262-
run: yarn test
264+
build_mac:
265+
strategy:
266+
matrix:
267+
include:
268+
- architecture: arm64
269+
cache_suffix: mac-arm64
270+
runner: macos-14
263271

264-
- name: Make release build arm64
265-
uses: ./actions/make_release_build
266-
with:
267-
architecture: arm64
268-
should_publish: ${{ needs.create_draft_release_if_needed.outputs.version_tag != ''}}
272+
- architecture: x64
273+
cache_suffix: mac-x64
274+
runner: macos-13
275+
runs-on: ${{ matrix.runner }}
276+
name: '${{ matrix.architecture }}'
269277

270-
build_mac_x64:
271-
runs-on: macos-13
272278
needs: [create_draft_release_if_needed]
273279
env:
274280
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -288,20 +294,20 @@ jobs:
288294
- name: Setup & Build
289295
uses: ./actions/setup_and_build
290296
with:
291-
cache_suffix: mac-x64
297+
cache_suffix: ${{ matrix.cache_suffix }}
292298

293299
# we want to test on all platforms since some are testing the rendered menus (and are dependent on the platform)
294300
- name: Unit Test
295301
run: yarn test
296302

297-
- name: Make release build x64
303+
- name: Make release build ${{ matrix.architecture }}
298304
uses: ./actions/make_release_build
299305
with:
300-
architecture: x64
306+
architecture: ${{ matrix.architecture }}
301307
should_publish: ${{ needs.create_draft_release_if_needed.outputs.version_tag != '' }}
302308

303309
post_build_mac:
304-
needs: [create_draft_release_if_needed, build_mac_arm64, build_mac_x64]
310+
needs: [create_draft_release_if_needed, build_mac]
305311
runs-on: ubuntu-22.04
306312
if: ${{ needs.create_draft_release_if_needed.outputs.version_tag != '' }}
307313
env:

actions/sed_for_qa/action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: 'QA-specific sed tweak'
2+
description: 'QA-specific sed tweak'
3+
4+
runs:
5+
using: 'composite'
6+
steps:
7+
- name: Sed for QA build
8+
shell: bash
9+
run: |
10+
sed -i 's/const isPackaged = app.isPackaged;/const isPackaged = app.isPackaged \&\& false;/g' ts/node/config.ts

0 commit comments

Comments
 (0)