From 7349042a477920af77b589385cb68efdcc05ee54 Mon Sep 17 00:00:00 2001 From: LingMan Date: Wed, 8 Feb 2023 13:52:22 +0100 Subject: [PATCH] Switch from TravisCI to Github Actions (#117) CI is currently out of action likely because TravisCI made some changes a few years back. Reasons to switch to Github Action instead of fixing TravisCI: - I'm actually able to fix it this way, since I don't need to be the repository owner. A PR is enough. - Unsure if they even still offer free CI. Github Actions is free, reliable and well itegrated - GHA is the one I'm familiar with. Test are run on Linux, Windows, and macOS. Since the Unix test require a tty, which isn't available on the GHA runners, they are run under faketty. Unfortunately that in turn requires a fairly recent Rust version to compile and binary artifacts aren't available, so Unix systems with MSRV only run build tests. Examples are build-tested only. Formatting is also checked. --- .github/workflows/ci.yml | 45 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 19 ----------------- Cargo.toml | 2 +- 3 files changed, 46 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..6a4f268e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,45 @@ +name: CI +on: + pull_request: + push: + +jobs: + test: + name: Test + strategy: + matrix: + os: ["ubuntu-latest", "windows-latest", "macos-latest"] + rust: ["stable", "1.58"] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Install Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ matrix.rust }} + - name: Build + run: cargo build + - name: Build examples + run: cargo build --examples + - name: Install faketty + if: matrix.rust == 'stable' && matrix.os != 'windows-latest' + run: | + cargo install faketty + echo "fake_tty=faketty" >> $GITHUB_ENV + - name: Test + if: env.fake_tty || matrix.os == 'windows-latest' + run: ${{ env.fake_tty }} cargo test --workspace + + fmt: + name: rustfmt + runs-on: ubuntu-latest + steps: + - name: Checkout source + uses: actions/checkout@v3 + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + - name: Run rustfmt check + run: cargo fmt --check diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 11cf5fda..00000000 --- a/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: rust - -sudo: required - -rust: - - stable - - beta - - nightly - -matrix: - allow_failures: - - rust: nightly - -script: - - cargo test --all --verbose - - rustup component add rustfmt-preview - # disable it until the formatting will be - # consistent between stable, beta and nightly. - # - cargo fmt -- --check diff --git a/Cargo.toml b/Cargo.toml index 3c60e238..ae4ce0cc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" description = "Console progress bar for Rust" documentation = "https://a8m.github.io/pb/doc/pbr/index.html" repository = "https://github.com/a8m/pb" -exclude = ["gif/", ".travis.yml"] +exclude = ["gif/"] keywords = ["cli", "progress", "terminal", "pb"] license = "MIT"