From 24f3eaf2235ce687ef654be4d7f1a6db12ef26cf Mon Sep 17 00:00:00 2001 From: Colin Casey Date: Sun, 8 Sep 2024 19:45:00 -0300 Subject: [PATCH 1/8] Scheduled integration test with jsdom --- .github/workflows/ci.yaml | 82 ++++++++++++++++++ .github/workflows/integration.yaml | 131 +++++++++++++++-------------- 2 files changed, 151 insertions(+), 62 deletions(-) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..d253a0c5 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,82 @@ +name: CI + +on: + push: + branches: [master] + pull_request: + +permissions: + contents: read + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: npm + - name: Install dependencies + run: npm ci + - name: Run Linter + run: npm run eslint + - name: Run Formatter + run: npm run prettier + + test: + name: Test - ${{ matrix.node-version }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node-version: [latest, lts/*, lts/-1] + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Node.js (${{ matrix.node-version }}) + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: npm + - name: Install dependencies + run: npm ci + - name: Run tests + run: npm test + + api: + name: API & Doc Validation + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: npm + - name: Install dependencies + run: npm ci + - name: Build + run: npm run build + - name: Extract API + run: npm run api:extract + - name: Generate docs + run: npm run api:docs + - name: Ensure API and doc changes have been committed + run: | + git add --renormalize . + if (( "$(git diff HEAD --ignore-space-at-eol --ignore-cr-at-eol | wc -l)" != 0 )); then + cat << EOF >> $GITHUB_STEP_SUMMARY + ### Detected uncommitted changes + + \`\`\`shell + $(git diff HEAD) + \`\`\` + EOF + git diff HEAD + exit 1 + fi diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index d253a0c5..fa056f6d 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -1,82 +1,89 @@ name: CI on: - push: - branches: [master] - pull_request: + workflow_dispatch: + schedule: + - cron: '00 01 * * 1' # at 1:00 on mondays permissions: contents: read +defaults: + run: + # Setting an explicit bash shell ensures GitHub Actions enables pipefail mode too, + # rather than only error on exit (improving failure UX when pipes are used). See: + # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell + shell: bash + jobs: - lint: - name: Lint + integration-with-canvas: + name: Integration (jsdom + node-canvas) runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 + - uses: actions/checkout@v4 with: - node-version: lts/* - cache: npm - - name: Install dependencies - run: npm ci - - name: Run Linter - run: npm run eslint - - name: Run Formatter - run: npm run prettier - - test: - name: Test - ${{ matrix.node-version }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - node-version: [latest, lts/*, lts/-1] - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Node.js (${{ matrix.node-version }}) - uses: actions/setup-node@v4 + path: ./tough-cookie + - uses: actions/checkout@v4 with: - node-version: ${{ matrix.node-version }} + repository: git@github.com:jsdom/jsdom.git + path: ./jsdom + submodules: recursive + - uses: actions/setup-node@v4 + with: + node-version: lts/* cache: npm - - name: Install dependencies - run: npm ci + - name: Install required image manipulation packages with APT + run: sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev + - name: Build tough-cookie + id: package + run: | + npm ci + npm run build + echo "tough_cookie_tarball=$(npm pack)" >> "$GITHUB_OUTPUT" + - name: Setup HOSTS file for Web Platform Test server + run: ./test/web-platform-tests/tests/wpt make-hosts-file | sudo tee -a /etc/hosts + working-directory: ./jsdom + - name: Install jsdom dependencies + run: | + npm ci + npm uninstall tough-cookie + npm install ../tough-cookie/${{ steps.package.outputs.tough_cookie_tarball }} + npm install canvas + working-directory: ./jsdom - name: Run tests - run: npm test - - api: - name: API & Doc Validation + run: npm test -- --retries 1 + working-directory: ./jsdom + integration: + name: Integration (jsdom) runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 + - uses: actions/checkout@v4 + with: + path: ./tough-cookie + - uses: actions/checkout@v4 + with: + repository: git@github.com:jsdom/jsdom.git + path: ./jsdom + submodules: recursive + - uses: actions/setup-node@v4 with: node-version: lts/* cache: npm - - name: Install dependencies - run: npm ci - - name: Build - run: npm run build - - name: Extract API - run: npm run api:extract - - name: Generate docs - run: npm run api:docs - - name: Ensure API and doc changes have been committed + - name: Build tough-cookie + id: package run: | - git add --renormalize . - if (( "$(git diff HEAD --ignore-space-at-eol --ignore-cr-at-eol | wc -l)" != 0 )); then - cat << EOF >> $GITHUB_STEP_SUMMARY - ### Detected uncommitted changes - - \`\`\`shell - $(git diff HEAD) - \`\`\` - EOF - git diff HEAD - exit 1 - fi + npm ci + npm run build + echo "tough_cookie_tarball=$(npm pack)" >> "$GITHUB_OUTPUT" + - name: Setup HOSTS file for Web Platform Test server + run: ./test/web-platform-tests/tests/wpt make-hosts-file | sudo tee -a /etc/hosts + working-directory: ./jsdom + - name: Install jsdom dependencies + run: | + npm ci + npm uninstall tough-cookie + npm install ../tough-cookie/${{ steps.package.outputs.tough_cookie_tarball }} + working-directory: ./jsdom + - name: Run tests + run: npm run test -- --retries 1 + working-directory: ./jsdom From 943c61c77abc7c75735415db111a1c5878041e42 Mon Sep 17 00:00:00 2001 From: Colin Casey Date: Sun, 8 Sep 2024 19:46:19 -0300 Subject: [PATCH 2/8] Scheduled integration test with jsdom --- .github/workflows/integration.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index fa056f6d..25bdd17d 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -1,4 +1,4 @@ -name: CI +name: Integration on: workflow_dispatch: From 4d27387a82ca60c38940415649410d98399d7d50 Mon Sep 17 00:00:00 2001 From: Colin Casey Date: Sun, 8 Sep 2024 19:47:32 -0300 Subject: [PATCH 3/8] Scheduled integration test with jsdom --- .github/workflows/integration.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 25bdd17d..79943535 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -2,6 +2,7 @@ name: Integration on: workflow_dispatch: + pull_request: schedule: - cron: '00 01 * * 1' # at 1:00 on mondays From 275be84f9a0180f8835bd8c1930ea1500d402d4f Mon Sep 17 00:00:00 2001 From: Colin Casey Date: Sun, 8 Sep 2024 19:48:55 -0300 Subject: [PATCH 4/8] Scheduled integration test with jsdom --- .github/workflows/integration.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 79943535..bdf20eb5 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -26,7 +26,7 @@ jobs: path: ./tough-cookie - uses: actions/checkout@v4 with: - repository: git@github.com:jsdom/jsdom.git + repository: https://github.com/jsdom/jsdom.git path: ./jsdom submodules: recursive - uses: actions/setup-node@v4 From 31e68ec9ab71c0d7348793d1088934faa2260b34 Mon Sep 17 00:00:00 2001 From: Colin Casey Date: Sun, 8 Sep 2024 19:50:50 -0300 Subject: [PATCH 5/8] Scheduled integration test with jsdom --- .github/workflows/integration.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index bdf20eb5..3428376a 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -27,6 +27,7 @@ jobs: - uses: actions/checkout@v4 with: repository: https://github.com/jsdom/jsdom.git + ref: main path: ./jsdom submodules: recursive - uses: actions/setup-node@v4 From d9fb661a2f737391804cc246fa0ef33d5ef83406 Mon Sep 17 00:00:00 2001 From: Colin Casey Date: Sun, 8 Sep 2024 19:51:37 -0300 Subject: [PATCH 6/8] Scheduled integration test with jsdom --- .github/workflows/integration.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 3428376a..9d884d8a 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -26,7 +26,7 @@ jobs: path: ./tough-cookie - uses: actions/checkout@v4 with: - repository: https://github.com/jsdom/jsdom.git + repository: jsdom/jsdom ref: main path: ./jsdom submodules: recursive From 221e3f673098b0059207facbab2ede80a2d070ef Mon Sep 17 00:00:00 2001 From: Colin Casey Date: Sun, 8 Sep 2024 22:57:24 -0300 Subject: [PATCH 7/8] Scheduled integration test with jsdom --- .github/workflows/integration.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 9d884d8a..d0158b0c 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -33,7 +33,6 @@ jobs: - uses: actions/setup-node@v4 with: node-version: lts/* - cache: npm - name: Install required image manipulation packages with APT run: sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev - name: Build tough-cookie @@ -64,13 +63,13 @@ jobs: path: ./tough-cookie - uses: actions/checkout@v4 with: - repository: git@github.com:jsdom/jsdom.git + repository: jsdom/jsdom + ref: main path: ./jsdom submodules: recursive - uses: actions/setup-node@v4 with: node-version: lts/* - cache: npm - name: Build tough-cookie id: package run: | From 77c92898c854fffe3baea835d55e011ca58eff45 Mon Sep 17 00:00:00 2001 From: Colin Casey Date: Sun, 8 Sep 2024 22:59:27 -0300 Subject: [PATCH 8/8] Scheduled integration test with jsdom --- .github/workflows/integration.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index d0158b0c..4456bd16 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -41,6 +41,7 @@ jobs: npm ci npm run build echo "tough_cookie_tarball=$(npm pack)" >> "$GITHUB_OUTPUT" + working-directory: ./tough-cookie - name: Setup HOSTS file for Web Platform Test server run: ./test/web-platform-tests/tests/wpt make-hosts-file | sudo tee -a /etc/hosts working-directory: ./jsdom @@ -76,6 +77,7 @@ jobs: npm ci npm run build echo "tough_cookie_tarball=$(npm pack)" >> "$GITHUB_OUTPUT" + working-directory: ./tough-cookie - name: Setup HOSTS file for Web Platform Test server run: ./test/web-platform-tests/tests/wpt make-hosts-file | sudo tee -a /etc/hosts working-directory: ./jsdom