-
Notifications
You must be signed in to change notification settings - Fork 39
175 lines (158 loc) · 5.81 KB
/
Copy pathtest.yml
File metadata and controls
175 lines (158 loc) · 5.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
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"