Skip to content

Commit

Permalink
ci: don't fail-fast, add gdal
Browse files Browse the repository at this point in the history
  • Loading branch information
gadomski committed Apr 9, 2024
1 parent 149bc61 commit a7d5c66
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 18 deletions.
71 changes: 56 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
6 changes: 5 additions & 1 deletion stac-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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" }
Expand Down
5 changes: 3 additions & 2 deletions stac-cli/src/command.rs
Original file line number Diff line number Diff line change
@@ -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.
///
Expand Down Expand Up @@ -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)?);
Expand Down

0 comments on commit a7d5c66

Please sign in to comment.