From 7bf364eafc38a7c2d39bd3dbdb44e5b09aebdf0c Mon Sep 17 00:00:00 2001 From: Taku Fukada Date: Fri, 8 Dec 2023 14:45:26 +0900 Subject: [PATCH] =?UTF-8?q?CI=20(test,=20build)=20=E3=82=92=E3=81=84?= =?UTF-8?q?=E3=81=8F=E3=82=89=E3=81=8B=E6=94=B9=E5=96=84=E3=81=99=E3=82=8B?= =?UTF-8?q?=20(#50)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #49 常にTauriを含めて全体のテストをまわすとビルドが肥大化するようなので、ワークフローを以下の3つに分離した: - ライブラリ群 (`nusamai-*`) のテスト → ライブラリ部分を変更するPRに対して実行する。 - Tauri app (`app`) のテスト → tauri 部分を変更するPRに対して実行する。 - Tauri app とそこから参照されるライブラリ、のビルド → 常に実行する。 これでテストの実行はいまよりは高速になる。CIキャッシュも、2GBくらいあったものが → 200MB や 500MB 程度になった。(Actionsのキャッシュはリポジトリあたり上限10GBで、超えると古いものからevictされる) #49 で挙げている問題をすべて解消できているわけではない。テストが重いコンポーネントは、さらにテストワークフローを分離するか、汎用性高く実装できている箇所を別のリポジトリに切り出すのがいいと思う。 --- .github/workflows/build.yml | 34 +++++++++++++++ ...platform-compilation.yaml => release.yaml} | 2 +- .../{build_and_test.yml => test_app.yml} | 20 ++++----- .github/workflows/test_libs.yml | 43 +++++++++++++++++++ nusamai-gltf/Cargo.toml | 2 - nusamai-plateau/Cargo.toml | 5 +-- nusamai-plateau/citygml/Cargo.toml | 2 +- 7 files changed, 91 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/build.yml rename .github/workflows/{cross-platform-compilation.yaml => release.yaml} (95%) rename .github/workflows/{build_and_test.yml => test_app.yml} (75%) create mode 100644 .github/workflows/test_libs.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..bd4c74b1d --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,34 @@ +name: Build Tauri App + +on: + push: + branches: + - main + tags: + - "*" + pull_request: + +env: + CARGO_TERM_COLOR: always + +permissions: + contents: read + +jobs: + build: + 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 dependencies + # if: matrix.platform == 'ubuntu-20.04' + run: | + sudo apt-get update + sudo apt install -y libwebkit2gtk-4.0-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev + - name: Make Tauri build destination + run: mkdir -p app/build + - name: Build + run: cargo build --verbose --package app diff --git a/.github/workflows/cross-platform-compilation.yaml b/.github/workflows/release.yaml similarity index 95% rename from .github/workflows/cross-platform-compilation.yaml rename to .github/workflows/release.yaml index de8251592..6d5df5b4a 100644 --- a/.github/workflows/cross-platform-compilation.yaml +++ b/.github/workflows/release.yaml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - platform: [macos-latest, windows-latest] + platform: [macos-latest, windows-latest] runs-on: ${{ matrix.platform }} steps: diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/test_app.yml similarity index 75% rename from .github/workflows/build_and_test.yml rename to .github/workflows/test_app.yml index 496ddf8c6..63dc0f33f 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/test_app.yml @@ -1,4 +1,4 @@ -name: Test +name: Test Tauri App on: push: @@ -7,35 +7,35 @@ on: tags: - "*" pull_request: + paths: + - "app/**" env: - CARGO_TERM_COLOR: always + CARGO_TERM_COLOR: always permissions: contents: read jobs: - bulid_and_test: + test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Rustup - run: rustup update stable + 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: install dependencies + - name: Install dependencies # if: matrix.platform == 'ubuntu-20.04' run: | sudo apt-get update sudo apt install -y libwebkit2gtk-4.0-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov - name: Make Tauri build destination run: mkdir -p app/build - - name: Build - run: cargo build --verbose --workspace - name: Test - run: cargo llvm-cov --workspace --lcov --output-path lcov.info --all-features + run: cargo llvm-cov --package app --lcov --output-path lcov.info --all-features - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3 env: diff --git a/.github/workflows/test_libs.yml b/.github/workflows/test_libs.yml new file mode 100644 index 000000000..8d0da648a --- /dev/null +++ b/.github/workflows/test_libs.yml @@ -0,0 +1,43 @@ +name: Test Libraries + +on: + push: + branches: + - main + tags: + - "*" + pull_request: + paths: + - "nusamai/**" + - "nusamai-*/**" + +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 dependencies + run: | + sudo apt-get update + sudo apt install -y libwebkit2gtk-4.0-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev + - 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@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + files: lcov.info + fail_ci_if_error: false diff --git a/nusamai-gltf/Cargo.toml b/nusamai-gltf/Cargo.toml index d02d4d5a6..22443a4b6 100644 --- a/nusamai-gltf/Cargo.toml +++ b/nusamai-gltf/Cargo.toml @@ -6,7 +6,6 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -encoding_rs = "0.8.33" serde = { version = "1.0.192", features = ["derive"] } serde_json = { version = "1.0.108", features = ["float_roundtrip"] } serde_repr = "0.1.17" @@ -14,7 +13,6 @@ serde_repr = "0.1.17" [dev-dependencies] glob = "0.3.1" clap = { version = "4.4.6", features = ["derive"] } -elementtree = "1.2.3" nusamai-geometry = { path = "../nusamai-geometry" } quick-xml = "0.31.0" thiserror = "1.0.50" diff --git a/nusamai-plateau/Cargo.toml b/nusamai-plateau/Cargo.toml index 9b31bf4e3..9b189a67f 100644 --- a/nusamai-plateau/Cargo.toml +++ b/nusamai-plateau/Cargo.toml @@ -7,15 +7,14 @@ edition = "2021" default = ["serde"] [dependencies] -quick-xml = "0.31" +quick-xml = "0.31.0" serde = { version = "1.0.193", features = ["derive"], optional = true } citygml = { path = "./citygml", features = ["serde"]} -chrono = { version = "0.4.31", features = ["serde"] } +chrono = { version = "0.4.31", features = ["serde"], default-features = false } [dev-dependencies] zstd = { version = "0.13.0", features = ["zdict_builder"] } bincode = { version = "2.0.0-rc", default-features = false, features = ["std", "serde"] } clap = { version = "4.4", features = ["derive"] } serde = { version = "1.0.193", features = ["derive"] } -serde_json = "1.0.108" lz4_flex = "0.11.1" diff --git a/nusamai-plateau/citygml/Cargo.toml b/nusamai-plateau/citygml/Cargo.toml index b38aaf836..250580176 100644 --- a/nusamai-plateau/citygml/Cargo.toml +++ b/nusamai-plateau/citygml/Cargo.toml @@ -8,7 +8,7 @@ default = ["serde"] serde = ["dep:serde", "nusamai-geometry/serde"] [dependencies] -chrono = "0.4.31" +chrono = { version = "0.4.31", features = ["serde"], default-features = false } indexmap = "2.1" macros = { path = "./macros" } nusamai-geometry = { path = "../../nusamai-geometry", features = ["serde"]}