diff --git a/.github/actions/install-reqstool/action.yml b/.github/actions/install-reqstool/action.yml index b9a25dc..e699ec4 100644 --- a/.github/actions/install-reqstool/action.yml +++ b/.github/actions/install-reqstool/action.yml @@ -9,7 +9,7 @@ inputs: python-version: description: "Python version to use." required: false - default: "3.13" + default: "3.15" runs: using: "composite" diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 99103d8..536d407 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -118,14 +118,18 @@ // Version constraints // ===================================================== + // Tool-version policy (reqstool/.github#385): Python follows the latest + // release (no cap); Java and Node follow the latest LTS only. { - matchDepNames: ["python"], - allowedVersions: "<=3.13", + // Odd Node majors are never LTS. + matchDepNames: ["node"], + allowedVersions: "/^\\d*[02468]([.]|$)/", }, { + // Java LTS releases. Add the next LTS here when it ships (every 2 years). matchDepNames: ["java", "openjdk", "temurin"], - allowedVersions: "<=21", + allowedVersions: "/^(21|25|29)([.+]|$)/", }, { diff --git a/.github/workflows/common-reqstool-verify.yml b/.github/workflows/common-reqstool-verify.yml new file mode 100644 index 0000000..74f96e6 --- /dev/null +++ b/.github/workflows/common-reqstool-verify.yml @@ -0,0 +1,69 @@ +name: Verify (reqstool) + +# The reqstool gate shared by every repo: install reqstool from PyPI and from +# reqstool-client@main, then run `reqstool status` over the caller's checkout +# plus the build/ output (junit, coverage, annotations) produced by the build +# workflow. Replaces the identical tail of each repo's inline build job. + +on: + workflow_call: + inputs: + build-artifact: + description: "Name of the artifact holding the build/ output (see the build workflows' build-artifact-name)." + required: false + type: string + default: "dist-build" + build-directory: + description: "Directory the build artifact is extracted to, relative to repo root (build for Python/Gradle, target for Maven)." + required: false + type: string + default: "build" + reqstool-path: + description: "Path to the reqstool data directory, relative to repo root." + required: false + type: string + default: "docs/reqstool" + fail-if-incomplete: + description: "Fail unless every requirement is complete." + required: false + type: boolean + default: true + +permissions: + contents: read + +jobs: + verify: + name: verify + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + reqstool-source: [pypi, main] + steps: + - uses: actions/checkout@v7.0.1 + with: + persist-credentials: false + + - uses: actions/download-artifact@v8.0.2 + with: + name: ${{ inputs.build-artifact }} + path: ${{ inputs.build-directory }} + + # Composite actions of this repo are addressed by full path and pinned to a + # released SHA like any other caller (`./` would resolve against the caller's + # workspace); Renovate bumps them with every other reqstool/.github pin. + - uses: reqstool/.github/.github/actions/install-reqstool@6fc8d3e3d4c3fdf7a83cb7b7a274e4761486ca71 # 1.2.1 + with: + reqstool-source: ${{ matrix.reqstool-source }} + + # Not yet in the latest PyPI release; supplementary to the status gate. + - if: matrix.reqstool-source == 'main' + uses: reqstool/.github/.github/actions/validate-reqstool@6fc8d3e3d4c3fdf7a83cb7b7a274e4761486ca71 # 1.2.1 + with: + reqstool-path: ${{ inputs.reqstool-path }} + + - uses: reqstool/.github/.github/actions/reqstool-status@6fc8d3e3d4c3fdf7a83cb7b7a274e4761486ca71 # 1.2.1 + with: + reqstool-path: ${{ inputs.reqstool-path }} + fail-if-incomplete: ${{ inputs.fail-if-incomplete }} diff --git a/.github/workflows/java-build-gradle.yml b/.github/workflows/java-build-gradle.yml index 113e336..b563da7 100644 --- a/.github/workflows/java-build-gradle.yml +++ b/.github/workflows/java-build-gradle.yml @@ -9,10 +9,18 @@ on: type: string default: "." java-version: - description: "JDK version to use." + description: "JDK used for the build and the artifacts (the latest LTS)." required: false type: string - default: "21" + # renovate: datasource=java-version depName=java + default: "25" + java-versions: + description: > + JSON array of JDKs the test suite runs on, on Linux. One entry by policy + (latest LTS); adding a leg is a one-line change. + required: false + type: string + default: '["25"]' ref: description: "Branch, tag or SHA to build. Empty = the caller's ref." required: false @@ -26,20 +34,53 @@ on: required: false type: string default: "dist" + post-test-command: + description: > + Optional repo-specific bash command run after tests, before upload -- + e.g. self-applying the project's own annotation processor into + build/reqstool/annotations.yml. + required: false + type: string + default: "" permissions: contents: read jobs: - build: + test: + name: test (${{ matrix.java }}) runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + java: ${{ fromJSON(inputs.java-versions) }} defaults: run: working-directory: ${{ inputs.working-directory }} steps: # Full history and tags: the version is derived from git state by - # git-dyn-semver, so a shallow clone would build the wrong number rather - # than fail. + # git-dyn-semver, so a shallow clone would build the wrong number rather than fail. + - uses: actions/checkout@v7.0.1 + with: + persist-credentials: false + fetch-depth: 0 + fetch-tags: true + ref: ${{ inputs.ref || github.ref }} + + - uses: actions/setup-java@v6.3.0 + with: + java-version: ${{ matrix.java }} + distribution: temurin + + - run: ./gradlew --console=plain clean build + + build: + needs: test + runs-on: ubuntu-latest + defaults: + run: + working-directory: ${{ inputs.working-directory }} + steps: - uses: actions/checkout@v7.0.1 with: persist-credentials: false @@ -52,13 +93,27 @@ jobs: java-version: ${{ inputs.java-version }} distribution: temurin - - run: ./gradlew clean build + - name: Build and run tests + run: ./gradlew --console=plain clean build - name: Report the resolved version - run: ./gradlew printVersion -q + run: ./gradlew --console=plain printVersion -q + + - name: Run post-test command + if: ${{ inputs.post-test-command != '' }} + env: + POST_TEST_COMMAND: ${{ inputs.post-test-command }} + run: eval "$POST_TEST_COMMAND" - uses: actions/upload-artifact@v7.0.2 with: name: ${{ inputs.artifact-name }} - path: ${{ inputs.working-directory }}/build/libs/*.jar + path: | + ${{ inputs.working-directory }}/build/libs/*.jar if-no-files-found: ignore + + # build/ output (test reports, annotations, reqstool zip) for the reqstool verify job. + - uses: actions/upload-artifact@v7.0.2 + with: + name: ${{ inputs.artifact-name }}-build + path: ${{ inputs.working-directory }}/build/ diff --git a/.github/workflows/java-build-maven.yml b/.github/workflows/java-build-maven.yml index 4aeb846..43c438f 100644 --- a/.github/workflows/java-build-maven.yml +++ b/.github/workflows/java-build-maven.yml @@ -9,10 +9,18 @@ on: type: string default: "." java-version: - description: "JDK version to use." + description: "JDK used for the build and the artifacts (the latest LTS)." required: false type: string - default: "21" + # renovate: datasource=java-version depName=java + default: "25" + java-versions: + description: > + JSON array of JDKs the test suite runs on, on Linux. One entry by policy + (latest LTS); adding a leg is a one-line change. + required: false + type: string + default: '["25"]' ref: description: "Branch, tag or SHA to build. Empty = the caller's ref." required: false @@ -26,19 +34,53 @@ on: required: false type: string default: "dist" + post-test-command: + description: > + Optional repo-specific bash command run after tests, before upload -- + e.g. self-applying the project's own annotation processor into + target/reqstool/annotations.yml. + required: false + type: string + default: "" permissions: contents: read jobs: + test: + name: test (${{ matrix.java }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + java: ${{ fromJSON(inputs.java-versions) }} + defaults: + run: + working-directory: ${{ inputs.working-directory }} + steps: + # Full history and tags: the version is derived from git state by + # Nisse, so a shallow clone would build the wrong number rather than fail. + - uses: actions/checkout@v7.0.1 + with: + persist-credentials: false + fetch-depth: 0 + fetch-tags: true + ref: ${{ inputs.ref || github.ref }} + + - uses: actions/setup-java@v6.3.0 + with: + java-version: ${{ matrix.java }} + distribution: temurin + + - run: mvn --batch-mode clean verify + build: + needs: test runs-on: ubuntu-latest defaults: run: working-directory: ${{ inputs.working-directory }} steps: - # Full history and tags: the version is derived from git state by Nisse, - # so a shallow clone would build the wrong number rather than fail. - uses: actions/checkout@v7.0.1 with: persist-credentials: false @@ -51,11 +93,18 @@ jobs: java-version: ${{ inputs.java-version }} distribution: temurin - - run: mvn --batch-mode clean verify + - name: Build and run tests + run: mvn --batch-mode clean verify - name: Report the resolved version run: mvn --batch-mode help:evaluate -Dexpression=project.version -q -DforceStdout + - name: Run post-test command + if: ${{ inputs.post-test-command != '' }} + env: + POST_TEST_COMMAND: ${{ inputs.post-test-command }} + run: eval "$POST_TEST_COMMAND" + - uses: actions/upload-artifact@v7.0.2 with: name: ${{ inputs.artifact-name }} @@ -63,3 +112,9 @@ jobs: ${{ inputs.working-directory }}/target/*.jar ${{ inputs.working-directory }}/target/*.pom if-no-files-found: ignore + + # target/ output (test reports, annotations, reqstool zip) for the reqstool verify job. + - uses: actions/upload-artifact@v7.0.2 + with: + name: ${{ inputs.artifact-name }}-build + path: ${{ inputs.working-directory }}/target/ diff --git a/.github/workflows/java-lint.yml b/.github/workflows/java-lint.yml index 63f6575..5457d9c 100644 --- a/.github/workflows/java-lint.yml +++ b/.github/workflows/java-lint.yml @@ -7,22 +7,37 @@ on: description: "JDK version to use." required: false type: string - default: "21" + # renovate: datasource=java-version depName=java + default: "25" + build-tool: + description: "Build tool: maven or gradle." + required: false + type: string + default: "maven" permissions: contents: read jobs: - lint: + linting: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7.0.1 with: persist-credentials: false + # Version derivation (Nisse / git-dyn-semver) reads git state. + fetch-depth: 0 + fetch-tags: true - uses: actions/setup-java@v6.3.0 with: java-version: ${{ inputs.java-version }} distribution: temurin - - run: mvn clean validate + - name: Check formatting (Maven) + if: ${{ inputs.build-tool == 'maven' }} + run: mvn --batch-mode clean validate + + - name: Check formatting (Gradle) + if: ${{ inputs.build-tool == 'gradle' }} + run: ./gradlew --console=plain checkFormat diff --git a/.github/workflows/java-smoke.yml b/.github/workflows/java-smoke.yml new file mode 100644 index 0000000..24b146e --- /dev/null +++ b/.github/workflows/java-smoke.yml @@ -0,0 +1,56 @@ +name: Smoke (Java, any OS) + +# Runs a caller-supplied command (e.g. `mvn -B verify`, `./gradlew build`) on a +# matrix of operating systems against the caller's checkout, so path, line-ending +# and locale bugs that Linux cannot show surface. Java projects have no +# installable wheel equivalent, so the build itself is the smoke. + +on: + workflow_call: + inputs: + os: + description: "JSON array of runner labels." + required: false + type: string + default: '["windows-latest","macos-latest"]' + java-version: + description: "JDK version to use." + required: false + type: string + # renovate: datasource=java-version depName=java + default: "25" + command: + description: "bash command run from the repo root." + required: true + type: string + +permissions: + contents: read + +jobs: + smoke: + name: smoke + strategy: + fail-fast: false + matrix: + os: ${{ fromJSON(inputs.os) }} + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@v7.0.1 + with: + persist-credentials: false + fetch-depth: 0 + fetch-tags: true + + - uses: actions/setup-java@v6.3.0 + with: + java-version: ${{ inputs.java-version }} + distribution: temurin + + - name: Run command + env: + SMOKE_COMMAND: ${{ inputs.command }} + run: eval "$SMOKE_COMMAND" diff --git a/.github/workflows/python-build-hatch.yml b/.github/workflows/python-build-hatch.yml index a4eb166..17d55cf 100644 --- a/.github/workflows/python-build-hatch.yml +++ b/.github/workflows/python-build-hatch.yml @@ -9,10 +9,18 @@ on: type: string default: "." python-version: - description: "Python version to use." + description: "Python used for the build, coverage and dist (the latest release)." required: false type: string - default: "3.13" + # renovate: datasource=python-version depName=python + default: "3.15.2" + python-versions: + description: > + JSON array of Python minors the test suite runs on, on Linux. The single + place that defines the supported Python matrix for every reqstool repo. + required: false + type: string + default: '["3.13","3.14","3.15"]' coverage-source: description: "Package name passed to --cov=. Empty = run tests without coverage." required: false @@ -31,12 +39,51 @@ on: required: false type: string default: "dist" + post-test-command: + description: > + Optional repo-specific command run through hatch's dev env after tests + and build, before upload -- e.g. self-applying the project's own + annotation processor into build/reqstool/annotations.yml. + required: false + type: string + default: "" permissions: contents: read jobs: + test: + name: test (${{ matrix.python }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python: ${{ fromJSON(inputs.python-versions) }} + defaults: + run: + working-directory: ${{ inputs.working-directory }} + steps: + - uses: actions/checkout@v7.0.1 + with: + persist-credentials: false + fetch-depth: 0 + fetch-tags: true + ref: ${{ inputs.ref || github.ref }} + + - uses: actions/setup-python@v7.1.0 + with: + python-version: ${{ matrix.python }} + + # renovate: datasource=pypi depName=hatch + - run: pip install hatch==1.18.2 + + # Build first: e2e tests of plugins install the wheel/sdist from dist/. + - run: hatch build + + - run: hatch run dev:pytest + build: + needs: test runs-on: ubuntu-latest defaults: run: @@ -58,6 +105,10 @@ jobs: # renovate: datasource=pypi depName=hatch - run: pip install hatch==1.18.2 + # Build before the tests: e2e tests of plugins install the wheel/sdist from dist/. + - name: Build + run: hatch build + - name: Run tests (with coverage) if: ${{ inputs.coverage-source != '' }} env: @@ -72,10 +123,19 @@ jobs: if: ${{ inputs.coverage-source == '' }} run: hatch run dev:pytest --junitxml=build/junit.xml - - name: Build - run: hatch build + - name: Run post-test command + if: ${{ inputs.post-test-command != '' }} + env: + POST_TEST_COMMAND: ${{ inputs.post-test-command }} + run: eval "$POST_TEST_COMMAND" - uses: actions/upload-artifact@v7.0.2 with: name: ${{ inputs.artifact-name }} path: ${{ inputs.working-directory }}/dist/ + + # build/ output (junit, coverage, annotations) for the reqstool verify job. + - uses: actions/upload-artifact@v7.0.2 + with: + name: ${{ inputs.artifact-name }}-build + path: ${{ inputs.working-directory }}/build/ diff --git a/.github/workflows/python-build-poetry.yml b/.github/workflows/python-build-poetry.yml index 1941a63..22a41c9 100644 --- a/.github/workflows/python-build-poetry.yml +++ b/.github/workflows/python-build-poetry.yml @@ -9,15 +9,24 @@ on: type: string default: "." python-version: - description: "Python version to use." + description: "Python used for the build, coverage and dist (the latest release)." required: false type: string - default: "3.13" + # renovate: datasource=python-version depName=python + default: "3.15.2" + python-versions: + description: > + JSON array of Python minors the test suite runs on, on Linux. The single + place that defines the supported Python matrix for every reqstool repo. + required: false + type: string + default: '["3.13","3.14","3.15"]' poetry-version: description: "Poetry version to install." required: false type: string - default: "2.1.0" + # renovate: datasource=pypi depName=poetry + default: "2.5.1" coverage-source: description: "Package name passed to --cov=. Empty = run tests without coverage." required: false @@ -46,7 +55,47 @@ permissions: contents: read jobs: + test: + name: test (${{ matrix.python }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python: ${{ fromJSON(inputs.python-versions) }} + defaults: + run: + working-directory: ${{ inputs.working-directory }} + steps: + - uses: actions/checkout@v7.0.1 + with: + persist-credentials: false + fetch-depth: 0 + fetch-tags: true + ref: ${{ inputs.ref || github.ref }} + + - uses: actions/setup-python@v7.1.0 + with: + python-version: ${{ matrix.python }} + + - uses: snok/install-poetry@a783c322200f0519c7926aa6faa857c4e23e9263 # v1.4.2 + with: + version: ${{ inputs.poetry-version }} + virtualenvs-create: true + + - run: poetry self add "poetry-dynamic-versioning[plugin]" + + - run: poetry install --with dev + + - name: Build wheel and install as Poetry plugin + if: ${{ inputs.install-self-as-plugin }} + run: | + poetry build --format wheel + poetry self add "$PWD/$(find dist -name '*.whl' | sort | tail -1)" + + - run: poetry run pytest + build: + needs: test runs-on: ubuntu-latest defaults: run: @@ -78,7 +127,7 @@ jobs: if: ${{ inputs.install-self-as-plugin }} run: | poetry build --format wheel - poetry self add "$(find dist -name '*.whl' | sort | tail -1)" + poetry self add "$PWD/$(find dist -name '*.whl' | sort | tail -1)" - name: Run tests (with coverage) if: ${{ inputs.coverage-source != '' }} @@ -101,3 +150,9 @@ jobs: with: name: ${{ inputs.artifact-name }} path: ${{ inputs.working-directory }}/dist/ + + # build/ output (junit, coverage, annotations) for the reqstool verify job. + - uses: actions/upload-artifact@v7.0.2 + with: + name: ${{ inputs.artifact-name }}-build + path: ${{ inputs.working-directory }}/build/ diff --git a/.github/workflows/python-lint.yml b/.github/workflows/python-lint.yml index 1ad660d..7ddacf9 100644 --- a/.github/workflows/python-lint.yml +++ b/.github/workflows/python-lint.yml @@ -7,7 +7,8 @@ on: description: "Python version to use." required: false type: string - default: "3.13" + # renovate: datasource=python-version depName=python + default: "3.15.2" package-manager: description: "Package manager: hatch or poetry." required: false @@ -17,13 +18,14 @@ on: description: "Poetry version (only used when package-manager is poetry)." required: false type: string - default: "2.1.0" + # renovate: datasource=pypi depName=poetry + default: "2.5.1" permissions: contents: read jobs: - lint: + linting: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7.0.1 @@ -37,7 +39,8 @@ jobs: - name: Install hatch and lint if: ${{ inputs.package-manager == 'hatch' }} run: | - pip install hatch + # renovate: datasource=pypi depName=hatch + pip install hatch==1.18.2 hatch run dev:black --check --verbose src tests hatch run dev:flake8 diff --git a/.github/workflows/python-smoke.yml b/.github/workflows/python-smoke.yml new file mode 100644 index 0000000..174414a --- /dev/null +++ b/.github/workflows/python-smoke.yml @@ -0,0 +1,78 @@ +name: Smoke (Python wheel, any OS) + +# Installs the wheel produced by the Linux build job on a matrix of operating +# systems and runs a caller-supplied command against the caller's checkout. +# Deliberately does not use hatch: the point is to exercise the *installed* +# package the way a user gets it, and to keep hatch off Windows. + +on: + workflow_call: + inputs: + os: + description: "JSON array of runner labels." + required: false + type: string + default: '["windows-latest","macos-latest"]' + python-version: + description: > + Python version. Minor only: exact patch releases are not published for + every runner OS (3.13.18 exists for Linux, not for Windows/macOS). + required: false + type: string + default: "3.13" + dist-artifact: + description: "Name of the artifact holding the wheel (see python-build-hatch.yml artifact-name)." + required: false + type: string + default: "dist" + requirements: + description: "Extra pip requirements installed next to the wheel, space separated (e.g. pytest)." + required: false + type: string + default: "" + command: + description: "bash command run from the repo root after the wheel is installed." + required: true + type: string + +permissions: + contents: read + +jobs: + smoke: + name: smoke + strategy: + fail-fast: false + matrix: + os: ${{ fromJSON(inputs.os) }} + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@v7.0.1 + with: + persist-credentials: false + + - uses: actions/setup-python@v7.1.0 + with: + python-version: ${{ inputs.python-version }} + + - uses: actions/download-artifact@v8.0.2 + with: + name: ${{ inputs.dist-artifact }} + path: dist + + - name: Install wheel + env: + REQUIREMENTS: ${{ inputs.requirements }} + run: | + # Run from a directory without the source tree on sys.path is not + # needed: src-layout projects do not shadow the installed wheel. + # shellcheck disable=SC2086 + pip install dist/*.whl $REQUIREMENTS + + - name: Run command + env: + SMOKE_COMMAND: ${{ inputs.command }} + run: eval "$SMOKE_COMMAND" diff --git a/.github/workflows/typescript-build.yml b/.github/workflows/typescript-build.yml index b6c9b9b..a8006be 100644 --- a/.github/workflows/typescript-build.yml +++ b/.github/workflows/typescript-build.yml @@ -9,10 +9,18 @@ on: type: string default: "." node-version: - description: "Node.js version to use." + description: "Node.js used for the build and the artifacts (the latest LTS)." required: false type: string - default: "24" + # renovate: datasource=node-version depName=node + default: "26" + node-versions: + description: > + JSON array of Node.js versions the test suite runs on, on Linux. One entry + by policy (latest LTS); adding a leg is a one-line change. + required: false + type: string + default: '["26"]' use-xvfb: description: "Wrap test commands with xvfb-run (required for VS Code extension tests)." required: false @@ -43,6 +51,14 @@ on: required: false type: string default: "dist" + post-test-command: + description: > + Optional repo-specific bash command run after build and tests, before + upload -- e.g. e2e tests against dist/ and self-applying the project's + own tags processor into build/reqstool/annotations.yml. + required: false + type: string + default: "" version: description: "Stamp package.json with this version before building. Empty = leave as-is." required: false @@ -53,12 +69,61 @@ permissions: contents: read jobs: + test: + name: test (${{ matrix.node }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node: ${{ fromJSON(inputs.node-versions) }} + defaults: + run: + working-directory: ${{ inputs.working-directory }} + steps: + - uses: actions/checkout@v7.0.1 + with: + persist-credentials: false + fetch-depth: 0 + fetch-tags: true + ref: ${{ inputs.ref || github.ref }} + + - uses: actions/setup-node@v7.1.0 + with: + node-version: ${{ matrix.node }} + + - run: npm ci + + # The command is `eval`ed by design -- callers supply their own installer + # line. Read from the environment rather than interpolated into the script + # body so the value cannot terminate the surrounding shell construct. + - name: Install dependency + if: ${{ inputs.dependency-version != '' && inputs.dependency-install-command != '' }} + env: + INSTALL_COMMAND: ${{ inputs.dependency-install-command }} + DEP_VERSION: ${{ inputs.dependency-version }} + run: | + CMD="${INSTALL_COMMAND/\{version\}/$DEP_VERSION}" + eval "$CMD" + + - name: Run tests + if: ${{ !inputs.use-xvfb }} + run: npm run test + + - name: Run tests (headless display) + if: ${{ inputs.use-xvfb }} + run: | + xvfb-run --auto-servernum npm run test-with-report + xvfb-run --auto-servernum npm run test:ui + build: + needs: test runs-on: ubuntu-latest defaults: run: working-directory: ${{ inputs.working-directory }} steps: + # Full history and tags: the release flow derives the version from git state, + # so a shallow clone would build the wrong number rather than fail. - uses: actions/checkout@v7.0.1 with: persist-credentials: false @@ -82,9 +147,6 @@ jobs: VERSION: ${{ inputs.version }} run: npm version "$VERSION" --no-git-tag-version --allow-same-version - # The command is `eval`ed by design -- callers supply their own installer - # line. Read from the environment rather than interpolated into the script - # body so the value cannot terminate the surrounding shell construct. - name: Install dependency if: ${{ inputs.dependency-version != '' && inputs.dependency-install-command != '' }} env: @@ -94,6 +156,10 @@ jobs: CMD="${INSTALL_COMMAND/\{version\}/$DEP_VERSION}" eval "$CMD" + # Built before the tests so a post-test command (e2e against dist/, + # self-applied tags) can use the build output. + - run: npm run build + - name: Run tests if: ${{ !inputs.use-xvfb }} run: npm run test @@ -104,7 +170,11 @@ jobs: xvfb-run --auto-servernum npm run test-with-report xvfb-run --auto-servernum npm run test:ui - - run: npm run build + - name: Run post-test command + if: ${{ inputs.post-test-command != '' }} + env: + POST_TEST_COMMAND: ${{ inputs.post-test-command }} + run: eval "$POST_TEST_COMMAND" # A dist/ tree carries the version in no filename, which is what # common-release-assets.yml asserts against. `npm pack` is npm's analog of @@ -126,3 +196,10 @@ jobs: with: name: ${{ inputs.artifact-name }} path: ${{ inputs.working-directory }}/dist/ + + # build/ output (junit, coverage, annotations) for the reqstool verify job. + - uses: actions/upload-artifact@v7.0.2 + with: + name: ${{ inputs.artifact-name }}-build + path: ${{ inputs.working-directory }}/build/ + if-no-files-found: ignore diff --git a/.github/workflows/typescript-lint.yml b/.github/workflows/typescript-lint.yml index 19b0243..7b68b3a 100644 --- a/.github/workflows/typescript-lint.yml +++ b/.github/workflows/typescript-lint.yml @@ -7,7 +7,13 @@ on: description: "Node.js version to use." required: false type: string - default: "24" + # renovate: datasource=node-version depName=node + default: "26" + working-directory: + description: "Project root relative to repo root. Default '.' for repo-root projects." + required: false + type: string + default: "." permissions: contents: read @@ -15,6 +21,9 @@ permissions: jobs: lint: runs-on: ubuntu-latest + defaults: + run: + working-directory: ${{ inputs.working-directory }} steps: - uses: actions/checkout@v7.0.1 with: diff --git a/.github/workflows/typescript-smoke.yml b/.github/workflows/typescript-smoke.yml new file mode 100644 index 0000000..e4cf505 --- /dev/null +++ b/.github/workflows/typescript-smoke.yml @@ -0,0 +1,62 @@ +name: Smoke (TypeScript, any OS) + +# Runs a caller-supplied command (e.g. `npm test`) on a matrix of operating +# systems against the caller's checkout, so path, line-ending and encoding bugs +# that Linux cannot show surface. + +on: + workflow_call: + inputs: + os: + description: "JSON array of runner labels." + required: false + type: string + default: '["windows-latest","macos-latest"]' + node-version: + description: "Node.js version to use." + required: false + type: string + # renovate: datasource=node-version depName=node + default: "26" + working-directory: + description: "Project root relative to repo root. Default '.' for repo-root projects." + required: false + type: string + default: "." + command: + description: "bash command run from the working directory after `npm ci`." + required: true + type: string + +permissions: + contents: read + +jobs: + smoke: + name: smoke + strategy: + fail-fast: false + matrix: + os: ${{ fromJSON(inputs.os) }} + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + working-directory: ${{ inputs.working-directory }} + steps: + - uses: actions/checkout@v7.0.1 + with: + persist-credentials: false + fetch-depth: 0 + fetch-tags: true + + - uses: actions/setup-node@v7.1.0 + with: + node-version: ${{ inputs.node-version }} + + - run: npm ci + + - name: Run command + env: + SMOKE_COMMAND: ${{ inputs.command }} + run: eval "$SMOKE_COMMAND"