Report a non-zero exit code if a test file has no tests
#1570
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| pull_request: | |
| jobs: | |
| codespell: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - run: sudo apt-get update && sudo apt-get install --yes codespell | |
| - uses: actions/checkout@v4 | |
| - run: codespell docs *.markdown | |
| test: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - os: ubuntu-22.04 | |
| type: native | |
| cc: gcc-14 | |
| cxx: g++-14 | |
| shell: sh | |
| - os: ubuntu-22.04-arm | |
| type: native | |
| cc: gcc-14 | |
| cxx: g++-14 | |
| shell: sh | |
| - os: ubuntu-latest | |
| type: container | |
| container: | |
| image: alpine:3.21 | |
| options: --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined | |
| cc: gcc | |
| cxx: g++ | |
| shell: sh | |
| - os: ubuntu-22.04-arm | |
| type: container | |
| container: | |
| image: alpine:3.21 | |
| options: --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined | |
| cc: gcc | |
| cxx: g++ | |
| shell: sh | |
| - os: macos-15-intel | |
| type: native | |
| cc: clang | |
| cxx: clang++ | |
| shell: sh | |
| - os: macos-15 | |
| type: native | |
| cc: clang | |
| cxx: clang++ | |
| shell: sh | |
| - os: windows-2022 | |
| type: native | |
| shell: pwsh | |
| - os: windows-2022 | |
| type: wsl-2 | |
| cc: gcc-14 | |
| cxx: g++-14 | |
| shell: wsl-bash {0} | |
| defaults: | |
| run: | |
| shell: ${{ matrix.platform.shell }} | |
| runs-on: ${{ matrix.platform.os }} | |
| container: ${{ matrix.platform.container }} | |
| env: | |
| CC: ${{ matrix.platform.cc }} | |
| CXX: ${{ matrix.platform.cxx }} | |
| WSLENV: CC:CXX | |
| steps: | |
| # See https://github.com/laverdet/alpine-arm64 | |
| # Required for JavaScript-based actions to work inside Alpine containers | |
| # on ARM64 runners | |
| - uses: laverdet/alpine-arm64@v1 | |
| if: matrix.platform.type == 'container' && runner.arch == 'ARM64' | |
| # See https://github.com/Vampire/setup-wsl | |
| - uses: Vampire/setup-wsl@v5 | |
| if: runner.os == 'windows' && matrix.platform.type == 'wsl-2' | |
| with: | |
| distribution: Ubuntu-24.04 | |
| additional-packages: cmake build-essential gcc-14 g++-14 shellcheck pipx zsh jq bindfs nodejs libcurl4 | |
| wsl-version: 2 | |
| - name: Install dependencies (Alpine) | |
| if: matrix.platform.type == 'container' | |
| run: | | |
| apk add --no-cache cmake make g++ linux-headers zsh bash jq shellcheck pipx git perl-utils ca-certificates nodejs libcurl | |
| apk add --no-cache --repository https://dl-cdn.alpinelinux.org/alpine/edge/main --repository https://dl-cdn.alpinelinux.org/alpine/edge/community --repository https://dl-cdn.alpinelinux.org/alpine/edge/testing fuse3 bindfs | |
| - name: Install pre-commit | |
| run: pipx install pre-commit | |
| - name: Surface pipx binaries to WSL | |
| run: | | |
| ln -s -v /root/.local/bin/pre-commit /usr/bin/pre-commit | |
| if: runner.os == 'windows' && matrix.platform.type == 'wsl-2' | |
| - uses: actions/checkout@v4 | |
| - run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
| if: matrix.platform.type == 'container' | |
| - name: Install dependencies (macOS) | |
| if: runner.os == 'macos' | |
| run: brew bundle | |
| env: | |
| HOMEBREW_NO_ANALYTICS: 1 | |
| HOMEBREW_NO_AUTO_UPDATE: 1 | |
| - name: Install dependencies (Linux) | |
| if: runner.os == 'linux' && matrix.platform.type == 'native' | |
| run: | | |
| sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test | |
| sudo apt-get update --yes | |
| sudo apt-get install --yes gcc-14 g++-14 zsh bindfs libcurl4 | |
| - run: cmake --version | |
| - name: Configure JSON Schema | |
| run: > | |
| cmake -S . -B ./build | |
| -DCMAKE_BUILD_TYPE:STRING=Release | |
| -DJSONSCHEMA_TESTS:BOOL=ON | |
| -DJSONSCHEMA_TESTS_CI:BOOL=ON | |
| -DJSONSCHEMA_DEVELOPMENT:BOOL=ON | |
| -DBUILD_SHARED_LIBS:BOOL=OFF | |
| -DCMAKE_COMPILE_WARNING_AS_ERROR:BOOL=ON | |
| - run: cmake --build ./build --config Release --target clang_format_test | |
| # TODO: As the downloaded `clang-format` binary won't run on Alpine | |
| if: matrix.platform.type != 'container' | |
| - run: cmake --build ./build --config Release --target shellcheck | |
| # Windows complains about the path lengths with `shellcheck` | |
| if: runner.os != 'windows' | |
| - run: cmake --build ./build --config Release --parallel 4 | |
| - run: > | |
| cmake --install ./build --prefix ./build/dist --config Release --verbose | |
| --component sourcemeta_jsonschema | |
| # Not every CTest version supports the --test-dir option. If such option | |
| # is not recognized, `ctest` will successfully exit finding no tests. | |
| # Better to be sure and `cd` all the time here. | |
| - run: cd ./build && ctest --build-config Release --output-on-failure --parallel | |
| - run: cpack --config build/CPackConfig.cmake -B build/out -C Release | |
| docker: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - run: docker build --tag jsonschema . | |
| - run: docker run --interactive --volume "$PWD:/schema" jsonschema | |
| - run: ./test/docker/help.sh | |
| - run: ./test/docker/bundle_fmt.sh | |
| npm: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - run: make npm-pack | |
| snap: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| image: [ ubuntu-24.04, ubuntu-24.04-arm ] | |
| runs-on: ${{ matrix.image }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: snapcore/action-build@v1 | |
| id: snapcraft | |
| - run: sudo snap install --dangerous --classic ${{ steps.snapcraft.outputs.snap }} | |
| - run: jsonschema version | |
| - run: mkdir "$PWD/build" | |
| - run: TMPDIR="$PWD/build" ./test/lint/fail_lint.sh jsonschema | |
| - run: TMPDIR="$PWD/build" ./test/bundle/pass_resolve_single.sh jsonschema | |
| - run: TMPDIR="$PWD/build" ./test/ci/pass_validate_http.sh jsonschema |