From 33eac8a8bcd5fca50eef1f29f7895b6f90efb095 Mon Sep 17 00:00:00 2001 From: EnixCoda Date: Sun, 21 Jun 2020 23:37:35 +0800 Subject: [PATCH] build: run test on GitHub Actions --- .github/workflows/{build.yml => ci.yml} | 28 ++++++++++++++++++------- jest-puppeteer.config.js | 1 + jest.config.js | 2 +- 3 files changed, 22 insertions(+), 9 deletions(-) rename .github/workflows/{build.yml => ci.yml} (76%) diff --git a/.github/workflows/build.yml b/.github/workflows/ci.yml similarity index 76% rename from .github/workflows/build.yml rename to .github/workflows/ci.yml index e178fd8..f7075e7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Build +name: CI on: push: @@ -13,12 +13,18 @@ on: - 'server/**' jobs: - build: + build-and-test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 + - name: Retrieve vscode icons + uses: actions/checkout@v2 + with: + repository: 'vscode-icons/vscode-icons' + path: 'vscode-icons' + - name: Get yarn cache directory path id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" @@ -32,13 +38,19 @@ jobs: restore-keys: | ${{ runner.os }}-yarn- - - name: Retrieve vscode icons - uses: actions/checkout@v2 - with: - repository: 'vscode-icons/vscode-icons' - path: 'vscode-icons' + - name: Install deps + env: + PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true + run: | + yarn - name: Build run: | - yarn make build + + - name: Test + uses: mujo-code/puppeteer-headful@master + env: + CI: 'true' + with: + args: yarn test diff --git a/jest-puppeteer.config.js b/jest-puppeteer.config.js index 69f33b6..15e31ae 100644 --- a/jest-puppeteer.config.js +++ b/jest-puppeteer.config.js @@ -4,6 +4,7 @@ const CRX_PATH = path.resolve(__dirname, 'dist') module.exports = { launch: { + executablePath: process.env.PUPPETEER_EXEC_PATH, // set by mujo-code/puppeteer-headful headless: false, // required for extensions args: [`--disable-extensions-except=${CRX_PATH}`, `--load-extension=${CRX_PATH}`], }, diff --git a/jest.config.js b/jest.config.js index 1871518..8967fa4 100644 --- a/jest.config.js +++ b/jest.config.js @@ -144,7 +144,7 @@ module.exports = { testMatch: ['**/__tests__/cases/*.ts?(x)', '**/?(*.)+(spec|test).ts?(x)'], // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped - testPathIgnorePatterns: ['/node_modules/', './*.d.ts'], + testPathIgnorePatterns: ['/node_modules/', '.d.ts$', '/vscode-icons/'], // The regexp pattern or array of patterns that Jest uses to detect test files // testRegex: [],