From 0081c80dc7faab93744ba24b5067e23835d1d99f Mon Sep 17 00:00:00 2001 From: Hicham Date: Sun, 10 Dec 2023 18:31:45 +0100 Subject: [PATCH] ci: Run tests for feature openslide4 --- .github/workflows/benchmark.yml | 4 ++-- .github/workflows/clippy.yml | 2 +- .github/workflows/coverage.yml | 6 +++--- .github/workflows/publish.yml | 2 +- .github/workflows/workflow.yml | 17 ++++++++--------- Makefile | 22 +++++++++++++++++----- 6 files changed, 32 insertions(+), 21 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 3a5357a..86a3f8e 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -16,11 +16,11 @@ env: jobs: benchmarks: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - name: Install dependencies - run: make install-deps-apt + run: make install-deps-ubuntu-openslide4 - uses: dtolnay/rust-toolchain@stable with: toolchain: ${{ env.RUST_VERSION }} diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index a9decd3..0a7fd27 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -15,7 +15,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Install dependencies - run: make install-deps-apt + run: make install-deps-ubuntu-openslide3 - name: Install latest nightly uses: dtolnay/rust-toolchain@stable with: diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 834c458..f900f73 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -13,11 +13,11 @@ env: jobs: coverage: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - name: Install dependencies - run: make install-deps-apt + run: make install-deps-ubuntu-openslide4 - uses: dtolnay/rust-toolchain@stable with: toolchain: ${{ env.RUST_VERSION }} @@ -35,7 +35,7 @@ jobs: rustup component add llvm-tools-preview cargo install cargo-llvm-cov cargo llvm-cov clean --workspace # remove artifacts that may affect the coverage results - cargo llvm-cov --no-report --workspace --features deepzoom + cargo llvm-cov --no-report --workspace --features deepzoom,openslide4 cargo llvm-cov --no-run --workspace --lcov --output-path lcov.info - uses: codecov/codecov-action@v3 with: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 195f01b..b835c67 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,7 +16,7 @@ jobs: with: toolchain: ${{ env.RUST_VERSION }} - name: Install dependencies ubuntu - run: make install-deps-apt + run: make install-deps-ubuntu-openslide3 - uses: katyo/publish-crates@v2 with: dry-run: ${{ github.event_name != 'release' }} diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index b0e10b3..ddfc4ae 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -20,8 +20,11 @@ jobs: strategy: fail-fast: false matrix: - os: [ "ubuntu-22.04", "ubuntu-20.04", "macos-12" ] - feature: [ "--no-default-features", "--features deepzoom", "--features image" ] + os: [ "ubuntu-22.04", "macos-12" ] + feature: [ "--no-default-features", "--features deepzoom", "--features openslide4" ] + + env: + INSTALL_DEPS_CMD: install-deps-${{ contains(matrix.os, 'ubuntu') && 'ubuntu' || 'macos' }}-${{ contains(matrix.feature, 'openslide4') && 'openslide4' || 'openslide3' }} steps: - uses: actions/checkout@v4 @@ -41,12 +44,8 @@ jobs: - uses: Swatinem/rust-cache@v2 with: key: ${{ matrix.os }}-${{ matrix.feature }} - - name: Install dependencies ubuntu - if: ${{ matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' }} - run: make install-deps-apt - - name: Install dependencies macos - if: ${{ matrix.os == 'macos-12' }} - run: make install-deps-brew + - name: Install dependencies + run: make ${{ env.INSTALL_DEPS_CMD }} - name: Build & Test (Debug) run: cargo test --workspace ${{ matrix.feature }} - name: Build & Test (Release) @@ -61,7 +60,7 @@ jobs: toolchain: ${{ env.RUST_VERSION }} components: clippy, rustfmt - name: Install dependencies ubuntu - run: make install-deps-apt + run: make install-deps-ubuntu-openslide3 - name: Generate Doc env: DOCS_RS: 1 diff --git a/Makefile b/Makefile index c2f5779..8bb92fb 100755 --- a/Makefile +++ b/Makefile @@ -1,11 +1,23 @@ -.PHONY: install-deps-brew install-deps-apt dl-test-images +.PHONY: install-deps-macos-openslide3 install-deps-macos-openslide4 install-deps-ubuntu-openslide3 install-deps-ubuntu-openslide4 dl-test-images -install-deps-brew: - brew install openslide +install-deps-macos-openslide3: + curl https://raw.githubusercontent.com/Homebrew/homebrew-core/e6e41a54ec4d05000c1b95e515c85adb6f8f35af/Formula/o/openslide.rb > openslide.rb + HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install openslide.rb -install-deps-apt: +install-deps-macos-openslide4: + curl https://raw.githubusercontent.com/Homebrew/homebrew-core/f92e0a24754ed265ff7a032b89b336dd612e5559/Formula/o/openslide.rb > openslide.rb + HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install openslide.rb + +install-deps-ubuntu-openslide3: + sudo apt-get update + sudo apt-get install -y --no-install-recommends libopenslide-dev=3.* + +install-deps-ubuntu-openslide4: + sudo apt-get update + sudo apt install -y --no-install-recommends software-properties-common gnupg + sudo add-apt-repository -y ppa:openslide/openslide sudo apt-get update - sudo apt-get install -y --no-install-recommends libopenslide-dev + sudo apt install -y --no-install-recommends libopenslide-dev=4.* libdicom-dev=1.* libwebp-dev=1.* dl-test-images: mkdir ./tests/assets/hamamatsu ./tests/assets/trestle ./tests/assets/mirax