Skip to content

Commit

Permalink
more test splits (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
romainmenke authored May 28, 2024
1 parent 5324a50 commit 58865c2
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 17 deletions.
24 changes: 13 additions & 11 deletions .github/workflows/test-polyfills-exhaustive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,18 @@ jobs:
max-parallel: 1
fail-fast: false
matrix:
browser: [ ie, android, chrome, edge, firefox, ios, safari ]
browser:
- ie
- android
- chrome/1 - 50
- chrome/51 - 100
- chrome/>= 101
- edge
- firefox/1 - 50
- firefox/51 - 100
- firefox/>= 101
- ios
- safari

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -44,18 +55,9 @@ jobs:
- run: npm run build
if: steps.cache-dist.outputs.cache-hit != 'true'

- run: echo "${{ matrix.browser }}" > $GITHUB_WORKSPACE/witness-${{ matrix.browser }}
- name: record ${{ matrix.browser }} witness
id: witness
uses: actions/cache@v4
with:
path: $GITHUB_WORKSPACE/witness-${{ matrix.browser }}
key: witness--weekly-tests--${{ matrix.browser }}--${{ env.commit-sha }}

- name: Test ${{ matrix.browser }}
run: node ./test/polyfills/server.js & node ./test/polyfills/remotetest.js
test-polyfill-combinations targeted director browser=${{ matrix.browser }}
if: steps.witness.outputs.cache-hit != 'true'
test-polyfill-combinations targeted director browser="${{ matrix.browser }}"
timeout-minutes: 30
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
Expand Down
17 changes: 14 additions & 3 deletions .github/workflows/test-polyfills.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,18 @@ jobs:
max-parallel: 1
fail-fast: false
matrix:
browser: [ ie, android, chrome, edge, firefox, ios, safari ]
browser:
- ie
- android
- chrome/1 - 50
- chrome/51 - 100
- chrome/>= 101
- edge
- firefox/1 - 50
- firefox/51 - 100
- firefox/>= 101
- ios
- safari
steps:

- name: Branch based PR checkout
Expand Down Expand Up @@ -46,14 +57,14 @@ jobs:
uses: actions/cache@v4
with:
path: polyfills/__dist
key: cache--dist--${{ env.commit-sha }}
key: cache--dist--${{ env.GITHUB_SHA }}

- run: npm run build
if: steps.cache-dist.outputs.cache-hit != 'true'

- name: Test ${{ matrix.browser }}
run: node ./test/polyfills/server.js & node ./test/polyfills/remotetest.js
test-modified-only targeted director browser=${{ matrix.browser }}
test-modified-only targeted director browser="${{ matrix.browser }}"
timeout-minutes: 30
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
Expand Down
29 changes: 26 additions & 3 deletions test/polyfills/remotetest.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const { URL } = require('node:url');

// Grab all the browsers from BrowserStack which are officially supported by the polyfill service.
const TOML = require("@iarna/toml");
const semver = require("semver");

main();

Expand All @@ -42,14 +43,36 @@ async function main() {
fs.readFileSync(path.join(__dirname, "./browserstackBrowsers.toml"), "utf-8")
).browsers;

const browser = (process.argv
const [browser, browserVersionRanges] = (process.argv
.find(a => {
return a.startsWith("browser=");
}) || "")
.replace("browser=", "");
.replace("browser=", "")
.split("/");

console.log({ browser, browserVersionRanges });

const browsers = browserlist
.filter(b => {
return browser ? b.startsWith(browser) : true;
if (!browser) {
return true;
}

if (!b.startsWith(browser)) {
return false;
}

if (!browserVersionRanges) {
return true;
}

return semver.satisfies(
semver.coerce(b.split("/")[1]),
browserVersionRanges,
{

}
);
})
.filter(uaString => {
if (uaString.startsWith("ios/")) {
Expand Down

0 comments on commit 58865c2

Please sign in to comment.