Add an option to use the Windows title bar #994
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- development | |
- linux | |
- 'linux-release-*' | |
tags: | |
- 'release-*.*.*-linux*' | |
- 'release-*.*.*-test*' | |
pull_request: | |
branches: | |
- linux | |
- 'linux-release-*' | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
repository: ${{ inputs.repository || github.repository }} | |
ref: ${{ inputs.ref }} | |
submodules: recursive | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16.17.1 | |
cache: yarn | |
- run: yarn | |
- run: yarn validate-electron-version | |
- run: yarn lint | |
- run: yarn validate-changelog | |
- name: Ensure a clean working directory | |
run: git diff --name-status --exit-code | |
build: | |
name: ${{ matrix.friendlyName }} ${{ matrix.arch }} | |
runs-on: ${{ matrix.os }} | |
container: ${{ matrix.image }} | |
permissions: | |
contents: write | |
strategy: | |
fail-fast: false | |
matrix: | |
node: [18.16.1] | |
os: [macos-13, windows-2019, ubuntu-20.04] | |
arch: [x64, arm64] | |
include: | |
- os: macos-13 | |
friendlyName: macOS | |
- os: windows-2019 | |
friendlyName: Windows | |
- os: ubuntu-20.04 | |
friendlyName: Ubuntu | |
image: ubuntu:18.04 | |
arch: x64 | |
environment: | |
AS: as | |
STRIP: strip | |
AR: ar | |
CC: gcc | |
CPP: cpp | |
CXX: g++ | |
LD: ld | |
FC: gfortran | |
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig | |
- os: ubuntu-20.04 | |
friendlyName: Ubuntu | |
image: ubuntu:18.04 | |
arch: arm64 | |
environment: | |
AS: aarch64-linux-gnu-as | |
STRIP: aarch64-linux-gnu-strip | |
AR: aarch64-linux-gnu-ar | |
CC: aarch64-linux-gnu-gcc | |
CPP: aarch64-linux-gnu-cpp | |
CXX: aarch64-linux-gnu-g++ | |
LD: aarch64-linux-gnu-ld | |
FC: aarch64-linux-gnu-gfortran | |
PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig | |
- os: ubuntu-20.04 | |
friendlyName: Ubuntu | |
image: ubuntu:18.04 | |
arch: arm | |
node: 18.16.1 | |
environment: | |
AS: arm-linux-gnueabihf-as | |
STRIP: arm-linux-gnueabihf-strip | |
AR: arm-linux-gnueabihf-ar | |
CC: arm-linux-gnueabihf-gcc | |
CPP: arm-linux-gnueabihf-cpp | |
CXX: arm-linux-gnueabihf-g++ | |
LD: arm-linux-gnueabihf-ld | |
FC: arm-linux-gnueabihf-gfortran | |
PKG_CONFIG_PATH: /usr/lib/arm-linux-gnueabihf/pkgconfig | |
timeout-minutes: 60 | |
env: | |
RELEASE_CHANNEL: ${{ inputs.environment }} | |
AS: ${{ matrix.environment.AS }} | |
STRIP: ${{ matrix.environment.STRIP }} | |
AR: ${{ matrix.environment.AR }} | |
CC: ${{ matrix.environment.CC }} | |
CPP: ${{ matrix.environment.CPP }} | |
CXX: ${{ matrix.environment.CXX }} | |
LD: ${{ matrix.environment.LD }} | |
FC: ${{ matrix.environment.FC }} | |
PKG_CONFIG_PATH: ${{ matrix.environment.PKG_CONFIG_PATH }} | |
npm_config_arch: ${{ matrix.arch }} | |
steps: | |
- name: Install dependencies into dockerfile on Ubuntu | |
if: matrix.friendlyName == 'Ubuntu' | |
run: | | |
# ubuntu dockerfile is very minimal (only 122 packages are installed) | |
# add dependencies expected by scripts | |
apt update | |
apt install -y software-properties-common lsb-release \ | |
sudo wget curl build-essential jq autoconf automake \ | |
pkg-config ca-certificates rpm | |
# install new enough git to run actions/checkout | |
sudo add-apt-repository ppa:git-core/ppa -y | |
sudo apt update | |
sudo apt install -y git | |
# avoid "fatal: detected dubious ownership in repository at '/__w/shiftkey/desktop'" error | |
git config --global --add safe.directory '*' | |
- name: Add additional dependencies for Ubuntu x64 | |
if: ${{ matrix.friendlyName == 'Ubuntu' && matrix.arch == 'x64' }} | |
run: | | |
# add electron unit test dependencies | |
sudo apt install -y libasound2 libatk-bridge2.0-0 libatk1.0-0 \ | |
libatspi2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libdrm2 \ | |
libexpat1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 \ | |
libnss3 libpango-1.0-0 libx11-6 libxcb1 libxcomposite1 \ | |
libxdamage1 libxext6 libxfixes3 libxkbcommon0 libxrandr2 \ | |
libsecret-1-0 | |
- name: Add additional dependencies for Ubuntu arm64 | |
if: ${{ matrix.friendlyName == 'Ubuntu' && matrix.arch == 'arm64' }} | |
run: | | |
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu | |
- name: Add additional dependencies for Ubuntu arm | |
if: ${{ matrix.friendlyName == 'Ubuntu' && matrix.arch == 'arm' }} | |
run: | | |
sudo apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf binutils-arm-linux-gnueabihf pkg-config-arm-linux-gnueabihf | |
sudo sed -i "s/^deb/deb [arch=amd64,i386]/g" /etc/apt/sources.list | |
echo "deb [arch=arm64,armhf] http://ports.ubuntu.com/ $(lsb_release -s -c) main universe multiverse restricted" | sudo tee -a /etc/apt/sources.list | |
echo "deb [arch=arm64,armhf] http://ports.ubuntu.com/ $(lsb_release -s -c)-updates main universe multiverse restricted" | sudo tee -a /etc/apt/sources.list | |
sudo dpkg --add-architecture armhf | |
sudo apt-get update | |
sudo apt-get install -y libx11-dev:armhf libx11-xcb-dev:armhf libxkbfile-dev:armhf libsecret-1-dev:armhf | |
- uses: actions/checkout@v3 | |
with: | |
repository: ${{ inputs.repository || github.repository }} | |
ref: ${{ inputs.ref }} | |
submodules: recursive | |
- name: Use Node.js ${{ matrix.node }} | |
if: matrix.friendlyName != 'Ubuntu' | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: yarn | |
- name: Install unofficial-builds Node.js ${{ matrix.node }} on Ubuntu | |
if: matrix.friendlyName == 'Ubuntu' | |
run: | | |
# This version supports older GLIBC (official builds required a minimum of GLIBC 2.28) | |
# this might break if you bump the `matrix.node` version - ensure you are on the latest version | |
# of which ever major/minor release which should have this variant available | |
# | |
# See https://github.com/nodejs/unofficial-builds/ for more information on these versions. | |
# | |
curl -sL 'https://unofficial-builds.nodejs.org/download/release/v${{ matrix.node }}/node-v${{ matrix.node }}-linux-x64-glibc-217.tar.xz' | xzcat | sudo tar -vx --strip-components=1 -C /usr/local/ | |
sudo npm install --global yarn | |
# This step can be removed as soon as official Windows arm64 builds are published: | |
# https://github.com/nodejs/build/issues/2450#issuecomment-705853342 | |
# | |
# This version is pinned to 18.16.0 as the later version does not have the required | |
# `win-arm64/node.lib` output that we can consume in this CI build. | |
- name: Get NodeJS node-gyp lib for Windows arm64 | |
if: ${{ matrix.os == 'windows-2019' && matrix.arch == 'arm64' }} | |
run: .\script\download-nodejs-win-arm64.ps1 18.16.0 | |
- name: Get app version | |
id: version | |
run: echo version=$(jq -r ".version" app/package.json) >> $GITHUB_OUTPUT | |
- name: Install and build dependencies | |
run: yarn | |
- name: Build production app | |
run: yarn build:prod | |
- name: Prepare testing environment | |
if: matrix.arch == 'x64' | |
run: yarn test:setup | |
env: | |
npm_config_arch: ${{ matrix.arch }} | |
- name: Run unit tests | |
if: matrix.arch == 'x64' | |
run: yarn test:unit | |
- name: Run script tests | |
if: matrix.arch == 'x64' | |
run: yarn test:script | |
- name: Package application | |
run: yarn run package | |
if: ${{ matrix.friendlyName == 'Ubuntu' }} | |
- name: Upload output artifacts | |
uses: actions/upload-artifact@v3 | |
if: matrix.friendlyName == 'Ubuntu' | |
with: | |
name: ${{ matrix.friendlyName }}-${{ matrix.arch }}-artifacts | |
path: | | |
dist/*.AppImage | |
dist/*.deb | |
dist/*.rpm | |
dist/*.sha256 | |
retention-days: 5 | |
publish: | |
name: Create GitHub release | |
needs: [build, lint] | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download all artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: './artifacts' | |
- name: Display structure of downloaded files | |
run: ls -R | |
working-directory: './artifacts' | |
- name: Get tag name without prefix | |
run: | | |
RELEASE_TAG=${GITHUB_REF/refs\/tags\//} | |
echo "RELEASE_TAG=${RELEASE_TAG}" >> $GITHUB_ENV | |
tagNameWithoutPrefix="${RELEASE_TAG:8}" | |
echo "RELEASE_TAG_WITHOUT_PREFIX=${tagNameWithoutPrefix}" >> $GITHUB_ENV | |
# TODO: generate release notes | |
# - pull in default if version matches X.Y.Z-linux1 | |
# - otherwise stub template | |
- name: Generate release notes | |
run: | | |
yarn | |
node -r ts-node/register script/generate-release-notes.ts "${{ github.workspace }}/artifacts" "${{ env.RELEASE_TAG_WITHOUT_PREFIX }}" | |
RELEASE_NOTES_FILE=script/release_notes.txt | |
if [[ ! -f "$RELEASE_NOTES_FILE" ]]; then | |
echo "$RELEASE_NOTES_FILE does not exist. Something might have gone wrong while generating the release notes." | |
exit 1 | |
fi | |
echo "Release notes:" | |
echo "---" | |
cat ${RELEASE_NOTES_FILE} | |
echo "---" | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: GitHub Desktop for Linux ${{ env.RELEASE_TAG_WITHOUT_PREFIX }} | |
body_path: script/release_notes.txt | |
files: | | |
artifacts/**/*.AppImage | |
artifacts/**/*.deb | |
artifacts/**/*.rpm | |
artifacts/**/*.sha256 | |
draft: true | |
fail_on_unmatched_files: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |