Skip to content

chore: add build for QA #1448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 51 additions & 46 deletions .github/workflows/build-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,27 @@ jobs:
fail-fast: false
matrix:
# this needs to be a valid target of https://www.electron.build/linux#target
pkg_to_build: ['deb', 'rpm', 'freebsd', 'AppImage']
include:
- identifier: deb
electron_target: deb
cache_suffix: linux-deb
is_qa: false
- identifier: rpm
electron_target: rpm
cache_suffix: linux-rpm
is_qa: false
- identifier: freebsd
electron_target: freebsd
cache_suffix: linux-freebsd
is_qa: false
- identifier: AppImage
electron_target: AppImage
cache_suffix: linux-AppImage
is_qa: false
- identifier: AppImage-qa
electron_target: AppImage
cache_suffix: linux-AppImage
is_qa: true

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -43,10 +63,14 @@ jobs:
- name: Checkout git repo
uses: actions/checkout@v4

- name: Custom build for QA if needed
if: ${{ matrix.is_qa == true }}
uses: ./actions/sed_for_qa

- name: Setup & Build
uses: ./actions/setup_and_build
with:
cache_suffix: ${{ matrix.pkg_to_build }}
cache_suffix: ${{ matrix.cache_suffix }}

- name: Lint Files
# no need to lint files on all platforms
Expand All @@ -59,42 +83,42 @@ jobs:
- name: Unit Test
run: yarn test

- name: Make release build but do not publish ${{ matrix.pkg_to_build }}
- name: Make release build but do not publish ${{ matrix.identifier }}
# always run this, except on "push" to "master" or alpha releases
if: ${{ env.SHOULD_PUBLISH == 'false' && env.SHOULD_PUBLISH_ALPHA == 'false' }}
run: |
sed -i 's/"target": "deb"/"target": "${{ matrix.pkg_to_build }}"/g' package.json && yarn build-release
sed -i 's/"target": "deb"/"target": "${{ matrix.electron_target }}"/g' package.json && yarn build-release

- name: Upload artefacts ${{ matrix.pkg_to_build }}
- name: Upload artefacts ${{ matrix.identifier }}
# always run this, except on "push" to "master" or alpha releases
if: ${{ env.SHOULD_PUBLISH == 'false' && env.SHOULD_PUBLISH_ALPHA == 'false' }}
uses: ./actions/upload_prod_artefacts
with:
upload_prefix: ${{ runner.os }}-${{ runner.arch }}-${{ matrix.pkg_to_build }}
upload_prefix: ${{ runner.os }}-${{ runner.arch }}-${{ matrix.identifier }}

- name: Make release build & publish ${{ matrix.pkg_to_build }}
- name: Make release build & publish ${{ matrix.identifier }}
# only run this on "push" to "master" or alpha releases
if: ${{ env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true' }}
run: |
sed -i 's/"target": "deb"/"target": "${{ matrix.pkg_to_build }}"/g' package.json && yarn build-release-publish
sed -i 's/"target": "deb"/"target": "${{ matrix.electron_target }}"/g' package.json && yarn build-release-publish

- name: Backup release metadata
# only run this on "push" to "master" or alpha releases
# Note: The jobs are overwriting each other's latest-linux.yml.
# So, we upload all of them as artifacts, and then merge them (see `post_build_linux`)
# note: freebsd does not generate a latest-linux.yml file so we exclude it
if: ${{ (env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true') && matrix.pkg_to_build != 'freebsd' }}
if: ${{ (env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true') && matrix.electron_target != 'freebsd' }}
shell: bash
run: |
mv dist/latest-linux.yml dist/latest-linux-${{ matrix.pkg_to_build }}-${{ github.sha }}.yml
mv dist/latest-linux.yml dist/latest-linux-${{ matrix.electron_target }}-${{ github.sha }}.yml

- name: Upload release metadata
# only run this on "push" to "master" or alpha releases
if: ${{ (env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true') && matrix.pkg_to_build != 'freebsd' }}
uses: actions/upload-artifact@v4
with:
name: latest-linux-${{ matrix.pkg_to_build }}-${{ github.sha }}.yml
path: dist/latest-linux-${{ matrix.pkg_to_build }}-${{ github.sha }}.yml
name: latest-linux-${{ matrix.electron_target }}-${{ github.sha }}.yml
path: dist/latest-linux-${{ matrix.electron_target }}-${{ github.sha }}.yml

post_build_linux:
needs: [build_linux]
Expand Down Expand Up @@ -191,38 +215,19 @@ jobs:

# 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
# NOTE x64 builds made on an arm64 host will not bundle the native modules correctly https://github.com/electron-userland/electron-builder/issues/8646
build_mac_arm64:
runs-on: macos-14
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAC_CERTIFICATE: ${{ secrets.MAC_CERTIFICATE }}
MAC_CERTIFICATE_PASSWORD: ${{ secrets.MAC_CERTIFICATE_PASSWORD }}
SIGNING_APPLE_ID: ${{ secrets.SIGNING_APPLE_ID }}
SIGNING_APP_PASSWORD: ${{ secrets.SIGNING_APP_PASSWORD }}
SIGNING_TEAM_ID: ${{ secrets.SIGNING_TEAM_ID }}
steps:
- run: git config --global core.autocrlf false

- name: Checkout git repo
uses: actions/checkout@v4

- name: Setup & Build
uses: ./actions/setup_and_build
with:
cache_suffix: mac-arm64

# we want to test on all platforms since some are testing the rendered menus (and are dependent on the platform)
- name: Unit Test
run: yarn test
build_mac:
strategy:
matrix:
include:
- architecture: arm64
cache_suffix: mac-arm64
runner: macos-14

- name: Make release build arm64
uses: ./actions/make_release_build
with:
architecture: arm64
should_publish: ${{ env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true' }}
- architecture: x64
cache_suffix: mac-x64
runner: macos-13
runs-on: ${{ matrix.runner }}

build_mac_x64:
runs-on: macos-13
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAC_CERTIFICATE: ${{ secrets.MAC_CERTIFICATE }}
Expand All @@ -239,20 +244,20 @@ jobs:
- name: Setup & Build
uses: ./actions/setup_and_build
with:
cache_suffix: mac-x64
cache_suffix: ${{ matrix.cache_suffix }}

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

- name: Make release build x64
- name: Make release build ${{ matrix.architecture }}
uses: ./actions/make_release_build
with:
architecture: x64
architecture: ${{ matrix.architecture }}
should_publish: ${{ env.SHOULD_PUBLISH == 'true' || env.SHOULD_PUBLISH_ALPHA == 'true' }}

post_build_mac:
needs: [build_mac_arm64, build_mac_x64]
needs: build_mac
runs-on: ubuntu-22.04
steps:
- name: Checkout git repo
Expand Down
10 changes: 10 additions & 0 deletions actions/sed_for_qa/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: 'QA-specific sed tweak'
description: 'QA-specific sed tweak'

runs:
using: 'composite'
steps:
- name: Sed for QA build
shell: bash
run: |
sed -i 's/const isPackaged = app.isPackaged;/const isPackaged = app.isPackaged \&\& false;/g' ts/node/config.ts
Loading