diff --git a/.github/workflows/building.yaml b/.github/workflows/building.yaml index 534c04f..e197659 100644 --- a/.github/workflows/building.yaml +++ b/.github/workflows/building.yaml @@ -39,7 +39,7 @@ jobs: path: etradeTaxReturnHelper build_and_test: - name: etradeTaxReturnHelper building + name: etradeTaxReturnHelper GUI building runs-on: ubuntu-latest steps: - name: Install system dependencies @@ -61,3 +61,24 @@ jobs: run: | cargo test + build_and_test_no_gui: + name: etradeTaxReturnHelper building + runs-on: ubuntu-latest + steps: + - name: Install system dependencies + run: | + sudo apt-get update + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - name: Cargo build + env: + LIBRARY_PATH: ./ + run: | + cargo build --release --no-default-features + - name: Cargo test + env: + LIBRARY_PATH: ./ + run: | + cargo test --no-default-features diff --git a/Cargo.toml b/Cargo.toml index b70a112..b4551e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,10 @@ repository = "https://github.com/jczaja/e-trade-tax-return-pl-helper" homepage = "https://github.com/jczaja/e-trade-tax-return-pl-helper" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[features] +default = ["gui"] +gui = ["fltk"] + [dependencies] pdf = "0.7.2" chrono = "0.4" @@ -21,4 +25,4 @@ clap = "~2.27.0" regex = "1.3.3" calamine = "0.22.1" wild = "2.2.0" -fltk = {version = "=1.3.24", features = ["fltk-bundled"]} +fltk = {version = "=1.3.24", features = ["fltk-bundled"], optional = true} diff --git a/src/gui.rs b/src/gui.rs index 8ce3d99..8ce0574 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -1,3 +1,4 @@ +#[cfg(feature = "gui")] pub mod gui { pub use crate::logging::ResultExt; diff --git a/src/main.rs b/src/main.rs index a2f8d42..7577195 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,15 +2,16 @@ use clap::{App, AppSettings, Arg}; use std::env; mod de; -mod gui; mod logging; mod pl; mod us; + +mod gui; + use etradeTaxReturnHelper::run_taxation; use logging::ResultExt; // TODO: GUI : Error messages section (Redirecting to GUI the errors) -// TODO: Make GUI optional e.g. not needed for Linux if not available // TODO: GUI : choosing residency // TODO: Drag&Drop to work on MultiBrowser field @@ -40,8 +41,11 @@ fn main() { // If there is no arguments then start GUI let args: Vec = env::args().collect(); if args.len() <= 1 { - gui::gui::run_gui(); - return; + #[cfg(feature = "gui")] + { + gui::gui::run_gui(); + return; + } } let myapp = App::new("etradeTaxHelper ".to_string() + VERSION)