diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..d52d92f --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,42 @@ +name: Run Checks + +on: + push: + branches: [ feature/v2 ] + pull_request: + branches: [ feature/v2 ] + +jobs: + check: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '16' + cache: 'npm' + + - name: Install Chrome dependencies + run: | + sudo apt-get install -qq chromium-browser xvfb > /dev/null + + - name: Install dependencies + run: | + npm install + npm install -g sass-lint + + - name: Run checks + env: + PUPPETEER_EXECUTABLE_PATH: /usr/bin/chromium-browser + PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 'true' + DISPLAY: ':99.0' + CI: 'true' + PUPPETEER_HEADLESS: 'true' + run: | + Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & + chmod +x bin/check + chmod +x bin/fastcheck + bin/check diff --git a/__test__/integration/integration.test.ts b/__test__/integration/integration.test.ts index 0ce772d..d92a049 100644 --- a/__test__/integration/integration.test.ts +++ b/__test__/integration/integration.test.ts @@ -20,12 +20,23 @@ const readProp = (query: string, prop: string, index = 0) => ( const setup = async () => { const extensionPath = path.join(__dirname, '../../dist'); + const isHeadless = process.env.PUPPETEER_HEADLESS?.toLowerCase() !== 'false'; + const isCI = process.env.CI === 'true'; + + const args = [ + `--disable-extensions-except=${extensionPath}`, + ...(isCI ? [ + '--no-sandbox', + '--disable-setuid-sandbox', + '--disable-dev-shm-usage', + '--disable-gpu', + ] : []), + ]; + browser = await puppeteer.launch({ - headless: false, + headless: isHeadless, ignoreHTTPSErrors: true, - args: [ - `--disable-extensions-except=${extensionPath}`, - ], + args, }); page = await browser.newPage();