Skip to content

Commit

Permalink
build: Build via GitHub Actions (#1860)
Browse files Browse the repository at this point in the history
* Set snapshot version

* Add Linux build script

* Add macOS build script

* Add Windows build script

* Add unified build script

* Use a unified build script

* Remove Travis and AppVeyor scripts

* Fix macOS build issue

* Add some comments
  • Loading branch information
tassoevan authored Nov 2, 2020
1 parent dd859c3 commit e769b59
Show file tree
Hide file tree
Showing 5 changed files with 242 additions and 113 deletions.
240 changes: 240 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
name: Build

on:
- push
- pull_request

jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
with:
node-version: '12'
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- run: yarn --check-files
- run: yarn test

bundle:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
with:
node-version: '12'
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- run: yarn --check-files
- run: yarn eslint
- run: yarn build
env:
NODE_ENV: production
BUGSNAG_API_KEY: ${{ secrets.BUGSNAG_API_KEY }}
- uses: actions/upload-artifact@v2
with:
name: app
path: ./app

smoke-test-windows-build:
needs: bundle
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
with:
node-version: '12'
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- run: yarn --check-files
- uses: actions/download-artifact@v2
with:
name: app
path: ./app
- run: yarn electron-builder --x64 --dir
env:
CSC_LINK: ${{ secrets.WIN_CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}
- run: |
$job = Start-Job -ScriptBlock { .\dist\win-unpacked\Rocket.Chat.exe }
if (Wait-Job $job -Timeout 30) {
Write-Host $(Receive-Job -Job $job)
}
Remove-Job -force $job
- run: yarn electron-builder --ia32 --dir
env:
CSC_LINK: ${{ secrets.WIN_CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}
- run: |
$job = Start-Job -ScriptBlock { .\dist\win-ia32-unpacked\Rocket.Chat.exe }
if (Wait-Job $job -Timeout 30) {
Write-Host $(Receive-Job -Job $job)
}
Remove-Job -force $job
smoke-test-macos-build:
needs: bundle
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
with:
node-version: '12'
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- run: yarn --check-files
- uses: actions/download-artifact@v2
with:
name: app
path: ./app
- run: yarn electron-builder --dir
env:
CSC_LINK: ${{ secrets.MAC_CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.MAC_CSC_KEY_PASSWORD }}
- run: |
brew install coreutils
gtimeout 30 ./dist/mac/Rocket.Chat.app/Contents/MacOS/Rocket.Chat || code=$?
if [[ $code -ne 124 && $code -ne 0 ]]; then
exit $code;
fi
smoke-test-linux-build:
needs: bundle
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
with:
node-version: '12'
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- run: yarn --check-files
- uses: actions/download-artifact@v2
with:
name: app
path: ./app
- run: yarn electron-builder --dir
env:
CSC_LINK: ${{ secrets.MAC_CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.MAC_CSC_KEY_PASSWORD }}
- run: |
xvfb-run timeout 30 ./dist/linux-unpacked/rocketchat-desktop || code=$?
if [[ $code -ne 124 && $code -ne 0 ]]; then
exit $code;
fi
windows-build:
if: ${{ github.event_name == 'push' }}
needs: smoke-test-windows-build
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
with:
node-version: '12'
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- run: yarn --check-files
- uses: actions/download-artifact@v2
with:
name: app
path: ./app
- run: yarn electron-builder
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
CSC_LINK: ${{ secrets.WIN_CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}
- uses: actions/upload-artifact@v2
with:
name: windows-dist
path: ./dist

macos-build:
if: ${{ github.event_name == 'push' }}
needs: smoke-test-macos-build
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
with:
node-version: '12'
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- run: yarn --check-files
- uses: actions/download-artifact@v2
with:
name: app
path: ./app
# Disable Spotlight indexing due to a error when generating DMG
# See https://github.com/electron-userland/electron-builder/issues/4606#issuecomment-667641621
- run: mdutil -a -i off
- run: yarn electron-builder
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
CSC_LINK: ${{ secrets.MAC_CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.MAC_CSC_KEY_PASSWORD }}
# Variables needed to notarization process:
IS_PULL_REQUEST: ${{ github.event_name == 'pull_request' }}
APPLEID: ${{ secrets.APPLEID }}
APPLEIDPASS: ${{ secrets.APPLEIDPASS }}
- uses: actions/upload-artifact@v2
with:
name: macos-dist
path: ./dist

linux-build:
if: ${{ github.event_name == 'push' }}
needs: smoke-test-linux-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
with:
node-version: '12'
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- run: yarn --check-files
- uses: actions/download-artifact@v2
with:
name: app
path: ./app
# Snap builds must be separate as they aren't published in GitHub Releases
- run: yarn electron-builder --linux tar.gz deb rpm
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- uses: samuelmeuli/action-snapcraft@v1
with:
snapcraft_token: ${{ secrets.SNAP_TOKEN }}
- if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: yarn electron-builder --publish always --linux snap -c.publish.1.provider=snapStore -c.publish.1.channel=stable
- if: ${{ github.ref == 'refs/heads/master' }}
run: yarn electron-builder --publish always --linux snap -c.publish.1.provider=snapStore -c.publish.1.channel=candidate
- if: ${{ startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/hotfix/') }}
run: yarn electron-builder --publish always --linux snap -c.publish.1.provider=snapStore -c.publish.1.channel=beta
- if: ${{ startsWith(github.ref, 'refs/heads/') }}
run: yarn electron-builder --publish always --linux snap -c.publish.1.provider=snapStore -c.publish.1.channel=edge
- uses: actions/upload-artifact@v2
with:
name: linux-dist
path: ./dist
67 changes: 0 additions & 67 deletions .travis.yml

This file was deleted.

44 changes: 0 additions & 44 deletions appveyor.yml

This file was deleted.

2 changes: 1 addition & 1 deletion build/notarize.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { notarize } = require('electron-notarize');

exports.default = function notarizing(context) {
const { electronPlatformName, appOutDir } = context;
if (electronPlatformName !== 'darwin' || process.env.TRAVIS_PULL_REQUEST !== 'false') {
if (electronPlatformName !== 'darwin' || process.env.IS_PULL_REQUEST !== 'false') {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "rocketchat",
"description": "Official OSX, Windows, and Linux Desktop Clients for Rocket.Chat",
"version": "3.0.5",
"version": "3.0.6-snapshot",
"author": "Rocket.Chat Support <support@rocket.chat>",
"copyright": "© 2016-2020, Rocket.Chat",
"homepage": "https://rocket.chat",
Expand Down

0 comments on commit e769b59

Please sign in to comment.