name: CI

on: [push, pull_request]

jobs:
  linux:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: Use Node.js 12.x
      uses: actions/setup-node@v1
      with:
        node-version: 12.x
    - name: Setup build environment
      run: |
        sudo apt-get update
        sudo apt-get install -y libxkbfile-dev pkg-config libsecret-1-dev libxss1 dbus xvfb libgtk-3-0
        sudo cp src/test/xvfb.init /etc/init.d/xvfb
        sudo chmod +x /etc/init.d/xvfb
        sudo update-rc.d xvfb defaults
        sudo service xvfb start
    - name: Cache yarn cache
      uses: actions/cache@v1
      with:
        path: ~/.cache/yarn
        key: ${{ runner.os }}-yarn-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
        restore-keys: |
          ${{ runner.os }}-yarn-
    - name: Install and build
      run: |
        yarn --frozen-lockfile
        yarn compile
      env:
        CI: true
    - name: Start xvfb
      if: startsWith(matrix.os, 'ubuntu')
      run: /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
    - name: Test
      env:
        CODE_VERSION: ''
        DISPLAY: ':99.0'
      run: yarn test
    - name: Lint
      run: yarn lint

name: CI

on: [push, pull_request]

jobs:
  linux:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: Use Node.js 12.x
      uses: actions/setup-node@v1
      with:
        node-version: 12.x
    - name: Setup build environment
      run: |
        sudo apt-get update
        sudo apt-get install -y libxkbfile-dev pkg-config libsecret-1-dev libxss1 dbus xvfb libgtk-3-0
        sudo cp src/test/xvfb.init /etc/init.d/xvfb
        sudo chmod +x /etc/init.d/xvfb
        sudo update-rc.d xvfb defaults
        sudo service xvfb start
    - name: Cache yarn cache
      uses: actions/cache@v1
      with:
        path: ~/.cache/yarn
        key: ${{ runner.os }}-yarn-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
        restore-keys: |
          ${{ runner.os }}-yarn-
    - name: Install and build
      run: |
        yarn --frozen-lockfile
        yarn compile
      env:
        CI: true
    - name: Test
      uses: GabrielBB/xvfb-action@v1.2
      run: yarn test
    - name: Lint
      run: yarn lint

Use an action for xvfb
Use an action for xvfb
