From 85a6c95a695d645933a7569206ba823dd78fc725 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Tue, 16 Mar 2021 20:24:16 -0400 Subject: [PATCH] switch CI to github actions --- .circleci/config.yml | 42 -------------------- .github/workflows/ci.yml | 83 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 42 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/ci.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 8038a2c0..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,42 +0,0 @@ -restore_registry: &RESTORE_REGISTRY - restore_cache: - key: registry -save_registry: &SAVE_REGISTRY - save_cache: - key: registry-{{ .BuildNum }} - paths: - - /usr/local/cargo/registry/index -deps_key: &DEPS_KEY - key: deps-{{ checksum "~/rust-version" }}-{{ checksum "Cargo.lock" }} -restore_deps: &RESTORE_DEPS - restore_cache: - <<: *DEPS_KEY -save_deps: &SAVE_DEPS - save_cache: - <<: *DEPS_KEY - paths: - - target - - /usr/local/cargo/registry/cache - -version: 2 -jobs: - build: - docker: - - image: rust:1.45.0 - environment: - RUSTFLAGS: -D warnings - - image: sfackler/rust-postgres-test:6 - steps: - - checkout - - run: rustup component add rustfmt clippy - - *RESTORE_REGISTRY - - run: cargo generate-lockfile - - *SAVE_REGISTRY - - run: rustc --version > ~/rust-version - - *RESTORE_DEPS - - run: cargo fmt --all -- --check - - run: cargo clippy --all --all-targets --all-features - - run: cargo test --all - - run: cargo test --manifest-path tokio-postgres/Cargo.toml --no-default-features - - run: cargo test --manifest-path tokio-postgres/Cargo.toml --all-features - - *SAVE_DEPS diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..7191eb9e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,83 @@ +name: CI + +on: + pull_request: + branches: + - master + push: + branches: + - master + +env: + RUSTFLAGS: -Dwarnings + RUST_BACKTRACE: 1 + +jobs: + rustfmt: + name: rustfmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: sfackler/actions/rustup@master + - uses: sfackler/actions/rustfmt@master + + clippy: + name: clippy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: sfackler/actions/rustup@master + - run: echo "::set-output name=version::$(rustc --version)" + id: rust-version + - uses: actions/cache@v1 + with: + path: ~/.cargo/registry/index + key: index-${{ runner.os }}-${{ github.run_number }} + restore-keys: | + index-${{ runner.os }}- + - run: cargo generate-lockfile + - uses: actions/cache@v1 + with: + path: ~/.cargo/registry/cache + key: registry-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }} + - run: cargo fetch + - uses: actions/cache@v1 + with: + path: target + key: clippy-target-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}y + - run: cargo clippy --all --all-targets + + test: + name: test + runs-on: ubuntu-latest + services: + postgres: + image: sfackler/rust-postgres-test:6 + ports: + - 5433:5433 + steps: + - uses: actions/checkout@v2 + - uses: sfackler/actions/rustup@master + with: + version: 1.45.0 + - run: echo "::set-output name=version::$(rustc --version)" + id: rust-version + - uses: actions/cache@v1 + with: + path: ~/.cargo/registry/index + key: index-${{ runner.os }}-${{ github.run_number }} + restore-keys: | + index-${{ runner.os }}- + - run: cargo generate-lockfile + - uses: actions/cache@v1 + with: + path: ~/.cargo/registry/cache + key: registry-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }} + - run: cargo fetch + - uses: actions/cache@v1 + with: + path: target + key: test-target-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}y + - run: cargo test --all + - run: cargo test --manifest-path tokio-postgres/Cargo.toml --no-default-features + - run: cargo test --manifest-path tokio-postgres/Cargo.toml --all-features