diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1df4c7b7..94557d0c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,38 +8,75 @@ on: env: CARGO_TERM_COLOR: always + CARGO_TERM_VERBOSE: true jobs: - test: + windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Rust cache + uses: Swatinem/rust-cache@v2 + - name: Test + run: cargo test -F geo -F schemars -F reqwest --no-default-features + macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - uses: conda-incubator/setup-miniconda@v3 + - name: Set up Rust cache + uses: Swatinem/rust-cache@v2 + - name: Install GDAL + run: | + brew update + brew install gdal + - name: Test + run: cargo test --all-features + without-gdal: + runs-on: ubuntu-latest strategy: - fail-fast: true matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - runs-on: ${{ matrix.os }} + args: + - "-p stac" + - "-p stac-api" + - "-p stac-async" + - "-p stac-validate" + - "-p stac-cli --no-default-features" + - "-p stac -F reqwest" + - "-p stac -p stac-api -F geo" + - "-p stac -p stac-api -F schemars" steps: - uses: actions/checkout@v4 - name: Set up Rust cache uses: Swatinem/rust-cache@v2 - - name: Format - run: cargo fmt --verbose - - name: Build - run: cargo build --verbose --all-features - name: Test - run: cargo test --verbose --all-features - test-stac: + run: cargo test ${{ matrix.args }} + with-gdal: runs-on: ubuntu-latest strategy: - fail-fast: true matrix: - flags: ["", "--features geo", "--features reqwest", "--features schemars"] + args: + - "-p stac -F gdal" + - "-p stac-cli" + - "--all-features" steps: - uses: actions/checkout@v4 - name: Set up Rust cache uses: Swatinem/rust-cache@v2 - - name: Build - run: cargo build --verbose -p stac ${{ matrix.flags }} + - name: Install GDAL + run: | + sudo apt-get update + sudo apt-get install libgdal-dev - name: Test - run: cargo test --verbose -p stac ${{ matrix.flags }} + run: cargo test ${{ matrix.args }} + format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Rust cache + uses: Swatinem/rust-cache@v2 + - name: Format + run: cargo fmt --check doc: runs-on: ubuntu-latest env: @@ -48,5 +85,9 @@ jobs: - uses: actions/checkout@v4 - name: Set up Rust cache uses: Swatinem/rust-cache@v2 + - name: Install GDAL + run: | + sudo apt-get update + sudo apt-get install libgdal-dev - name: Doc run: cargo doc --all-features diff --git a/stac-cli/Cargo.toml b/stac-cli/Cargo.toml index 735a1083..cd680c12 100644 --- a/stac-cli/Cargo.toml +++ b/stac-cli/Cargo.toml @@ -10,6 +10,10 @@ license = "MIT OR Apache-2.0" keywords = ["geospatial", "stac", "metadata", "geo", "raster"] categories = ["science", "data-structures"] +[features] +default = ["gdal"] +gdal = ["stac/gdal"] + [dependencies] clap = { version = "4", features = ["derive"] } console = "0.15" @@ -18,7 +22,7 @@ indicatif = "0.17" reqwest = "0.12" serde = "1" serde_json = "1" -stac = { version = "0.5", path = "../stac", features = ["gdal"] } +stac = { version = "0.5", path = "../stac" } stac-api = { version = "0.3", path = "../stac-api" } stac-async = { version = "0.5", path = "../stac-async" } stac-validate = { version = "0.1", path = "../stac-validate" } diff --git a/stac-cli/src/command.rs b/stac-cli/src/command.rs index 3c554b26..764f4ab3 100644 --- a/stac-cli/src/command.rs +++ b/stac-cli/src/command.rs @@ -1,11 +1,11 @@ use crate::Result; use clap::Subcommand; -use stac::gdal::ItemBuilder; use stac_api::GetSearch; #[derive(Debug, Subcommand)] pub enum Command { /// Creates a STAC item. + #[cfg(feature = "gdal")] Create { /// The href of a raster data file. /// @@ -113,8 +113,9 @@ impl Command { pub async fn execute(self) -> Result<()> { use Command::*; match self { + #[cfg(feature = "gdal")] Create { href, compact } => { - let builder = ItemBuilder::new(&href)?; + let builder = stac::gdal::ItemBuilder::new(&href)?; let item = builder.into_item()?; if compact { println!("{}", serde_json::to_string(&item)?);