diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 05fa8d41..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,57 +0,0 @@ -version: 2.1 -jobs: - lint-rust: - docker: - - image: rust:latest - resource_class: small - steps: - - checkout - - - run: - name: Print Rust Versions - command: rustc --version; cargo --version; rustup --version - - - run: - name: Install Rust Format - command: rustup component add rustfmt - - - run: - name: Test Formatting - command: cargo fmt -- --check - test-rust: - docker: - - image: rust:latest - resource_class: small - steps: - - checkout - - - run: - name: Print Rust Versions - command: rustc --version; cargo --version; rustup --version - - - restore_cache: - keys: - - v2-cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }} - - - run: - name: Build - command: cargo build --locked --all-targets - - - run: - name: Run Tests - command: cargo test --locked - - - run: - name: Autoclean Cargo cache before storing - command: cargo-cache || (cargo install cargo-cache --force --git https://github.com/matthiaskrgr/cargo-cache.git --no-default-features --features ci-autoclean && cargo-cache) - - save_cache: - key: v2-cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }} - paths: - - /usr/local/cargo - - target/debug -workflows: - version: 2 - ci: - jobs: - - test-rust - - lint-rust diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..1074dc10 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,57 @@ +name: Rust Tests + +on: + push: + branches: + - main + pull_request: + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Setup | Checkout + uses: actions/checkout@v2 + - uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt clippy + - uses: Swatinem/rust-cache@v2 + with: + prefix-key: "v1-rust" + - name: Build | Lint + run: cargo clippy --all-targets --no-deps + doc: + name: Doc + runs-on: ubuntu-latest + steps: + - name: Setup | Checkout + uses: actions/checkout@v2 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + with: + prefix-key: "v1-rust" + - name: Cargo Doc + run: cargo doc --workspace --no-deps + test: + name: Test + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + rust: + - stable + - nightly + runs-on: ${{ matrix.os }} + steps: + - name: Setup | Checkout + uses: actions/checkout@v2 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ matrix.rust }} + - uses: Swatinem/rust-cache@v2 + with: + prefix-key: "v1-rust" + - name: Test + run: cargo test --all-targets diff --git a/tests/strip_ansi.rs b/tests/strip_ansi.rs index 5c585bba..bbbf07fb 100644 --- a/tests/strip_ansi.rs +++ b/tests/strip_ansi.rs @@ -7,6 +7,8 @@ mod integration { #[test] fn calling_devicon_lookup_without_strip_color_single_file() { + colored::control::set_override(true); + let mut cmd = Command::cargo_bin("devicon-lookup").unwrap(); cmd.write_stdin("test.rs".blue().to_string()) .assert() @@ -15,6 +17,8 @@ mod integration { #[test] fn calling_devicon_lookup_with_strip_color_single_file() { + colored::control::set_override(true); + let mut cmd = Command::cargo_bin("devicon-lookup").unwrap(); cmd.arg("--color"); cmd.write_stdin("test.rs".blue().to_string()) @@ -24,6 +28,8 @@ mod integration { #[test] fn calling_devicon_lookup_with_strip_color_multi_file() { + colored::control::set_override(true); + let mut cmd = Command::cargo_bin("devicon-lookup").unwrap(); cmd.arg("-c"); cmd.write_stdin(format!("{}\n{}", "test.rs".blue(), "test.rb".red()))