From a9a5e997f1b107cffca00428c5face0ff30c26a5 Mon Sep 17 00:00:00 2001 From: Dan Reeves Date: Sun, 26 Jul 2020 15:21:36 +0100 Subject: [PATCH 1/6] github actions for ci --- .github/workflows/ci.yml | 65 +++++++++++++++++++++++++++++++++++++++ .travis.yml | 53 ------------------------------- scripts/before_deploy.ps1 | 23 -------------- scripts/before_deploy.sh | 32 ------------------- scripts/install.sh | 43 -------------------------- scripts/script.sh | 31 ------------------- 6 files changed, 65 insertions(+), 182 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml delete mode 100644 scripts/before_deploy.ps1 delete mode 100644 scripts/before_deploy.sh delete mode 100644 scripts/install.sh delete mode 100644 scripts/script.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..efdd99f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,65 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + branches: + - master +env: + RUSTFLAGS: -Dwarnings + +jobs: + build_and_test: + name: Build and test + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + rust: [stable, nightly] + + steps: + - uses: actions/checkout@master + + - name: Install ${{ matrix.rust }} + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + override: true + + - name: check + uses: actions-rs/cargo@v1 + with: + command: check + args: --all --bins --examples + + - name: tests + uses: actions-rs/cargo@v1 + with: + command: test + args: --all + + check_fmt_and_docs: + name: Checking fmt, clippy, and docs + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + - name: setup + run: | + rustup component add clippy rustfmt + rustc --version + - name: clippy + run: cargo clippy --tests --examples -- -D warnings + + - name: fmt + run: cargo fmt --all -- --check + + - name: Docs + run: cargo doc --no-deps --features unstable diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 285502d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,53 +0,0 @@ -dist: trusty -language: rust -services: docker -sudo: required - -env: - global: - - CRATE_NAME=path-clean - - RUST_BACKTRACE=1 - -matrix: - include: - - env: TARGET=armv7-unknown-linux-gnueabihf - - env: TARGET=x86_64-unknown-linux-musl - - env: TARGET=x86_64-unknown-linux-gnu - - env: TARGET=x86_64-apple-darwin - os: osx - - env: TARGET=x86_64-pc-windows-gnu - os: windows - -before_install: - - set -e - -install: - - sh scripts/install.sh - - source ~/.cargo/env || true - -script: - - bash scripts/script.sh - -after_script: set +e - -before_deploy: - - sh scripts/before_deploy.sh - -deploy: - provider: releases - skip_cleanup: true - file_glob: true - file: $CRATE_NAME-$TRAVIS_TAG-$TARGET.* - api_key: - secure: "0m1vcyQn8PRVuKenfaYi3l/Yu8EQD0cIyWopL7X5bJ5qVO0wn2QAb+zrlDGsCFPUq+vVQi5Bg9HeYpXHoTpUbCQCK85y+d9aIV4TRRUMXwHEuBSSIgWRmMg0vNh6VDF9rX+Qmu2C64rIqZBCDmofDdHPGyDIYCoGmQliILu1NcpWLAF/iIFGcyxIMCB/jAoV6A8Mu8ua/m2EtBeOUwQZPTS9shTYumuUd4TwdU0Am2+QupLiAbZB8ZfLa/m/ynakAxwuDlUWX7u0VScdOkc4JuvQ6tQkRtO2/j28xWELlzoe4nAmQpaJeTWh5vmjpfiQQHuOOeR/eDLC1mJ6LXQDqtnh9h0B0vjIhrfdNXsapNgHxgxZvtdRDzf9KAphfMGVzNqZCevg6plDFTgk09zZTyt8rvWqpfWhmTNl9KV5sE3IX8UhlvBjau9+Q9LxMCHGuF4vn7pfMcgA1D6Zn4G+TEf+/3Xq1OWVdX1dWxFsn2Dg+R3K7UOytk0P/N60mGyMTtTNV5E4IKyf1wM/o98OkABat6RWfK57WM3N9+nXP2PAmW57/4RWsYaNlLlXfZLm8TjHINwszlpXfsC7BAPxFd0ja9N5JWlim31O+K/V8zdVfNM+kRBgoEWAtCRVwnjdTLbz7+oUrlfZVR6Q7DCVi6nVYA8c+/FQX43pIQ/wDmU=" - on: - tags: true - -cache: cargo -before_cache: - - chmod -R a+r $HOME/.cargo - -notifications: - email: - on_success: never - on_failure: never diff --git a/scripts/before_deploy.ps1 b/scripts/before_deploy.ps1 deleted file mode 100644 index 57fbf53..0000000 --- a/scripts/before_deploy.ps1 +++ /dev/null @@ -1,23 +0,0 @@ -# This script takes care of packaging the build artifacts that will go in the -# release zipfile. - -$PKG_NAME = "path-clean" -$SRC_DIR = $PWD.Path -$STAGE = [System.Guid]::NewGuid().ToString() - -Set-Location $ENV:Temp -New-Item -Type Directory -Name $STAGE -Set-Location $STAGE - -$ZIP = "$SRC_DIR\$($Env:CRATE_NAME)-$($Env:APPVEYOR_REPO_TAG_NAME)-$($Env:TARGET).zip" - -Copy-Item "$SRC_DIR\target\$($Env:TARGET)\release\$PKG_NAME.exe" '.\' - -7z a "$ZIP" * - -Push-AppveyorArtifact "$ZIP" - -Remove-Item *.* -Force -Set-Location .. -Remove-Item $STAGE -Set-Location $SRC_DIR diff --git a/scripts/before_deploy.sh b/scripts/before_deploy.sh deleted file mode 100644 index 3449de3..0000000 --- a/scripts/before_deploy.sh +++ /dev/null @@ -1,32 +0,0 @@ -# This script takes care of building the crate and packaging it for release. - -PKG_NAME="path-clean" - -set -ex - -main() { - local src=$(pwd) \ - stage= - - case $TRAVIS_OS_NAME in - linux) - stage=$(mktemp -d) - ;; - osx) - stage=$(mktemp -d -t tmp) - ;; - esac - - test -f Cargo.lock || cargo generate-lockfile - - cross rustc --bin $PKG_NAME --target $TARGET --release -- -C lto - cp target/$TARGET/release/$PKG_NAME $stage/ - - cd $stage - tar czf $src/$CRATE_NAME-$TRAVIS_TAG-$TARGET.tar.gz * - cd $src - - rm -rf $stage -} - -main diff --git a/scripts/install.sh b/scripts/install.sh deleted file mode 100644 index a5e8415..0000000 --- a/scripts/install.sh +++ /dev/null @@ -1,43 +0,0 @@ -set -ex - -main() { - local target= - if [ $TRAVIS_OS_NAME = linux ]; then - target=x86_64-unknown-linux-musl - sort=sort - else - target=x86_64-apple-darwin - sort=gsort # for `sort --sort-version`, from brew's coreutils. - fi - - # Builds for iOS are done on OSX, but require the specific target to be - # installed. - case $TARGET in - aarch64-apple-ios) - rustup target install aarch64-apple-ios - ;; - armv7-apple-ios) - rustup target install armv7-apple-ios - ;; - armv7s-apple-ios) - rustup target install armv7s-apple-ios - ;; - i386-apple-ios) - rustup target install i386-apple-ios - ;; - x86_64-apple-ios) - rustup target install x86_64-apple-ios - ;; - esac - - # Install cross for linux cross compilation - if [ $TRAVIS_OS_NAME = linux ]; then - cargo install cross --force - fi - - # Install test dependencies - rustup component add rustfmt-preview - rustup component add clippy-preview -} - -main diff --git a/scripts/script.sh b/scripts/script.sh deleted file mode 100644 index 0f79667..0000000 --- a/scripts/script.sh +++ /dev/null @@ -1,31 +0,0 @@ -# This script takes care of testing the crate. - -set -ex - -main() { - # Use cross for linux, cargo for macOS and Windows - local cargo='' - if [ $TRAVIS_OS_NAME = linux ]; then - cargo='cross' - else - cargo='cargo' - fi - - $cargo build --target $TARGET - $cargo build --target $TARGET --release - - if [ ! -z $DISABLE_TESTS ]; then - return - fi - - $cargo fmt -- --check - $cargo clippy - - $cargo test --target $TARGET - $cargo test --target $TARGET --release -} - -# we don't run the "test phase" when doing deploys -if [ -z $TRAVIS_TAG ]; then - main -fi From d574c01951fa1847eb1e406fda2139b41554ab58 Mon Sep 17 00:00:00 2001 From: Dan Reeves Date: Sun, 26 Jul 2020 15:23:43 +0100 Subject: [PATCH 2/6] yaaaaaaaamlllllllllllll! --- .github/workflows/ci.yml | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index efdd99f..3de2827 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,27 +18,26 @@ jobs: matrix: os: [ubuntu-latest, windows-latest, macOS-latest] rust: [stable, nightly] + steps: + - uses: actions/checkout@master - steps: - - uses: actions/checkout@master - - - name: Install ${{ matrix.rust }} - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.rust }} - override: true + - name: Install ${{ matrix.rust }} + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + override: true - - name: check - uses: actions-rs/cargo@v1 - with: - command: check - args: --all --bins --examples + - name: check + uses: actions-rs/cargo@v1 + with: + command: check + args: --all --bins --examples - - name: tests - uses: actions-rs/cargo@v1 - with: - command: test - args: --all + - name: tests + uses: actions-rs/cargo@v1 + with: + command: test + args: --all check_fmt_and_docs: name: Checking fmt, clippy, and docs From f20508c1f6094393da6839375be144f16d3f89e9 Mon Sep 17 00:00:00 2001 From: Dan Reeves Date: Sun, 26 Jul 2020 15:27:24 +0100 Subject: [PATCH 3/6] on push to any branch --- .github/workflows/ci.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3de2827..4f12935 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,12 +1,7 @@ name: CI -on: - push: - branches: - - master - pull_request: - branches: - - master +on: [push, pull_request] + env: RUSTFLAGS: -Dwarnings From cffd89e33ee76954766898aacdc3fefaf6f3d9a4 Mon Sep 17 00:00:00 2001 From: Dan Reeves Date: Sun, 26 Jul 2020 15:29:27 +0100 Subject: [PATCH 4/6] dont have unstable features --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f12935..a0d3d3a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,4 +56,4 @@ jobs: run: cargo fmt --all -- --check - name: Docs - run: cargo doc --no-deps --features unstable + run: cargo doc --no-deps From 137a2ad20f36aeaf01b5ee1679d0a3d7b367f9cf Mon Sep 17 00:00:00 2001 From: Dan Reeves Date: Sun, 26 Jul 2020 15:35:43 +0100 Subject: [PATCH 5/6] add schedule --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a0d3d3a..e48e2c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,10 @@ name: CI -on: [push, pull_request] +on: + push: + pull_request: + schedule: + - cron: "0 9 7 * *" # Run on at 9am on the 7th of every month env: RUSTFLAGS: -Dwarnings From ee2aec9810e12602a0a7f7e6982740c3c1793449 Mon Sep 17 00:00:00 2001 From: Dan Reeves Date: Sun, 26 Jul 2020 15:44:55 +0100 Subject: [PATCH 6/6] Only run on push to master, pull_request captures pushes to PRs' --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e48e2c6..62ad027 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,8 @@ name: CI on: push: + branches: + - master pull_request: schedule: - cron: "0 9 7 * *" # Run on at 9am on the 7th of every month