From d4aef0f342b388109ad78ad70496424b947812a2 Mon Sep 17 00:00:00 2001 From: Maxim Ivanitskiy Date: Tue, 29 Aug 2023 15:05:04 -0700 Subject: [PATCH] ci: run clippy in GitHub Actions --- .github/workflows/ci.yaml | 89 +++++++++++++++++++++++++++++---------- 1 file changed, 67 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d6deae7..ef772ea 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -4,6 +4,7 @@ on: [ push, pull_request ] env: CARGO_TERM_COLOR: always + ZLIB_VERSION: "1.3" jobs: test-linux: @@ -33,8 +34,11 @@ jobs: .cache/*.tar.sig key: nginx-${{ hashFiles('**/nginx-sys/build.rs') }} restore-keys: nginx- - - name: run tests in container - run: make container-test + - name: run tests + uses: actions-rs/cargo@v1 + with: + command: test + args: --verbose test-macos: name: Test (MacOS) @@ -53,12 +57,14 @@ jobs: continue-on-error: false with: path: | + ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - key: ${{ runner.os }}-cargo - restore-keys: ${{ runner.os }}-cargo - - name: set up nginx source binary cache + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- + - name: set up nginx deps cache uses: actions/cache@v3 continue-on-error: false with: @@ -67,8 +73,8 @@ jobs: .cache/*.tar.gz .cache/*.tar.asc .cache/*.tar.sig - key: nginx-${{ hashFiles('**/nginx-sys/build.rs') }} - restore-keys: nginx- + key: ${{ runner.os }}-deps-${{ hashFiles('**/nginx-sys/build.rs') }} + restore-keys: ${{ runner.os }}-deps- - name: run tests uses: actions-rs/cargo@v1 env: @@ -93,21 +99,60 @@ jobs: command: fmt args: --all -- --check -# clippy: -# name: Clippy -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v3 -# - uses: actions-rs/toolchain@v1 -# with: -# profile: minimal -# toolchain: stable -# override: true -# - run: rustup component add clippy -# - uses: actions-rs/cargo@v1 -# with: -# command: clippy -# args: -- -D warnings + clippy: + name: Clippy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: set up cargo cache + uses: actions/cache@v3 + continue-on-error: false + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- + - name: set up nginx deps source cache + uses: actions/cache@v3 + continue-on-error: false + with: + path: | + .cache/.gnupg + .cache/*.tar.gz + .cache/*.tar.asc + .cache/*.tar.sig + key: ${{ runner.os }}-deps-${{ hashFiles('**/nginx-sys/build.rs') }} + restore-keys: ${{ runner.os }}-deps- + - name: Install dependencies + run: | + sudo apt-get -qq update + sudo apt-get -qq install --yes --no-install-recommends --no-install-suggests \ + libclang-dev \ + libssl-dev \ + pkg-config \ + git \ + grep \ + gawk \ + gnupg2 \ + sed \ + make + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + components: rustfmt, clippy + # - name: run clippy + # continue-on-error: true + # run: cargo clippy -- -D warnings + - uses: actions-rs/cargo@v1 + with: + command: clippy + args: -- -D warnings # docs: # name: Docs