signal-desktop/.github/workflows/ci.yml
2022-02-02 10:14:27 -08:00

234 lines
6.5 KiB
YAML

# Copyright 2020-2021 Signal Messenger, LLC
# SPDX-License-Identifier: AGPL-3.0-only
name: CI
on:
push:
branches:
- development
- '[0-9]+.[0-9]+.x'
pull_request:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- run: lsb_release -a
- run: uname -a
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16.9.1'
- run: npm install -g yarn@1.22.10
- name: Cache Desktop node_modules
id: cache-desktop-modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('package.json', 'yarn.lock', 'patches/**') }}
- name: Install Desktop node_modules
if: steps.cache-desktop-modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
- run: yarn generate
- run: yarn lint
- run: yarn lint-deps
# - run: yarn lint-license-comments
- run: git diff --exit-code
macos:
needs: lint
runs-on: macos-11.0
if: github.ref == 'refs/heads/development' || github.ref == 'refs/heads/master'
steps:
- run: uname -a
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16.9.1'
- run: npm install -g yarn@1.22.10
- name: Cache Desktop node_modules
id: cache-desktop-modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('package.json', 'yarn.lock', 'patches/**') }}
- name: Install Desktop node_modules
if: steps.cache-desktop-modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
- run: yarn generate
- run: yarn prepare-beta-build
- run: yarn build
env:
DISABLE_INSPECT_FUSE: on
- name: Rebuild native modules for x64
run: yarn electron:install-app-deps
- run: yarn test-node
- run: yarn test-electron
- run: yarn test-release
env:
NODE_ENV: production
linux:
needs: lint
runs-on: ubuntu-latest
steps:
- run: lsb_release -a
- run: uname -a
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16.9.1'
- run: sudo apt-get install xvfb
- run: npm install -g yarn@1.22.10
- name: Cache Desktop node_modules
id: cache-desktop-modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('package.json', 'yarn.lock', 'patches/**') }}
- name: Install Desktop node_modules
if: steps.cache-desktop-modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
- run: yarn generate
- run: yarn prepare-beta-build
- run: yarn build
env:
DISABLE_INSPECT_FUSE: on
- run: xvfb-run --auto-servernum yarn test-node
- run: xvfb-run --auto-servernum yarn test-electron
env:
LANG: en_US
LANGUAGE: en_US
- run: xvfb-run --auto-servernum yarn test-release
env:
NODE_ENV: production
windows:
needs: lint
runs-on: windows-latest
steps:
- run: systeminfo
- run: git config --global core.autocrlf false
- run: git config --global core.eol lf
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16.9.1'
- run: npm install -g yarn@1.22.10
- name: Cache Desktop node_modules
id: cache-desktop-modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('package.json', 'yarn.lock', 'patches/**') }}
- name: Install Desktop node_modules
if: steps.cache-desktop-modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
- run: yarn generate
- run: yarn test-node
- run: copy package.json temp.json
- run: del package.json
- run: type temp.json | findstr /v certificateSubjectName | findstr /v certificateSha1 > package.json
- run: yarn prepare-beta-build
- run: yarn build
env:
DISABLE_INSPECT_FUSE: on
- run: yarn test-electron
- run: yarn test-release
env:
SIGNAL_ENV: production
storage-service:
needs: lint
runs-on: ubuntu-latest
if: ${{ github.repository == 'signalapp/Signal-Desktop-Private' }}
steps:
- name: Get system specs
run: lsb_release -a
- name: Get other system specs
run: uname -a
- name: Configure git to use HTTPS
run: git config --global url."https://${{ secrets.AUTOMATED_GITHUB_PAT }}:x-oauth-basic@github.com".insteadOf ssh://git@github.com
- name: Clone Desktop repo
uses: actions/checkout@v2
- name: Clone Mock-Server repo
uses: actions/checkout@v2
with:
repository: 'signalapp/Mock-Signal-Server-Private'
path: 'Mock-Server'
ref: 'gamma'
token: ${{ secrets.AUTOMATED_GITHUB_PAT }}
- name: Setup node.js
uses: actions/setup-node@v2
with:
node-version: '16.9.1'
- name: Install global dependencies
run: npm install -g yarn@1.22.10
- name: Install xvfb
run: sudo apt-get install xvfb
- name: Cache Desktop node_modules
id: cache-desktop-modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('package.json', 'yarn.lock', 'patches/**') }}
- name: Install Desktop node_modules
if: steps.cache-desktop-modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
- name: Install Mock-Server node_modules
run: yarn install --frozen-lockfile
working-directory: Mock-Server
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
- name: Build typescript
run: yarn generate
- name: Bundle
run: yarn build:webpack
- name: Copy CI configuration
run: |
cp -rf ./Mock-Server/config/local-development.json \
./config/local-development.json
cp -rf ./config/local-development.json ./config/local-production.json
- name: Setup hosts
run: sudo echo "127.0.0.1 mock.signal.org" | sudo tee -a /etc/hosts
- name: Run storage service tests
run: |
set -o pipefail
rm -rf /tmp/mock
xvfb-run --auto-servernum node Mock-Server/scripts/storage-service-test.js \
./node_modules/.bin/electron .
timeout-minutes: 10
env:
NODE_ENV: production
DEBUG: mock:scripts:*
- name: Upload logs on failure
if: failure()
uses: actions/upload-artifact@v2
with:
name: logs
path: /tmp/mock/logs