From a8b185d344553402b3ac6ab269844b1c746e7051 Mon Sep 17 00:00:00 2001 From: Hiram Chirino Date: Wed, 22 May 2024 11:14:36 -0400 Subject: [PATCH 1/2] GitHub CI improvements. * Only run the image build on main and tags (not needed on feature branches). * Cache rust dependencies to speed builds up. --- .github/workflows/build-image.yaml | 6 ++++-- .github/workflows/coverage.yml | 2 ++ .github/workflows/e2e.yaml | 2 +- .github/workflows/rust.yml | 7 ++++++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-image.yaml b/.github/workflows/build-image.yaml index 9e6d73a6..617f2f10 100644 --- a/.github/workflows/build-image.yaml +++ b/.github/workflows/build-image.yaml @@ -4,8 +4,10 @@ name: Build Image on: workflow_dispatch: push: - branches: ['*'] - tags: ['*'] + branches: + - main + tags: + - "*" env: IMG_REGISTRY_HOST: quay.io diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index b5c4676b..847ee72f 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -13,6 +13,7 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions-rust-lang/setup-rust-toolchain@v1 + - uses: Swatinem/rust-cache@v2 - uses: abelfodil/protoc-action@v1 with: protoc-version: '3.19.4' @@ -33,6 +34,7 @@ jobs: - uses: actions-rust-lang/setup-rust-toolchain@v1 with: toolchain: nightly + - uses: Swatinem/rust-cache@v2 - uses: abelfodil/protoc-action@v1 with: protoc-version: '3.19.4' diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 83af14a6..0daa08b5 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -3,7 +3,7 @@ name: e2e tests on: push: branches: - - '*' + - 'main' pull_request: branches: - '*' diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index ab08343f..c20ff16a 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -4,7 +4,7 @@ name: Limitador on: push: branches: - - '*' + - 'main' pull_request: branches: - '*' @@ -18,6 +18,7 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions-rust-lang/setup-rust-toolchain@v1 + - uses: Swatinem/rust-cache@v2 - uses: abelfodil/protoc-action@v1 with: protoc-version: '3.19.4' @@ -32,6 +33,7 @@ jobs: with: redis-version: 7 - uses: actions-rust-lang/setup-rust-toolchain@v1 + - uses: Swatinem/rust-cache@v2 - uses: abelfodil/protoc-action@v1 with: protoc-version: '3.19.4' @@ -45,6 +47,7 @@ jobs: - uses: actions-rust-lang/setup-rust-toolchain@v1 with: components: rustfmt + - uses: Swatinem/rust-cache@v2 - run: cargo fmt --all -- --check clippy: @@ -55,6 +58,7 @@ jobs: - uses: actions-rust-lang/setup-rust-toolchain@v1 with: components: clippy + - uses: Swatinem/rust-cache@v2 - uses: abelfodil/protoc-action@v1 with: protoc-version: '3.19.4' @@ -69,6 +73,7 @@ jobs: with: redis-version: 7 - uses: actions-rust-lang/setup-rust-toolchain@v1 + - uses: Swatinem/rust-cache@v2 - uses: abelfodil/protoc-action@v1 with: protoc-version: '3.19.4' From 1c0321e6f40a97da640dcace736c1aa1cfe7ec3c Mon Sep 17 00:00:00 2001 From: Hiram Chirino Date: Wed, 22 May 2024 11:36:30 -0400 Subject: [PATCH 2/2] =?UTF-8?q?Move=20benchmarking=20to=20it=E2=80=99s=20o?= =?UTF-8?q?wn=20workflow=20file,=20only=20run=20it=20on=20main=20and=20tag?= =?UTF-8?q?s.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Hiram Chirino --- .github/workflows/bench.yml | 26 ++++++++++++++++++++++++++ .github/workflows/rust.yml | 15 --------------- 2 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/bench.yml diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml new file mode 100644 index 00000000..eb16a0a6 --- /dev/null +++ b/.github/workflows/bench.yml @@ -0,0 +1,26 @@ +--- +name: Benchmark + +on: + workflow_dispatch: + push: + branches: + - main + tags: + - "*" + +jobs: + bench: + name: Benchmark + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: supercharge/redis-github-action@1.1.0 + with: + redis-version: 7 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + - uses: Swatinem/rust-cache@v2 + - uses: abelfodil/protoc-action@v1 + with: + protoc-version: '3.19.4' + - run: cargo bench diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c20ff16a..df8931c7 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -64,21 +64,6 @@ jobs: protoc-version: '3.19.4' - run: cargo clippy --all-features --all-targets -- -D warnings - bench: - name: Bench - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: supercharge/redis-github-action@1.1.0 - with: - redis-version: 7 - - uses: actions-rust-lang/setup-rust-toolchain@v1 - - uses: Swatinem/rust-cache@v2 - - uses: abelfodil/protoc-action@v1 - with: - protoc-version: '3.19.4' - - run: cargo bench - kind: name: Try in kind (Kubernetes in Docker) runs-on: ubuntu-latest