From bb74281dd4887baa1804d5c3f52350ad82ded55d Mon Sep 17 00:00:00 2001 From: Vesa Laakso <482561+valscion@users.noreply.github.com> Date: Wed, 2 Dec 2020 09:30:42 +0200 Subject: [PATCH 1/6] Setup GitHub actions to run tests and lint --- .github/workflows/main.yml | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..2756ce71 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,45 @@ +name: main +on: [push, pull_request] +jobs: + build-and-test: + strategy: + matrix: + node: + - '10' + - '12' + - '14' + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v2 + + - name: Setup node + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} + + - name: Download deps + uses: bahmutov/npm-install@v1 + + - name: Build sources + run: npm run build + + - name: Run tests + run: npm run test + + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v2 + + - name: Setup node + uses: actions/setup-node@v1 + with: + node-version: '14.x' + + - name: Download deps + uses: bahmutov/npm-install@v1 + + - name: Run lint + run: npm run lint From 6c46baddbf7e5f0b1e25e1f6ee150ea466cee9a1 Mon Sep 17 00:00:00 2001 From: Vesa Laakso <482561+valscion@users.noreply.github.com> Date: Wed, 2 Dec 2020 09:35:05 +0200 Subject: [PATCH 2/6] Run tests with gabrielbb/xvfb-action --- .github/workflows/main.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2756ce71..769aea9a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,8 +24,10 @@ jobs: - name: Build sources run: npm run build - - name: Run tests - run: npm run test + - name: Run tests with xvfb available + uses: GabrielBB/xvfb-action@v1 + with: + run: npm run test lint: runs-on: ubuntu-latest From 1adc58fc00f766e0d04f0c635f156ec37324aa11 Mon Sep 17 00:00:00 2001 From: Vesa Laakso <482561+valscion@users.noreply.github.com> Date: Wed, 2 Dec 2020 09:39:08 +0200 Subject: [PATCH 3/6] Only trigger GitHub actions on direct pushes to master Otherwise the actions are ran only when a pull request is open. --- .github/workflows/main.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 769aea9a..16641978 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,9 @@ name: main -on: [push, pull_request] +on: + push: + branches: + - master + pull_request: jobs: build-and-test: strategy: From 6e6c3e8a679de983217589a873949cf8e0522632 Mon Sep 17 00:00:00 2001 From: Vesa Laakso <482561+valscion@users.noreply.github.com> Date: Wed, 2 Dec 2020 09:43:52 +0200 Subject: [PATCH 4/6] Remove Travis CI --- .travis.yml | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index eb808fe0..00000000 --- a/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -language: node_js -sudo: false -branches: - only: - - master -node_js: - - "10" - - "12" - - "14" - - "node" -addons: - apt: - packages: - # Required by Electron - # https://github.com/juliangruber/electron-stream#travis - - xvfb - # Required by Chrome >42 - # https://github.com/electron/electron/issues/1518#issuecomment-97708181 - - libgconf-2-4 -install: - # Required by Electron - - export DISPLAY=':99.0' - - Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & - - npm i -g npm - - npm ci -before_script: - # Building sources - - npm run build -script: - - npm run lint - - npm run test From fdb5a0e08b102ca1e1519d2995a35a3b84c4758b Mon Sep 17 00:00:00 2001 From: Vesa Laakso <482561+valscion@users.noreply.github.com> Date: Thu, 3 Dec 2020 09:30:56 +0200 Subject: [PATCH 5/6] Add custom name for build-and-test --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 16641978..45239ac4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,6 +13,7 @@ jobs: - '12' - '14' runs-on: ubuntu-latest + name: Tests on node ${{ matrix.node }} steps: - name: Checkout repo uses: actions/checkout@v2 From d701153def40a22502bcdb3d39c0f0b1a41a0131 Mon Sep 17 00:00:00 2001 From: Vesa Laakso <482561+valscion@users.noreply.github.com> Date: Thu, 3 Dec 2020 14:28:22 +0200 Subject: [PATCH 6/6] Use Node.js as name Co-authored-by: Yuriy Grunin --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 45239ac4..5944e2ec 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,7 +13,7 @@ jobs: - '12' - '14' runs-on: ubuntu-latest - name: Tests on node ${{ matrix.node }} + name: Tests on Node.js v${{ matrix.node }} steps: - name: Checkout repo uses: actions/checkout@v2