fix: Sdist Python packaging
* chore: Move Python bindings to `bindings` * chore: Move `jsonschema` into a separate directory * chore: Move submodule * ci: Fix the `coverage` job * chore: Move submodule * test: Disable some failing optional tests * ci: Add tests for installing Python sdist * fix: Sdist Python packaging * chore: Remove coverage job It doesn't support such project structure Ref: https://github.com/actions-rs/grcov/issues/50
This commit is contained in:
parent
6d770d0714
commit
f5be9508d0
|
@ -31,7 +31,7 @@ jobs:
|
||||||
|
|
||||||
- run: pip install pre-commit
|
- run: pip install pre-commit
|
||||||
- run: pre-commit run --all-files
|
- run: pre-commit run --all-files
|
||||||
working-directory: ./python
|
working-directory: ./bindings/python
|
||||||
|
|
||||||
test-stable:
|
test-stable:
|
||||||
strategy:
|
strategy:
|
||||||
|
@ -51,41 +51,8 @@ jobs:
|
||||||
profile: minimal
|
profile: minimal
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
override: true
|
override: true
|
||||||
- uses: actions-rs/cargo@v1
|
- run: cargo test --no-fail-fast
|
||||||
with:
|
working-directory: ./jsonschema
|
||||||
command: test
|
|
||||||
args: --no-fail-fast
|
|
||||||
|
|
||||||
coverage:
|
|
||||||
name: Test + Coverage (nightly)
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
submodules: true
|
|
||||||
- uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: nightly
|
|
||||||
override: true
|
|
||||||
- uses: actions-rs/cargo@v1
|
|
||||||
with:
|
|
||||||
command: clean
|
|
||||||
- uses: actions-rs/cargo@v1
|
|
||||||
with:
|
|
||||||
command: test
|
|
||||||
args: --no-fail-fast
|
|
||||||
env:
|
|
||||||
CARGO_INCREMENTAL: '0'
|
|
||||||
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
|
|
||||||
RUSTDOCFLAGS: '-Cpanic=abort'
|
|
||||||
- id: coverage
|
|
||||||
uses: actions-rs/grcov@v0.1
|
|
||||||
- name: Upload coverage to Codecov
|
|
||||||
uses: codecov/codecov-action@v1.0.15
|
|
||||||
if: ${{ env.GITHUB_REPOSITORY }} == 'Stranger6667/jsonschema-rs'
|
|
||||||
with:
|
|
||||||
name: coverage
|
|
||||||
file: ${{ steps.coverage.outputs.report }}
|
|
||||||
|
|
||||||
test-python:
|
test-python:
|
||||||
strategy:
|
strategy:
|
||||||
|
@ -106,7 +73,7 @@ jobs:
|
||||||
architecture: x64
|
architecture: x64
|
||||||
|
|
||||||
- run: python -m pip install tox
|
- run: python -m pip install tox
|
||||||
working-directory: ./python
|
working-directory: ./bindings/python
|
||||||
|
|
||||||
- uses: actions-rs/toolchain@v1
|
- uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
|
@ -115,7 +82,35 @@ jobs:
|
||||||
|
|
||||||
- name: Run ${{ matrix.python }} tox job
|
- name: Run ${{ matrix.python }} tox job
|
||||||
run: tox -e py
|
run: tox -e py
|
||||||
working-directory: ./python
|
working-directory: ./bindings/python
|
||||||
|
|
||||||
|
test-python-sdist:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Testing Python source code distribution
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
submodules: true
|
||||||
|
- uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: '3.8'
|
||||||
|
architecture: x64
|
||||||
|
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
|
||||||
|
- run: python -m pip install tox
|
||||||
|
working-directory: ./bindings/python
|
||||||
|
|
||||||
|
- run: tox -e build-sdist
|
||||||
|
working-directory: ./bindings/python
|
||||||
|
|
||||||
|
- name: Installing sdist
|
||||||
|
run: pip install dist/*
|
||||||
|
working-directory: ./bindings/python
|
||||||
|
|
||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
name: Rustfmt
|
name: Rustfmt
|
||||||
|
@ -128,10 +123,8 @@ jobs:
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
override: true
|
override: true
|
||||||
components: rustfmt
|
components: rustfmt
|
||||||
- uses: actions-rs/cargo@v1
|
- run: cargo fmt --all -- --check
|
||||||
with:
|
working-directory: ./jsonschema
|
||||||
command: fmt
|
|
||||||
args: --all -- --check
|
|
||||||
|
|
||||||
clippy:
|
clippy:
|
||||||
name: Clippy
|
name: Clippy
|
||||||
|
@ -146,7 +139,5 @@ jobs:
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
override: true
|
override: true
|
||||||
components: clippy
|
components: clippy
|
||||||
- uses: actions-rs/clippy-check@v1
|
- run: cargo clippy --all-targets --all-features -- -D warnings
|
||||||
with:
|
working-directory: ./jsonschema
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
args: --all-targets --all-features -- -D warnings
|
|
||||||
|
|
|
@ -34,12 +34,12 @@ jobs:
|
||||||
- name: Install Tox
|
- name: Install Tox
|
||||||
run: pip install tox
|
run: pip install tox
|
||||||
- name: Build wheel
|
- name: Build wheel
|
||||||
working-directory: ./python
|
working-directory: ./bindings/python
|
||||||
run: tox -e build-wheel
|
run: tox -e build-wheel
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: Distribution Artifacts
|
name: Distribution Artifacts
|
||||||
path: python/dist/
|
path: bindings/python/dist/
|
||||||
|
|
||||||
create_wheels_manylinux:
|
create_wheels_manylinux:
|
||||||
name: Wheels for Python ${{ matrix.PYTHON_IMPLEMENTATION_ABI }} / Linux
|
name: Wheels for Python ${{ matrix.PYTHON_IMPLEMENTATION_ABI }} / Linux
|
||||||
|
@ -78,7 +78,7 @@ jobs:
|
||||||
- name: Install Tox
|
- name: Install Tox
|
||||||
run: ${{ env.PYTHON_SYS_EXECUTABLE }} -m pip install tox
|
run: ${{ env.PYTHON_SYS_EXECUTABLE }} -m pip install tox
|
||||||
- name: Build wheel
|
- name: Build wheel
|
||||||
working-directory: ./python
|
working-directory: ./bindings/python
|
||||||
run: |
|
run: |
|
||||||
${{ env.PYTHON_SYS_EXECUTABLE }} -m tox -e build-wheel
|
${{ env.PYTHON_SYS_EXECUTABLE }} -m tox -e build-wheel
|
||||||
# Ensure that the wheel is tagged as manylinux2014 platform
|
# Ensure that the wheel is tagged as manylinux2014 platform
|
||||||
|
@ -92,7 +92,7 @@ jobs:
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: Distribution Artifacts
|
name: Distribution Artifacts
|
||||||
path: python/dist/
|
path: bindings/python/dist/
|
||||||
|
|
||||||
create_source_dist:
|
create_source_dist:
|
||||||
name: Create sdist package
|
name: Create sdist package
|
||||||
|
@ -110,12 +110,12 @@ jobs:
|
||||||
- name: Install Tox
|
- name: Install Tox
|
||||||
run: pip install tox
|
run: pip install tox
|
||||||
- name: Build sdist
|
- name: Build sdist
|
||||||
working-directory: ./python
|
working-directory: ./bindings/python
|
||||||
run: tox -e build-sdist
|
run: tox -e build-sdist
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: Distribution Artifacts
|
name: Distribution Artifacts
|
||||||
path: python/dist/
|
path: bindings/python/dist/
|
||||||
|
|
||||||
upload_to_pypi:
|
upload_to_pypi:
|
||||||
needs:
|
needs:
|
||||||
|
@ -128,7 +128,7 @@ jobs:
|
||||||
- uses: actions/download-artifact@v2
|
- uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: Distribution Artifacts
|
name: Distribution Artifacts
|
||||||
path: python/dist/
|
path: bindings/python/dist/
|
||||||
- name: Publish distribution package to PyPI
|
- name: Publish distribution package to PyPI
|
||||||
uses: pypa/gh-action-pypi-publish@v1.2.2
|
uses: pypa/gh-action-pypi-publish@v1.2.2
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
# Rust
|
# Rust
|
||||||
/target
|
/jsonschema/target
|
||||||
/Cargo.lock
|
/bindings/*/target
|
||||||
|
.hypothesis
|
||||||
|
.benchmarks
|
||||||
|
/jsonschema/Cargo.lock
|
||||||
|
|
||||||
# IDEs
|
# IDEs
|
||||||
/.idea
|
/.idea
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
[submodule "tests/suite"]
|
[submodule "jsonschema/tests/suite"]
|
||||||
path = tests/suite
|
path = jsonschema/tests/suite
|
||||||
url = https://github.com/json-schema-org/JSON-Schema-Test-Suite.git
|
url = git@github.com:json-schema-org/JSON-Schema-Test-Suite.git
|
||||||
|
|
|
@ -10,9 +10,9 @@ A JSON Schema validator implementation. It compiles schema into a validation tre
|
||||||
|
|
||||||
Supported drafts:
|
Supported drafts:
|
||||||
|
|
||||||
- Draft 7 (except optional `idn-hostname.json` test cases)
|
- Draft 7 (except optional `idn-hostname.json`, `float_overflow.json` and `format_email.json` test cases)
|
||||||
- Draft 6
|
- Draft 6 (except optional `float_overflow.json` and `format_email.json` test cases)
|
||||||
- Draft 4 (except optional `bignum.json` test cases)
|
- Draft 4 (except optional `bignum.json`, `float_overflow.json` and `format_email.json` test cases)
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
# Cargo.toml
|
# Cargo.toml
|
||||||
|
|
|
@ -9,6 +9,9 @@
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Not necessary network requests for schemas with `$id` values with trailing `#` symbol. [#163](https://github.com/Stranger6667/jsonschema-rs/issues/163)
|
- Not necessary network requests for schemas with `$id` values with trailing `#` symbol. [#163](https://github.com/Stranger6667/jsonschema-rs/issues/163)
|
||||||
|
- Source code distribution. It was missing the source code for the underlying Rust crate and were leading to
|
||||||
|
a build error during `pip install css-inline` on platforms that we don't have wheels for.
|
||||||
|
[#159](https://github.com/Stranger6667/jsonschema-rs/issues/159)
|
||||||
|
|
||||||
### Performance
|
### Performance
|
||||||
|
|
|
@ -12,10 +12,15 @@ crate-type = ["cdylib"]
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
built = { version = "0.4", features = ["chrono"] }
|
built = { version = "0.4", features = ["chrono"] }
|
||||||
|
|
||||||
|
[dependencies.jsonschema]
|
||||||
|
path = "../../jsonschema"
|
||||||
|
version = "*"
|
||||||
|
default-features = false
|
||||||
|
features = ["reqwest"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
serde_json = "1"
|
serde_json = "1"
|
||||||
serde = "1"
|
serde = "1"
|
||||||
jsonschema = { path = "../", version = "*" , default-features = false, features = ["reqwest"] }
|
|
||||||
pyo3 = { version = "^0.12", features = ["extension-module"] }
|
pyo3 = { version = "^0.12", features = ["extension-module"] }
|
||||||
pyo3-built = "0.4"
|
pyo3-built = "0.4"
|
||||||
|
|
|
@ -3,3 +3,5 @@ include build.rs
|
||||||
include pyproject.toml
|
include pyproject.toml
|
||||||
include rust-toolchain
|
include rust-toolchain
|
||||||
recursive-include src *
|
recursive-include src *
|
||||||
|
recursive-include jsonschema-lib *
|
||||||
|
recursive-exclude jsonschema-lib/target *
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
# Create a symlink for jsonschema
|
||||||
|
ln -sf ../../jsonschema jsonschema-lib
|
||||||
|
# Modify Cargo.toml to include this symlink
|
||||||
|
cp Cargo.toml Cargo.toml.orig
|
||||||
|
sed -i 's/\.\.\/\.\.\/jsonschema/\.\/jsonschema-lib/' Cargo.toml
|
||||||
|
# Build the source distribution
|
||||||
|
python setup.py sdist
|
||||||
|
rm jsonschema-lib
|
||||||
|
mv Cargo.toml.orig Cargo.toml
|
|
@ -19,7 +19,7 @@ commands =
|
||||||
deps =
|
deps =
|
||||||
setuptools-rust
|
setuptools-rust
|
||||||
commands =
|
commands =
|
||||||
python setup.py sdist
|
./build-sdist.sh
|
||||||
|
|
||||||
[testenv:build-wheel]
|
[testenv:build-wheel]
|
||||||
passenv =
|
passenv =
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 8daea3f47e52526518cc2e88ef5d25d8a7070e3c
|
|
@ -1,10 +1,12 @@
|
||||||
use json_schema_test_suite::{json_schema_test_suite, TestCase};
|
use json_schema_test_suite::{json_schema_test_suite, TestCase};
|
||||||
use jsonschema::{Draft, JSONSchema};
|
use jsonschema::{Draft, JSONSchema};
|
||||||
|
|
||||||
#[json_schema_test_suite("tests/suite", "draft4", {"optional_bignum_0_0", "optional_bignum_2_0"})]
|
#[json_schema_test_suite("tests/suite", "draft4", {"optional_bignum_0_0", "optional_bignum_2_0", "optional_float_overflow_0_0", r"optional_format_email_0_\d+"})]
|
||||||
#[json_schema_test_suite("tests/suite", "draft6")]
|
#[json_schema_test_suite("tests/suite", "draft6", {"optional_float_overflow_0_0", r"optional_format_email_0_\d+"})]
|
||||||
#[json_schema_test_suite("tests/suite", "draft7", {
|
#[json_schema_test_suite("tests/suite", "draft7", {
|
||||||
r"optional_format_idn_hostname_0_\d+", // https://github.com/Stranger6667/jsonschema-rs/issues/101
|
r"optional_format_idn_hostname_0_\d+", // https://github.com/Stranger6667/jsonschema-rs/issues/101
|
||||||
|
"optional_float_overflow_0_0",
|
||||||
|
r"optional_format_email_0_\d+"
|
||||||
})]
|
})]
|
||||||
fn test_draft(_server_address: &str, test_case: TestCase) {
|
fn test_draft(_server_address: &str, test_case: TestCase) {
|
||||||
let draft_version = match test_case.draft_version.as_ref() {
|
let draft_version = match test_case.draft_version.as_ref() {
|
|
@ -7,7 +7,7 @@ publish = false
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
[dependencies]
|
[dependencies]
|
||||||
jsonschema = { path = "../" }
|
jsonschema = { path = "../jsonschema" }
|
||||||
serde_json = "1"
|
serde_json = "1"
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 40601f62853229f26d0533bfc6cd5afb413fbf60
|
|
Loading…
Reference in New Issue