Skip to content

Commit

Permalink
build: Update builds
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Dygalo <[email protected]>
  • Loading branch information
Stranger6667 committed Apr 14, 2024
1 parent 79e35a2 commit 9aae87e
Show file tree
Hide file tree
Showing 13 changed files with 247 additions and 205 deletions.
176 changes: 88 additions & 88 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,24 @@ jobs:

commitsar:
name: Verify commit messages
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/[email protected]
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run commitsar
uses: aevea/[email protected]
- uses: aevea/[email protected]

pre-commit:
name: Generic pre-commit checks
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 1

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.11

- run: pip install pre-commit
- run: pre-commit run --all-files
Expand All @@ -39,30 +37,23 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-12, windows-2022]
os: [ubuntu-22.04, macos-12, windows-2022]
draft: [draft201909, draft202012]

name: Test ${{ matrix.draft }} (stable) on ${{ matrix.os}}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: dtolnay/rust-toolchain@stable

- name: Cache cargo
uses: actions/cache@v3
- uses: Swatinem/rust-cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: stable-${{ matrix.os }}-${{ matrix.draft }}-cargo-cache
workspaces: jsonschema
cache-all-crates: "true"
key: ${{ matrix.os }}-${{ matrix.draft }}

- run: cargo test --no-fail-fast --features ${{ matrix.draft }}
working-directory: ./jsonschema
Expand All @@ -74,130 +65,135 @@ jobs:
target: ['wasm32-unknown-unknown']

name: Build on ${{ matrix.target }}
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
target: ${{ matrix.target }}
override: true
targets: ${{ matrix.target }}

- name: Cache cargo
uses: actions/cache@v3
- uses: Swatinem/rust-cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: stable-${{ matrix.target }}-cargo-cache
workspaces: jsonschema
cache-all-crates: "true"

- run: cargo build --target ${{ matrix.target }} --no-default-features --features=cli
working-directory: ./jsonschema

coverage:
name: Run test coverage
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- name: Toolchain setup
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- name: Install grcov
run: cargo install cargo-tarpaulin

- name: Cache cargo
uses: actions/cache@v3
- uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: coverage-cargo-cache
workspaces: jsonschema
cache-all-crates: "true"

- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov

- name: Run tests
run: cargo +nightly tarpaulin --verbose --all-features --out Xml
run: cargo llvm-cov --no-report --all-features
working-directory: ./jsonschema

- name: Generate coverage reports
run: cargo llvm-cov report --lcov --output-path lcov.info
working-directory: ./jsonschema

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
if: ${{ env.GITHUB_REPOSITORY }} == 'Stranger6667/jsonschema-rs'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: coverage
files: lcov.info
fail_ci_if_error: true

test-python:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-12, windows-2022]
os: [ubuntu-22.04, macos-12, windows-2022]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']

name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- run: python -m pip install tox
working-directory: ./bindings/python

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: dtolnay/rust-toolchain@stable

- name: Cache cargo
uses: actions/cache@v3
- uses: Swatinem/rust-cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: python-${{ matrix.python-version }}-${{ matrix.os }}-cargo-cache
workspaces: |
jsonschema
bindings/python
key: ${{ matrix.python-version }}-${{ matrix.os }}

- name: Run ${{ matrix.python }} tox job
run: tox -e py
working-directory: ./bindings/python

fmt:
name: Rustfmt
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@nightly
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt

- run: cargo fmt --all -- --check
working-directory: ./jsonschema

- run: cargo fmt --all -- --check
working-directory: ./bindings/python

- run: cargo fmt --all -- --check
working-directory: ./bench_helpers

- run: cargo fmt --all -- --check
working-directory: ./perf-helpers

- run: cargo fmt --all -- --check
working-directory: ./jsonschema-test-suite

clippy:
name: Clippy
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions-rs/toolchain@v1

- uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true
components: clippy

- uses: Swatinem/rust-cache@v2
with:
workspaces: |
jsonschema
bindings/python
- run: cargo clippy --all-targets --all-features -- -D warnings
working-directory: ./jsonschema

Expand All @@ -206,16 +202,20 @@ jobs:

features:
name: Check features
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions-rs/toolchain@v1

- uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2
with:
profile: minimal
toolchain: stable
override: true
workspaces: jsonschema
cache-all-crates: "true"

- uses: taiki-e/install-action@cargo-hack

- run: cargo hack check --feature-powerset --lib
working-directory: ./jsonschema
22 changes: 10 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
default_language_version:
python: python3.9
python: python3.11

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
rev: v4.6.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
Expand All @@ -15,23 +15,21 @@ repos:
- id: check-merge-conflict

- repo: https://github.com/jorisroovers/gitlint
rev: v0.17.0
rev: v0.19.1
hooks:
- id: gitlint

- repo: https://github.com/adrienverge/yamllint
rev: v1.26.3
rev: v1.35.1
hooks:
- id: yamllint

- repo: https://github.com/ambv/black
rev: 22.3.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.7
hooks:
- id: black
types: [python]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.10.1
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.7
hooks:
- id: isort
additional_dependencies: ["isort[pyproject]"]
- id: ruff
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- Bump `percent-encoding` to `2.3`.
- Bump `regex` to `1.10`.
- Bump `url` to `2.5`.
- Build CLI only if the `cli` feature is enabled.

## [0.17.1] - 2023-07-05

Expand Down
2 changes: 2 additions & 0 deletions bench_helpers/rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
imports_granularity = "Crate"
edition = "2021"
Loading

0 comments on commit 9aae87e

Please sign in to comment.