Skip to content

Commit ff0bac5

Browse files
committed
chore: add py311, drop py36, update deps
1 parent a8982e4 commit ff0bac5

File tree

7 files changed

+60
-76
lines changed

7 files changed

+60
-76
lines changed

.github/workflows/ci.yml

+46-52
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
name: "Continuous Integration"
2-
on: [push]
2+
on: [ push ]
33

44
jobs:
55
test:
66
name: "Test"
77
strategy:
88
matrix:
9-
os: [ubuntu-latest, macos-latest, windows-latest]
10-
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
9+
os: [ ubuntu-latest, macos-latest, windows-latest ]
10+
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11" ]
1111
runs-on: "${{ matrix.os }}"
1212
steps:
1313
# Check out the code
14-
- uses: "actions/checkout@v2"
14+
- uses: "actions/checkout@v3"
1515

1616
# We need node for some integration tests
17-
- uses: "actions/setup-node@v1"
17+
- uses: "actions/setup-node@v3"
1818

1919
# Install python
2020
- name: "Set up python"
21-
uses: "actions/setup-python@v2"
21+
uses: "actions/setup-python@v4"
2222
with:
2323
python-version: "${{ matrix.python-version }}"
2424

@@ -45,7 +45,7 @@ jobs:
4545
# Cache build dependencies
4646
- name: "Cache Build Fragments"
4747
id: "cache-build-fragments"
48-
uses: "actions/cache@v2"
48+
uses: "actions/cache@v3"
4949
with:
5050
path: |
5151
~/.cargo/registry
@@ -62,16 +62,16 @@ jobs:
6262
# Cache `cargo install` built binaries
6363
- name: "Cache Built Binaries"
6464
id: "cache-binaries"
65-
uses: "actions/cache@v2"
65+
uses: "actions/cache@v3"
6666
with:
6767
path: "~/.cargo/bin"
6868
# In theory, this should rebuild binaries once a month
6969
key: "${{ runner.os }}-cargo-binaries-${{steps.get-date.outputs.date}}"
7070

7171
- name: Install wasm-pack
72-
uses: jetli/wasm-pack-action@v0.3.0
72+
uses: jetli/wasm-pack-action@v0.4.0
7373
with:
74-
version: "v0.10.1"
74+
version: "v0.12.1"
7575

7676
- name: "Run Tests"
7777
if: "${{ !contains(runner.os, 'windows') }}"
@@ -104,13 +104,13 @@ jobs:
104104
runs-on: ubuntu-latest
105105
steps:
106106
# Check out the code
107-
- uses: "actions/checkout@v2"
107+
- uses: "actions/checkout@v3"
108108

109109
# Install python
110110
- name: "Set up python"
111-
uses: "actions/setup-python@v2"
111+
uses: "actions/setup-python@v4"
112112
with:
113-
python-version: "3.10"
113+
python-version: "3.11"
114114

115115
- name: "Get Python Path"
116116
id: get-py-path
@@ -135,7 +135,7 @@ jobs:
135135
# Cache build dependencies
136136
- name: "Cache Build Fragments"
137137
id: "cache-build-fragments"
138-
uses: "actions/cache@v2"
138+
uses: "actions/cache@v3"
139139
with:
140140
path: |
141141
~/.cargo/registry
@@ -148,24 +148,24 @@ jobs:
148148
# Cache `cargo install` built binaries
149149
- name: "Cache Built Binaries"
150150
id: "cache-binaries"
151-
uses: "actions/cache@v2"
151+
uses: "actions/cache@v3"
152152
with:
153153
path: "~/.cargo/bin"
154154
# In theory, this should rebuild binaries once a month
155155
key: "${{ runner.os }}-cargo-binaries-${{steps.get-date.outputs.date}}"
156156

157157
- name: Install wasm-pack
158-
uses: jetli/wasm-pack-action@v0.3.0
158+
uses: jetli/wasm-pack-action@v0.4.0
159159
with:
160-
version: "v0.10.1"
160+
version: "v0.12.1"
161161

162162
- name: "Build Rust/C Libraries"
163163
run: "make build"
164164

165165
- name: "Check Rust target content"
166166
run: ls target/release
167167

168-
- uses: "actions/upload-artifact@v2"
168+
- uses: "actions/upload-artifact@v3"
169169
name: "Upload Rust/C Libraries"
170170
with:
171171
path: target/release/libjsonlogic_rs.*
@@ -177,7 +177,7 @@ jobs:
177177
WINDOWS: "${{ contains(runner.os, 'windows') }}"
178178
PYTHON: ${{ steps.get-py-path.outputs.path }}
179179

180-
- uses: "actions/upload-artifact@v2"
180+
- uses: "actions/upload-artifact@v3"
181181
name: "Upload Python sdist"
182182
with:
183183
path: dist/*.tar.gz
@@ -186,7 +186,7 @@ jobs:
186186
- name: "Build WASM Node Package"
187187
run: "make build-wasm"
188188

189-
- uses: "actions/upload-artifact@v2"
189+
- uses: "actions/upload-artifact@v3"
190190
name: "Upload node package"
191191
with:
192192
path: js/
@@ -196,46 +196,41 @@ jobs:
196196
name: >
197197
Build Wheel
198198
(${{ matrix.platform.os }}, ${{ matrix.platform.name }}, ${{ matrix.py }})
199-
# needs: test
199+
# needs: test
200200
runs-on: ${{ matrix.platform.os }}
201201
strategy:
202202
fail-fast: false
203203
matrix:
204204
platform:
205-
- {os: ubuntu-latest, name: manylinux}
206-
- {os: ubuntu-latest, name: musllinux}
207-
- {os: macos-latest, name: macosx}
208-
- {os: windows-latest, name: win}
205+
- { os: ubuntu-latest, name: manylinux }
206+
- { os: ubuntu-latest, name: musllinux }
207+
- { os: macos-latest, name: macosx }
208+
- { os: windows-latest, name: win }
209209
py:
210-
- cp36
211-
- cp37
212-
- cp38
213-
- cp39
214-
- cp310
210+
- cp37
211+
- cp38
212+
- cp39
213+
- cp310
214+
- cp311
215215

216216
steps:
217-
- uses: actions/checkout@v2
218-
219-
- uses: actions/setup-python@v2
220-
name: Install Python
221-
with:
222-
python-version: '3.10'
217+
- uses: actions/checkout@v3
223218

224219
- name: Set up QEMU
225220
if: runner.os == 'Linux'
226-
uses: docker/setup-qemu-action@v1
221+
uses: docker/setup-qemu-action@v2
227222
with:
228223
platforms: all
229224

230225
- name: Build wheels
231-
uses: pypa/cibuildwheel@v2.3.1
226+
uses: pypa/cibuildwheel@v2.14.1
232227
env:
233228
# configure cibuildwheel to build native archs ('auto'), and some
234229
# emulated ones
235230
CIBW_ARCHS_LINUX: x86_64 aarch64
236231
# cross-compiling wheels for discrete architectures not working OOTB
237232
# see: https://github.com/PyO3/setuptools-rust/issues/206
238-
CIBW_ARCHS_MACOS: x86_64 universal2
233+
CIBW_ARCHS_MACOS: x86_64 universal2 arm64
239234
CIBW_ARCHS_WINDOWS: AMD64
240235
CIBW_BEFORE_ALL_LINUX: >
241236
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y
@@ -245,26 +240,25 @@ jobs:
245240
CIBW_BUILD: ${{ matrix.py }}-${{ matrix.platform.name }}_*
246241
CIBW_TEST_COMMAND: python {project}/tests/test_py.py
247242

248-
- uses: actions/upload-artifact@v2
243+
- uses: actions/upload-artifact@v3
249244
with:
250245
name: py-wheels
251246
path: ./wheelhouse/*.whl
252247

253248
distribute:
254249
name: "Distribute Cargo, WASM, and Python Sdist Packages"
255-
needs:
256-
["build", "build-wheels"]
250+
needs: [ "build", "build-wheels" ]
257251
runs-on: ubuntu-latest
258252
if: "${{ github.ref == 'refs/heads/master' }}"
259253
steps:
260254
# Check out the code
261-
- uses: "actions/checkout@v2"
255+
- uses: "actions/checkout@v3"
262256

263257
# Install python
264258
- name: "Set up python"
265-
uses: "actions/setup-python@v2"
259+
uses: "actions/setup-python@v4"
266260
with:
267-
python-version: "3.8"
261+
python-version: "3.11"
268262

269263
# Generate the lockfile
270264
- name: "Generate Cargo Lockfile"
@@ -309,7 +303,7 @@ jobs:
309303
run: |
310304
echo "${{ steps.cargo-version.outputs.new }}" > tmp-new-cargo-ver
311305
312-
- uses: "actions/upload-artifact@v2"
306+
- uses: "actions/upload-artifact@v3"
313307
with:
314308
path: "tmp-new-cargo-ver"
315309
name: "new-cargo"
@@ -377,7 +371,7 @@ jobs:
377371
owner: "${{ github.repository_owner }}",
378372
repo: "json-logic-rs",
379373
tag: "v${{ steps.get-version.outputs.version }}",
380-
message: "Vesrion ${{ steps.get-version.outputs.version }}",
374+
message: "Version ${{ steps.get-version.outputs.version }}",
381375
object: "${{ github.sha }}",
382376
type: "commit",
383377
tagger: {
@@ -388,21 +382,21 @@ jobs:
388382
389383
distribute-py-wheels:
390384
name: "Distribute Python Wheels"
391-
needs: ["distribute"]
385+
needs: [ "distribute" ]
392386
if: "${{ github.ref == 'refs/heads/master' }}"
393-
# needs: [build_wheels, build_sdist]
387+
# needs: [build_wheels, build_sdist]
394388
runs-on: ubuntu-latest
395389
# upload to PyPI on every tag starting with 'v'
396-
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
390+
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
397391
# alternatively, to publish when a GitHub Release is created, use the following rule:
398392
# if: github.event_name == 'release' && github.event.action == 'published'
399393
steps:
400-
- uses: actions/download-artifact@v2
394+
- uses: actions/download-artifact@v3
401395
with:
402396
name: py-wheels
403397
path: dist
404398

405-
- uses: pypa/gh-action-pypi-publish@v1.4.2
399+
- uses: pypa/gh-action-pypi-publish@v1
406400
with:
407401
user: __token__
408402
password: ${{ secrets.PYPI_TOKEN }}

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ license = "MIT"
99
name = "jsonlogic-rs"
1010
readme = "README.md"
1111
repository = "https://github.com/bestowinc/json-logic-rs"
12-
version = "0.2.3"
12+
version = "0.3.0"
1313

1414
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1515

@@ -42,7 +42,7 @@ version = "~0.2.62"
4242
[dependencies.cpython]
4343
features = ["extension-module"]
4444
optional = true
45-
version = "0.5"
45+
version = "0.7"
4646

4747
[dependencies.anyhow]
4848
optional = true

build-wheels.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ export PATH=/root/.cargo/bin:$PATH
1313

1414
mkdir -p build && rm -rf build/*
1515

16-
for PYBIN in /opt/python/{cp36-cp36m,cp37-cp37m,cp38-cp38,cp39-cp39,cp310-cp310}/bin; do
16+
for PYBIN in /opt/python/{cp37-cp37m,cp38-cp38,cp39-cp39,cp310-cp310,cp311-cp311}/bin; do
1717
export PYTHON_SYS_EXECUTABLE="$PYBIN/python"
1818

1919
"${PYBIN}/python" -m ensurepip
2020
# Note: please change both here and in the makefile if specifying a particular
2121
# version or removing the version pin.
22-
"${PYBIN}/python" -m pip install -U setuptools wheel setuptools-rust==0.10.6
22+
"${PYBIN}/python" -m pip install -U setuptools wheel setuptools-rust==1.6.0
2323
"${PYBIN}/python" setup.py bdist_wheel
2424
done
2525

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[build-system]
2-
requires = ["setuptools", "wheel", "setuptools-rust>=1.1.2"]
2+
requires = ["setuptools", "wheel", "setuptools-rust>=1.2.0"]
33

44
[tool.black]
55
line-length = 80
6-
target-version = ['py36']
6+
target-version = ['py37']

setup.py

+3-17
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def get_version():
2727
out, err = tuple(map(bytes.decode, proc.communicate()))
2828
if proc.returncode != 0:
2929
raise RuntimeError(f"Could not get Cargo package info: {err}")
30-
version = out.split(":")[-1]
30+
version = out.split("@")[-1]
3131
return version.strip()
3232

3333

@@ -51,34 +51,20 @@ def get_version():
5151
classifiers=[
5252
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers for all
5353
# available setup classifiers
54-
# "Development Status :: 1 - Planning",
55-
# 'Development Status :: 2 - Pre-Alpha',
56-
# "Development Status :: 3 - Alpha",
57-
# "Development Status :: 4 - Beta",
5854
'Development Status :: 5 - Production/Stable',
59-
# 'Development Status :: 6 - Mature',
60-
# 'Framework :: AsyncIO',
61-
# 'Framework :: Flask',
62-
# 'Framework :: Sphinx',
63-
# 'Environment :: Web Environment',
6455
"Intended Audience :: Developers",
65-
# 'Intended Audience :: End Users/Desktop',
66-
# 'Intended Audience :: Science/Research',
67-
# 'Intended Audience :: System Administrators',
68-
# 'License :: Other/Proprietary License',
69-
# 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
7056
"License :: OSI Approved :: MIT License",
71-
# "License :: OSI Approved :: Apache Software License",
7257
"Natural Language :: English",
7358
"Operating System :: POSIX :: Linux",
7459
"Operating System :: MacOS :: MacOS X",
7560
"Operating System :: Microsoft :: Windows",
7661
"Programming Language :: Python",
7762
"Programming Language :: Python :: 3 :: Only",
78-
"Programming Language :: Python :: 3.6",
7963
"Programming Language :: Python :: 3.7",
8064
"Programming Language :: Python :: 3.8",
8165
"Programming Language :: Python :: 3.9",
66+
"Programming Language :: Python :: 3.10",
67+
"Programming Language :: Python :: 3.11",
8268
"Programming Language :: Rust",
8369
# 'Programming Language :: Python :: Implementation :: PyPy',
8470
],

src/js_op.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ mod abstract_operations {
900900

901901
#[test]
902902
fn test_to_string_number() {
903-
assert_eq!(&to_string(&json!(1.0)), "1");
903+
assert_eq!(&to_string(&json!(1.0)), "1.0");
904904
assert_eq!(&to_string(&json!(1)), "1");
905905
}
906906

tests/data/tests.json

+4
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@
217217
[{"if":[true, "apple", true, "banana", false, "carrot", "date"]}, null, "apple"],
218218
[{"if":[true, "apple", true, "banana", true, "carrot", "date"]}, null, "apple"],
219219

220+
"Arrays with logic",
221+
[[1, {"var": "x"}, 3], {"x": 2}, [1, 2, 3]],
222+
[{"if": [{"var": "x"}, [{"var": "y"}], 99]}, {"x": true, "y": 42}, [42]],
223+
220224
"# Compound Tests",
221225
[ {"and":[{">":[3,1]},true]}, {}, true ],
222226
[ {"and":[{">":[3,1]},false]}, {}, false ],

0 commit comments

Comments
 (0)