From 178ff134ca5505f1df64121e87ebbcbeb1360a28 Mon Sep 17 00:00:00 2001 From: Yuji Mise Date: Sat, 17 Aug 2024 22:51:11 +0900 Subject: [PATCH] chore: Update CI workflow and dependencies --- .github/workflows/ci.yml | 60 ++++++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 35 ---------------------- .taplo.toml | 11 +++++++ Cargo.toml | 10 +++---- README.md | 3 -- rust-toolchain.toml | 3 ++ rustfmt.toml | 7 +++++ tests/gltf_extensions.rs | 3 -- 8 files changed, 86 insertions(+), 46 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/test.yml create mode 100644 .taplo.toml create mode 100644 rust-toolchain.toml create mode 100644 rustfmt.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2e674dd --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,60 @@ +name: CI + +on: + push: + branches: + - main + tags: + - "*" + pull_request: + paths: + - "nusamai-*/**" + - ".github/**" + - "*" +env: + CARGO_INCREMENTAL: 0 + CARGO_NET_RETRY: 10 + RUSTUP_MAX_RETRIES: 10 + RUST_BACKTRACE: short + ACTION_LOG_DISABLE: true + +jobs: + check: + name: cargo check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - name: Check + run: cargo check --all + + style: + name: cargo fmt + needs: check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + - name: rustfmt + run: cargo fmt --all -- --check + + warnings: + runs-on: ubuntu-latest + needs: check + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + components: clippy + - name: rustfmt + run: cargo clippy --all -- -D warnings + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - name: Run tests + run: cargo test --workspace --all-targets --all-features diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 8a706e1..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Test - -on: - push: - branches: - - main - tags: - - "*" - pull_request: - -env: - CARGO_TERM_COLOR: always - -permissions: - contents: read - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Rustup - run: rustup toolchain install stable --profile minimal - - name: Rust Cache - uses: Swatinem/rust-cache@v2 - - name: Install cargo-llvm-cov - uses: taiki-e/install-action@cargo-llvm-cov - - name: Test - run: cargo llvm-cov --workspace --exclude app --lcov --output-path lcov.info --all-features - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: lcov.info - fail_ci_if_error: false diff --git a/.taplo.toml b/.taplo.toml new file mode 100644 index 0000000..6797fc6 --- /dev/null +++ b/.taplo.toml @@ -0,0 +1,11 @@ +# https://taplo.tamasfe.dev/configuration/formatter-options.html +include = ["Cargo.toml", "*/Cargo.toml"] + +[formatting] +trailing_newline = true +reorder_keys = true +align_comments = false +allowed_blank_lines = 1 +array_auto_collapse = false +array_auto_expand = false +reorder_arrays = true diff --git a/Cargo.toml b/Cargo.toml index bd746e0..02d4aa7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,13 +1,13 @@ [package] -name = "cesiumtiles" +authors = ["MIERUNE Inc. ", "Re:Earth Flow Contributors"] edition = "2021" -authors = ["MIERUNE Inc. "] license = "MIT" +name = "cesiumtiles" [dependencies] -serde = { version = "1.0.197", features = ["derive"] } -serde_json = { version = "1.0.114", features = ["indexmap", "float_roundtrip"] } -serde_repr = "0.1.18" +serde = { version = "1.0.208", features = ["derive"] } +serde_json = { version = "1.0.125", features = ["float_roundtrip", "indexmap"] } +serde_repr = "0.1.19" [dev-dependencies] glob = "0.3.1" diff --git a/README.md b/README.md index 0b4b73d..f6f8160 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,3 @@ # 3D Tiles 1.1 (JSON models) for Rust -[![Test](https://github.com/MIERUNE/cesiumtiles-rs/actions/workflows/test.yml/badge.svg)](https://github.com/MIERUNE/cesiumtiles-rs/actions/workflows/test.yml) -[![codecov](https://codecov.io/gh/MIERUNE/cesiumtiles-rs/graph/badge.svg?token=cREJynPKKY)](https://codecov.io/gh/MIERUNE/cesiumtiles-rs) - WIP diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..436f7c2 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "stable" +components = ["rustc", "cargo", "clippy", "rustfmt", "rust-src"] diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..ec7eaa1 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,7 @@ +# Stable options +use_field_init_shorthand = true + +# # Unstable options +# unstable_features = true +# group_imports = "StdExternalCrate" +# imports_granularity = "Crate" diff --git a/tests/gltf_extensions.rs b/tests/gltf_extensions.rs index bfd6e02..1edc780 100644 --- a/tests/gltf_extensions.rs +++ b/tests/gltf_extensions.rs @@ -1,6 +1,3 @@ -use std::io::BufReader; -use std::io::Read; - use serde::{Deserialize, Serialize}; use cesiumtiles::gltf_extensions::gltf;