diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 323399ce..dd49909b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,8 +3,12 @@ name: CI on: push: pull_request: + workflow_dispatch: schedule: [cron: "40 1 * * *"] +permissions: + contents: read + env: RUSTFLAGS: -Dwarnings @@ -12,16 +16,18 @@ jobs: test: name: Test suite runs-on: ubuntu-latest + timeout-minutes: 45 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@nightly - run: cd test_suite && cargo test --features unstable windows: name: Test suite (windows) runs-on: windows-latest + timeout-minutes: 45 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@nightly - run: cd test_suite && cargo test --features unstable -- --skip ui --exact @@ -32,15 +38,14 @@ jobs: fail-fast: false matrix: rust: [stable, beta] + timeout-minutes: 45 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: toolchain: ${{matrix.rust}} - run: cd serde && cargo build --features rc - run: cd serde && cargo build --no-default-features - - run: cd serde_test && cargo build - - run: cd serde_test && cargo test --features serde/derive,serde/rc nightly: name: Rust nightly ${{matrix.os == 'windows' && '(windows)' || ''}} @@ -49,33 +54,22 @@ jobs: fail-fast: false matrix: os: [ubuntu, windows] + timeout-minutes: 45 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@nightly - run: cd serde && cargo build - run: cd serde && cargo build --no-default-features - run: cd serde && cargo build --no-default-features --features alloc - run: cd serde && cargo build --no-default-features --features rc,alloc + - run: cd serde && cargo build --no-default-features --features unstable - run: cd serde && cargo test --features derive,rc,unstable - run: cd test_suite/no_std && cargo build if: matrix.os != 'windows' - - msrv: - name: Rust 1.13.0 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: dtolnay/rust-toolchain@1.13.0 - - name: Get timestamp for cache - id: date - run: echo ::set-output name=yearmo::$(date +%Y%m) - - uses: actions/cache@v1 - with: - path: ~/.cargo/registry/index - key: cargo-registry-index-${{steps.date.outputs.yearmo}} - - run: cd serde && cargo build --features rc - - run: cd serde && cargo build --no-default-features - - run: cd serde_test && cargo build + - run: cd serde_derive && cargo check --tests + env: + RUSTFLAGS: --cfg exhaustive ${{env.RUSTFLAGS}} + if: matrix.os != 'windows' build: name: Rust ${{matrix.rust}} @@ -83,38 +77,24 @@ jobs: strategy: fail-fast: false matrix: - rust: [1.19.0, 1.20.0, 1.21.0, 1.25.0, 1.26.0, 1.34.0] + rust: [1.31.0, 1.34.0] + timeout-minutes: 45 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: toolchain: ${{matrix.rust}} - - run: cd serde && cargo build --no-default-features - - run: cd serde && cargo build - - more: - name: Rust ${{matrix.rust}} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - rust: [1.27.0, 1.28.0] - steps: - - uses: actions/checkout@v2 - - uses: dtolnay/rust-toolchain@master - with: - toolchain: ${{matrix.rust}} - # Work around failing to parse manifest because editions are unstable. - - run: sed -i /test_suite/d Cargo.toml + - run: cd serde && cargo build --features rc - run: cd serde && cargo build --no-default-features - run: cd serde && cargo build derive: - name: Rust 1.31.0 + name: Rust 1.56.0 runs-on: ubuntu-latest + timeout-minutes: 45 steps: - - uses: actions/checkout@v2 - - uses: dtolnay/rust-toolchain@1.31.0 + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@1.56.0 - run: cd serde && cargo check --no-default-features - run: cd serde && cargo check - run: cd serde_derive && cargo check @@ -122,43 +102,71 @@ jobs: alloc: name: Rust 1.36.0 runs-on: ubuntu-latest + timeout-minutes: 45 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@1.36.0 - run: cd serde && cargo build --no-default-features --features alloc - emscripten: - name: Emscripten + minimal: + name: Minimal versions runs-on: ubuntu-latest + timeout-minutes: 45 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@nightly - - uses: actions/setup-node@v1 - with: - node-version: 9 - - name: Install cargo-web - run: | - CARGO_WEB_RELEASE=$(curl -L -s -H Accept:application/json https://github.com/koute/cargo-web/releases/latest) - CARGO_WEB_VERSION=$(echo "${CARGO_WEB_RELEASE}" | jq -r .tag_name) - CARGO_WEB_URL="https://github.com/koute/cargo-web/releases/download/${CARGO_WEB_VERSION}/cargo-web-x86_64-unknown-linux-gnu.gz" - mkdir -p ~/.cargo/bin - curl -L "${CARGO_WEB_URL}" | gzip -d > ~/.cargo/bin/cargo-web - chmod +x ~/.cargo/bin/cargo-web - - run: cd test_suite && cargo web test --target=asmjs-unknown-emscripten --nodejs - continue-on-error: true - - run: cd test_suite && cargo web test --target=wasm32-unknown-emscripten --nodejs - continue-on-error: true + - run: cargo generate-lockfile -Z minimal-versions + - run: cargo check --locked --workspace + + doc: + name: Documentation + runs-on: ubuntu-latest + timeout-minutes: 45 + env: + RUSTDOCFLAGS: -Dwarnings + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@nightly + - uses: dtolnay/install@cargo-docs-rs + - run: cargo docs-rs -p serde + - run: cargo docs-rs -p serde_derive + - run: cargo docs-rs -p serde_derive_internals clippy: name: Clippy runs-on: ubuntu-latest if: github.event_name != 'pull_request' + timeout-minutes: 45 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@clippy - run: cd serde && cargo clippy --features rc,unstable -- -Dclippy::all -Dclippy::pedantic - run: cd serde_derive && cargo clippy -- -Dclippy::all -Dclippy::pedantic - run: cd serde_derive_internals && cargo clippy -- -Dclippy::all -Dclippy::pedantic - - run: cd serde_test && cargo clippy -- -Dclippy::all -Dclippy::pedantic - run: cd test_suite && cargo clippy --tests --features unstable -- -Dclippy::all -Dclippy::pedantic - run: cd test_suite/no_std && cargo clippy -- -Dclippy::all -Dclippy::pedantic + + miri: + name: Miri + runs-on: ubuntu-latest + timeout-minutes: 45 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@miri + - run: cargo miri setup + - run: cd serde && cargo miri test --features derive,rc,unstable + env: + MIRIFLAGS: -Zmiri-strict-provenance + - run: cd test_suite && cargo miri test --features unstable + env: + MIRIFLAGS: -Zmiri-strict-provenance + + outdated: + name: Outdated + runs-on: ubuntu-latest + if: github.event_name != 'pull_request' + timeout-minutes: 45 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/install@cargo-outdated + - run: cargo outdated --workspace --exit-code 1 diff --git a/Cargo.toml b/Cargo.toml index cb35f854..ac94fb08 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,13 @@ members = [ "serde", "serde_derive", "serde_derive_internals", - "serde_test", "test_suite", ] + +[patch.crates-io] +serde = { path = "serde" } + +[workspace.dependencies] +proc-macro2 = { version = "1.0.74", default-features = false } +quote = { version = "1.0.35", default-features = false } +syn = { version = "2.0.46", default-features = false } diff --git a/LICENSE-APACHE b/LICENSE-APACHE index 16fe87b0..1b5ec8b7 100644 --- a/LICENSE-APACHE +++ b/LICENSE-APACHE @@ -174,28 +174,3 @@ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/README.OpenSource b/README.OpenSource index 5a549053..d3ebade8 100644 --- a/README.OpenSource +++ b/README.OpenSource @@ -3,7 +3,7 @@ "Name": "serde", "License": "Apache License V2.0", "License File": "LICENSE-APACHE", - "Version Number": "1.0.136", + "Version Number": "1.0.197", "Owner": "xuelei3@huawei.com", "Upstream URL": "https://github.com/serde-rs/serde", "Description": "A generic serialization/deserialization framework." diff --git a/README.md b/README.md index 79409a3f..31292944 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ -# Serde [![Build Status]][actions] [![Latest Version]][crates.io] [![serde: rustc 1.13+]][Rust 1.13] [![serde_derive: rustc 1.31+]][Rust 1.31] +# Serde [![Build Status]][actions] [![Latest Version]][crates.io] [![serde msrv]][Rust 1.31] [![serde_derive msrv]][Rust 1.56] -[Build Status]: https://img.shields.io/github/workflow/status/serde-rs/serde/CI/master +[Build Status]: https://img.shields.io/github/actions/workflow/status/serde-rs/serde/ci.yml?branch=master [actions]: https://github.com/serde-rs/serde/actions?query=branch%3Amaster [Latest Version]: https://img.shields.io/crates/v/serde.svg [crates.io]: https://crates.io/crates/serde -[serde: rustc 1.13+]: https://img.shields.io/badge/serde-rustc_1.13+-lightgray.svg -[serde_derive: rustc 1.31+]: https://img.shields.io/badge/serde_derive-rustc_1.31+-lightgray.svg -[Rust 1.13]: https://blog.rust-lang.org/2016/11/10/Rust-1.13.html +[serde msrv]: https://img.shields.io/crates/msrv/serde.svg?label=serde%20msrv&color=lightgray +[serde_derive msrv]: https://img.shields.io/crates/msrv/serde_derive.svg?label=serde_derive%20msrv&color=lightgray [Rust 1.31]: https://blog.rust-lang.org/2018/12/06/Rust-1.31-and-rust-2018.html +[Rust 1.56]: https://blog.rust-lang.org/2021/10/21/Rust-1.56.0.html **Serde is a framework for *ser*ializing and *de*serializing Rust data structures efficiently and generically.** @@ -19,7 +19,7 @@ You may be looking for: - [Data formats supported by Serde](https://serde.rs/#data-formats) - [Setting up `#[derive(Serialize, Deserialize)]`](https://serde.rs/derive.html) - [Examples](https://serde.rs/examples.html) -- [API documentation](https://docs.serde.rs/serde/) +- [API documentation](https://docs.rs/serde) - [Release notes](https://github.com/serde-rs/serde/releases) ## Serde in action @@ -48,7 +48,7 @@ serde_json = "1.0"
```rust -use serde::{Serialize, Deserialize}; +use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug)] struct Point { diff --git a/crates-io.md b/crates-io.md index b57bc5fd..18710035 100644 --- a/crates-io.md +++ b/crates-io.md @@ -10,13 +10,13 @@ You may be looking for: - [Data formats supported by Serde](https://serde.rs/#data-formats) - [Setting up `#[derive(Serialize, Deserialize)]`](https://serde.rs/derive.html) - [Examples](https://serde.rs/examples.html) -- [API documentation](https://docs.serde.rs/serde/) +- [API documentation](https://docs.rs/serde) - [Release notes](https://github.com/serde-rs/serde/releases) ## Serde in action ```rust -use serde::{Serialize, Deserialize}; +use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug)] struct Point { diff --git a/serde/BUILD.gn b/serde/BUILD.gn index 1f30fc56..6978ad7f 100644 --- a/serde/BUILD.gn +++ b/serde/BUILD.gn @@ -19,8 +19,8 @@ ohos_cargo_crate("lib") { crate_root = "src/lib.rs" sources = [ "src/lib.rs" ] - edition = "2015" - cargo_pkg_version = "1.0.136" + edition = "2018" + cargo_pkg_version = "1.0.195" cargo_pkg_authors = "Erick Tryzelaar