Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ekalinin/sitemap.js
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 476ae7c37008324d42bf3009494ef78d5225e998
Choose a base ref
..
head repository: ekalinin/sitemap.js
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5394af20438c732c3f56230b5a443f618087f75c
Choose a head ref
Showing with 609 additions and 63 deletions.
  1. +34 −0 .github/actions/configure-nodejs/action.yml
  2. +18 −5 .github/workflows/nodejs.yml
  3. +214 −54 lib/sitemap-index-stream.ts
  4. +343 −4 tests/sitemap-index.test.ts
34 changes: 34 additions & 0 deletions .github/actions/configure-nodejs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 'Configure Node.js'
description: 'Install Node.js and install Node.js modules or restore cache'

inputs:
node-version:
description: 'NodeJS Version'
default: '18'
lookup-only:
description: 'If true, only checks if cache entry exists and skips download. Does not change save cache behavior. Does not install node on a hit (used primarily for install deps jobs).'
default: 'false'

runs:
using: 'composite'
steps:
- name: Restore Node Modules from Cache
id: cache-node-modules
uses: actions/cache@v4
with:
path: |
node_modules
packages/**/node_modules
!node_modules/.cache
key: node-modules-v2-${{ inputs.node-version }}-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package.json', 'package-lock.json') }}
lookup-only: ${{ inputs.lookup-only }}

- uses: actions/setup-node@v4
if: inputs.lookup-only == 'false' || steps.cache-node-modules.outputs.cache-hit != 'true'
with:
node-version: ${{ inputs.node-version }}

- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
shell: bash
run: npm ci
23 changes: 18 additions & 5 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -3,18 +3,31 @@ name: Node CI
on: [push, pull_request]

jobs:
build:
# We do not strictly need an install-deps job
# because we do not kick of multiple jobs in parallel
# that would all try to install deps when the key changes.
# Skipping this saves a few seconds until the point where we need it.
# install-deps:
# runs-on: ubuntu-latest
# strategy:
# matrix:
# node-version: [12.x, 14.x, 16.x]
# steps:
# - uses: actions/checkout@v4
# - uses: ./.github/actions/configure-nodejs
# with:
# node-version: ${{ matrix.node-version }}
# lookup-only: 'true' # We only want to lookup from the cache - if a hit, this job does nothing

build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x, 18.x, 20.x]

steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: ./.github/actions/configure-nodejs
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
Loading