Skip to content

Commit

Permalink
chore: fix the ci (#5020)
Browse files Browse the repository at this point in the history
* chore: drop node 19, add node 20 and 21 to workflows

* update karma deps

* use 'moz:debuggerAdress'

* .

* debug

* .

* patch webdriverio

* fix lint

* improve ci
  • Loading branch information
Uzlopak committed Oct 31, 2023
1 parent 37deed2 commit f8f9fd5
Show file tree
Hide file tree
Showing 7 changed files with 1,157 additions and 809 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/browser-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,18 @@ jobs:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'run-browser-test')
steps:
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 16
- uses: actions/checkout@v3
node-version: lts/*
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false
- name: 'Cache node_modules'
uses: actions/cache@v3
with:
path: '~/.npm'
key: "ubuntu-latest-node-full-v16-${{ hashFiles('**/package-lock.json') }}"
restore-keys: |
ubuntu-latest-node-full-v16-
key: "ubuntu-latest-node-full-lts-${{ hashFiles('**/package-lock.json') }}"
- name: Install Dependencies
run: npm ci
- name: Run Browser Tests
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/delete-runs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
inputs:
days:
description: 'Number of days'
type: number
required: true
default: 180

Expand Down
88 changes: 65 additions & 23 deletions .github/workflows/mocha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ jobs:
- name: Check event pull_request
if: github.event_name == 'pull_request'
run: 'echo pull_request: run workflow'
- uses: actions/checkout@v3
- uses: actions/checkout@v4
if: github.event_name == 'push'
with:
persist-credentials: false
- name: Check event push
id: findPr
if: github.event_name == 'push'
Expand All @@ -45,10 +47,12 @@ jobs:
- 14
- 16
- 18
- 19
- 20
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: '${{ matrix.node }}'
- run: npm install --production
Expand All @@ -59,17 +63,17 @@ jobs:
runs-on: ubuntu-latest
needs: smoke
steps:
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 16
- uses: actions/checkout@v3
node-version: lts/*
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: 'Cache node_modules'
uses: actions/cache@v3
with:
path: '~/.npm'
key: "ubuntu-latest-node-v16-${{ hashFiles('**/package-lock.json') }}"
restore-keys: |
ubuntu-latest-node-v16-
key: "ubuntu-latest-node-lts-${{ hashFiles('**/package-lock.json') }}"
- name: Install Dependencies
run: npm ci --ignore-scripts
- name: 'Check lint'
Expand All @@ -90,17 +94,19 @@ jobs:
- 14
- 16
- 18
- 19
- 20
include:
- os: ubuntu-latest
node: 16
env:
COVERAGE: 1
steps:
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: '${{ matrix.node }}'
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Get npm cache directory in Windows
id: npm-cache
if: ${{ matrix.os == 'windows-2019' }}
Expand All @@ -111,8 +117,6 @@ jobs:
with:
path: ${{ matrix.os == 'ubuntu-latest' && '~/.npm' || steps.npm-cache.outputs.dir }}
key: "${{ matrix.os }}-node-v${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}"
restore-keys: |
${{ matrix.os }}-node-v${{ matrix.node }}-
- name: Install Dependencies
run: npm ci --ignore-scripts
- name: Install Annotation Support
Expand All @@ -133,31 +137,69 @@ jobs:
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'

test-browser:
name: 'Browser Tests'
test-browser-local:
name: Browser Test [ChromeHeadless]
needs: smoke
runs-on: ubuntu-latest
timeout-minutes: 20
# Don't run forked 'pull_request' without saucelabs token
if: github.event_name == 'push' || !github.event.pull_request.head.repo.fork
steps:
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: lts/*
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: 'Cache node_modules'
uses: actions/cache@v3
with:
path: '~/.npm'
# this key is different than above, since we are running scripts
# (builds, postinstall lifecycle hooks, etc.)
key: "ubuntu-latest-node-full-lts-${{ hashFiles('**/package-lock.json') }}"
- name: Install Dependencies
run: npm ci
- name: Run Browser Tests
run: npm start test.browser
env:
BROWSER: ChromeHeadless

test-browser-saucelabs:
name: Browser Tests on SauceLabs [${{ matrix.browser }}]
needs:
- smoke
- test-browser-local
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
browser:
- firefox@latest
- chrome@latest
- MicrosoftEdge@latest
- safari@latest
# Don't run forked 'pull_request' without saucelabs token
if: github.event_name == 'push' || !github.event.pull_request.head.repo.fork
steps:
- uses: actions/setup-node@v4
with:
node-version: lts/*
- uses: actions/checkout@v4
with:
node-version: 16
- uses: actions/checkout@v3
persist-credentials: false
- name: 'Cache node_modules'
uses: actions/cache@v3
with:
path: '~/.npm'
# this key is different than above, since we are running scripts
# (builds, postinstall lifecycle hooks, etc.)
key: "ubuntu-latest-node-full-v16-${{ hashFiles('**/package-lock.json') }}"
restore-keys: |
ubuntu-latest-node-full-v16-
key: "ubuntu-latest-node-full-lts-${{ hashFiles('**/package-lock.json') }}"
- name: Install Dependencies
run: npm ci
- name: Run Browser Tests
run: npm start test.browser
env:
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
BROWSER: ${{ matrix.browser }}
2 changes: 1 addition & 1 deletion .github/workflows/nightly-site-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Webhook Action
uses: joelwmale/webhook-action@1.0.0
uses: joelwmale/webhook-action@2.3.2
env:
data: ''
WEBHOOK_URL: ${{ secrets.NETLIFY_NIGHTLY_DEPLOY_URL }}
20 changes: 16 additions & 4 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const rollupPlugin = require('./scripts/karma-rollup-plugin');
const BASE_BUNDLE_DIR_PATH = path.join(__dirname, '.karma');
const env = process.env;
const hostname = os.hostname();
const BROWSER = env.BROWSER;

const SAUCE_BROWSER_PLATFORM_MAP = {
'chrome@latest': 'Windows 10',
Expand Down Expand Up @@ -90,8 +91,7 @@ module.exports = config => {
const buildId = `github-${env.GITHUB_RUN_ID}_${env.GITHUB_RUN_NUMBER}`;
bundleDirPath = path.join(BASE_BUNDLE_DIR_PATH, buildId);
sauceConfig = {
build: buildId,
geckodriverVersion: '0.30.0' // temporary workaround for firefox
build: buildId
};
} else {
console.error(`Local environment (${hostname}) detected`);
Expand Down Expand Up @@ -121,6 +121,13 @@ module.exports = config => {
files: [...cfg.files, {pattern: './mocha.js.map', included: false}]
};

if (BROWSER) {
cfg = {
...cfg,
browsers: [BROWSER]
};
}

config.set(cfg);
};

Expand Down Expand Up @@ -172,7 +179,7 @@ const addSauceTests = (cfg, sauceLabs) => {
const customLaunchers = sauceBrowsers.reduce((acc, sauceBrowser) => {
const platformName = SAUCE_BROWSER_PLATFORM_MAP[sauceBrowser];
const [browserName, browserVersion] = sauceBrowser.split('@');
return {
const result = {
...acc,
[sauceBrowser]: {
base: 'SauceLabs',
Expand All @@ -182,9 +189,13 @@ const addSauceTests = (cfg, sauceLabs) => {
'sauce:options': sauceLabs
}
};
if (browserName === 'firefox') {
result[sauceBrowser]['sauce:options']['moz:debuggerAddress'] = true;
}
return result;
}, {});

return {
const result = {
...cfg,
reporters: [...cfg.reporters, 'saucelabs'],
browsers: [...cfg.browsers, ...sauceBrowsers],
Expand All @@ -198,6 +209,7 @@ const addSauceTests = (cfg, sauceLabs) => {
captureTimeout: 120000,
browserNoActivityTimeout: 20000
};
return result;
}
return {...cfg};
};
Expand Down

0 comments on commit f8f9fd5

Please sign in to comment.