diff --git a/.circleci/config.yml b/.circleci/config.yml index 85c64dec0d..60f3259c2b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,16 +7,13 @@ # pushed to `quay.io/influxdb/rust:ci`. This build image is then used to run # the CI tasks for the day. # -# Each CI run: -# -# Runs tests, fmt, & lints and then compiles binaries using the default cargo -# target ("dev"). -# # CI runs for git branches ending in `/perf`: # # Runs tests, fmt, & lints and then compiles binaries using the "release" # cargo target and pushes a container with the binary to # `quay.io/influxdb/fusion` (see perf_image below). +# +# CI for all other branches is performed by the GitHub actions (see .github dir) version: 2.1 diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000000..ea2a869ee6 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,87 @@ +# CI Overview +# ----------- +# +# All pushes and PRs (including from forks) run: +# +# - cargo build with the default cargo profile ("dev") +# - cargo test +# - cargo fmt +# - clippy (with warnings denied) +# +# All workflow actions make use of our build container +# (`quay.io/influxdb/rust:ci`) to satisfy system dependencies, and is updated +# nightly. +# +# Cargo's build artefacts are cached to reduce the build time, see +# https://github.com/actions/cache for more info. + +on: [push, pull_request] + +name: ci + +jobs: + + build: + name: Build + runs-on: ubuntu-latest + container: + image: quay.io/influxdb/rust:ci + # Run as the "root" user in the build container to fix workspace & cache + # permission errors. + options: --user root + steps: + # Checkout the code + - uses: actions/checkout@v2 + + # Enable caching of build artefacts + - uses: actions/cache@v2 + with: + path: target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + # Build! + - name: Run dev build + uses: actions-rs/cargo@v1 + with: + command: build + args: --workspace + + test: + name: Test + runs-on: ubuntu-latest + container: + image: quay.io/influxdb/rust:ci + options: --user root + steps: + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Run tests + uses: actions-rs/cargo@v1 + with: + command: test + args: --workspace + + lints: + name: Lints + runs-on: ubuntu-latest + container: + image: quay.io/influxdb/rust:ci + options: --user root + steps: + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Run cargo fmt + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + - uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --all-targets --workspace -- -D warnings