From 43ead2edb82b2cddcd428efd268d8a83dd01e36e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 20 Sep 2020 13:20:12 +0200 Subject: [PATCH] Add CI --- .github/FUNDING.yml | 1 + .github/workflows/ci.yml | 75 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 .github/FUNDING.yml create mode 100644 .github/workflows/ci.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..816a2e5 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: qarmin diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..163b672 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,75 @@ +name: CI + +on: + push: + branches: [master] + pull_request: + branches: [master] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + strategy: + matrix: + toolchain: [stable, nightly] + os: [ubuntu-20.04] + runs-on: ${{ matrix.os }} + needs: clean + steps: + - uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.toolchain }} + override: true + + - uses: actions/cache@v2 + with: + path: | + target + key: ${{ runner.os }}-cargo-check-test-${{ matrix.toolchain }}-${{ hashFiles('**/Cargo.lock') }} + + - name: Install Gtk + run: sudo apt-get update; sudo apt install -y libgtk-3-dev + if: ${{ runner.os == 'Linux' }} + + - name: Build + run: cargo check --all + env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-C debuginfo=0 -D warnings" + + - name: Run tests + run: cargo test + if: ${{ runner.os == 'Linux' }} + env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-C debuginfo=0 -D warnings" + + clean: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: rustfmt, clippy + override: true + + - name: Install Gtk + run: sudo apt install -y libgtk-3-dev + + - name: Check the format + run: cargo fmt --all -- --check + + # type complexity must be ignored because we use huge templates for queries + - name: Run clippy + run: > + cargo clippy + --all-targets + --all-features + -- + -D warnings