Continuous Integration (CI)
All the following configurations work with electron-react-boilerplate.
- Travis CI
- Azure Pipelines
- GitHub Actions
- AppVeyor
matrix: include: - os: osx language: node_js node_js: - node env: - ELECTRON_CACHE=$HOME/.cache/electron - ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder - os: linux language: node_js node_js: - node services: - xvfb addons: apt: sources: - sourceline: "ppa:ubuntu-toolchain-r/test" packages: - gcc-multilib - g++-8 - g++-multilib - icnsutils - graphicsmagick - xz-utils - xorriso - rpm
before_cache: - rm -rf $HOME/.cache/electron-builder/wine
cache: yarn: true directories: - node_modules - $(npm config get prefix)/lib/node_modules - $HOME/.cache/electron - $HOME/.cache/electron-builder
before_install: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export CXX="g++-8"; fi
install: - yarn --ignore-engines # On Linux, initialize "virtual display". See before_script - | if [ "$TRAVIS_OS_NAME" == "linux" ]; then /sbin/start-stop-daemon \ --start \ --quiet \ --pidfile /tmp/custom_xvfb_99.pid \ --make-pidfile \ --background \ --exec /usr/bin/Xvfb \ -- :99 -ac -screen 0 1280x1024x16 else : fi
before_script: # On Linux, create a "virtual display". This allows browsers to work properly - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export DISPLAY=:99.0; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sleep 3; fi
script: - yarn package-ci - yarn lint - yarn ts - yarn test - yarn build-e2e - yarn test-e2e
variables: YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn
strategy: matrix: linux: imageName: "ubuntu-16.04" nodeVersion: "13.x" mac: imageName: "macos-10.14" nodeVersion: "13.x" windows: imageName: "windows-2019" nodeVersion: "13.x"
pool: vmImage: $(imageName)
steps: # Set node version - task: NodeTool@0 inputs: versionSpec: $(nodeVersion) # Cache yarn deps - task: Cache@2 inputs: key: 'yarn | "$(Agent.OS)" | yarn.lock' restoreKeys: | yarn | "$(Agent.OS)" yarn path: $(YARN_CACHE_FOLDER) displayName: Cache Yarn packages # Start virtual framebuffer server - bash: | /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & echo ">>> Started xvfb" displayName: Start xvfb condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux')) # Install deps with yarn and run tests - script: yarn --frozen-lockfile && yarn test-all env: DISPLAY: ":99.0" # Generate coverage report - script: yarn test --coverage --coverageReporters=cobertura # Publish coverage report - task: PublishCodeCoverageResults@1 inputs: codeCoverageTool: Cobertura summaryFileLocation: $(System.DefaultWorkingDirectory)/coverage/cobertura-coverage.xml
name: Test
on: push
jobs: release: runs-on: ${{ matrix.os }}
strategy: matrix: os: [macos-10.14, windows-2019, ubuntu-18.04]
steps: - name: Check out Git repository uses: actions/checkout@v1
- name: Install Node.js, NPM and Yarn uses: actions/setup-node@v1 with: node-version: 13
- name: yarn install run: | yarn install
- name: yarn test env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | yarn package-ci yarn lint yarn ts
# Failing beacuse virtual framebuffer not installed# yarn build-e2e# yarn test-e2e
image: Visual Studio 2017
platform: - x64
environment: matrix: - nodejs_version: 13
cache: - '%LOCALAPPDATA%/Yarn' - node_modules - build/app/node_modules - '%USERPROFILE%\.electron'
matrix: fast_finish: true
build: off
version: '{build}'
shallow_clone: true
clone_depth: 1
install: - ps: Install-Product node $env:nodejs_version x64 - set CI=true - yarn
test_script: - yarn package-ci - yarn lint - yarn ts - yarn test - yarn build-e2e - yarn test-e2e