From 1c83a635db5fa0d6fb7cbf98af3b8c45657725da Mon Sep 17 00:00:00 2001 From: Devdutt Shenoi Date: Mon, 25 Nov 2024 16:06:52 +0530 Subject: [PATCH 1/4] ci: cache rust builds to speed up compilations --- .github/workflows/integration-test.yaml | 21 ++++++++++++--------- .github/workflows/lint.yaml | 18 +++++++++++++----- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/.github/workflows/integration-test.yaml b/.github/workflows/integration-test.yaml index fac178932..542a5a8ac 100644 --- a/.github/workflows/integration-test.yaml +++ b/.github/workflows/integration-test.yaml @@ -3,23 +3,24 @@ name: Integration on: pull_request: paths-ignore: - - 'docs/**' - - 'helm/**' - - 'assets/**' - - '**.md' + - "docs/**" + - "helm/**" + - "assets/**" + - "**.md" jobs: - docker-compose-test: name: Quest Smoke and Load Tests for Standalone deployments runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 + with: + shared-key: "target-cache" - name: Start compose run: docker compose -f docker-compose-test.yaml up --build --exit-code-from quest - name: Stop compose - if: always() run: docker compose -f docker-compose-test.yaml down docker-compose-distributed-test: @@ -27,9 +28,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 + with: + shared-key: "target-cache" - name: Start compose run: docker compose -f docker-compose-distributed-test.yaml up --build --exit-code-from quest - name: Stop compose - if: always() run: docker compose -f docker-compose-distributed-test.yaml down diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 4f2578cf5..c2fe42e34 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -3,17 +3,16 @@ name: Linter on: pull_request: paths-ignore: - - 'docs/**' - - 'helm/**' - - 'assets/**' - - '**.md' + - "docs/**" + - "helm/**" + - "assets/**" + - "**.md" env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} jobs: - unit-tests: name: Unit tests runs-on: ubuntu-latest @@ -24,6 +23,9 @@ jobs: profile: minimal toolchain: stable override: true + - uses: Swatinem/rust-cache@v2 + with: + shared-key: "target-cache" - uses: actions-rs/cargo@v1 with: command: test @@ -38,6 +40,9 @@ jobs: profile: minimal toolchain: stable override: true + - uses: Swatinem/rust-cache@v2 + with: + shared-key: "target-cache" - run: rustup component add rustfmt - uses: actions-rs/cargo@v1 with: @@ -54,6 +59,9 @@ jobs: profile: minimal toolchain: stable override: true + - uses: Swatinem/rust-cache@v2 + with: + shared-key: "target-cache" - run: rustup component add clippy - uses: actions-rs/cargo@v1 with: From fbda83c56c10dbd03e16c215f74fab0ec52da028 Mon Sep 17 00:00:00 2001 From: Devdutt Shenoi Date: Mon, 25 Nov 2024 17:26:39 +0530 Subject: [PATCH 2/4] ci: pull = lint+integration --- .github/workflows/integration-test.yaml | 38 -------------- .github/workflows/{lint.yaml => pull.yaml} | 59 +++++++++++++--------- 2 files changed, 34 insertions(+), 63 deletions(-) delete mode 100644 .github/workflows/integration-test.yaml rename .github/workflows/{lint.yaml => pull.yaml} (55%) diff --git a/.github/workflows/integration-test.yaml b/.github/workflows/integration-test.yaml deleted file mode 100644 index 542a5a8ac..000000000 --- a/.github/workflows/integration-test.yaml +++ /dev/null @@ -1,38 +0,0 @@ -name: Integration - -on: - pull_request: - paths-ignore: - - "docs/**" - - "helm/**" - - "assets/**" - - "**.md" - -jobs: - docker-compose-test: - name: Quest Smoke and Load Tests for Standalone deployments - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - uses: Swatinem/rust-cache@v2 - with: - shared-key: "target-cache" - - name: Start compose - run: docker compose -f docker-compose-test.yaml up --build --exit-code-from quest - - name: Stop compose - run: docker compose -f docker-compose-test.yaml down - - docker-compose-distributed-test: - name: Quest Smoke and Load Tests for Distributed deployments - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - uses: Swatinem/rust-cache@v2 - with: - shared-key: "target-cache" - - name: Start compose - run: docker compose -f docker-compose-distributed-test.yaml up --build --exit-code-from quest - - name: Stop compose - run: docker compose -f docker-compose-distributed-test.yaml down diff --git a/.github/workflows/lint.yaml b/.github/workflows/pull.yaml similarity index 55% rename from .github/workflows/lint.yaml rename to .github/workflows/pull.yaml index c2fe42e34..52efb6858 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/pull.yaml @@ -1,4 +1,4 @@ -name: Linter +name: Integration on: pull_request: @@ -8,13 +8,9 @@ on: - "assets/**" - "**.md" -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - jobs: - unit-tests: - name: Unit tests + fmt: + name: Rust fmt and clippy runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -26,12 +22,18 @@ jobs: - uses: Swatinem/rust-cache@v2 with: shared-key: "target-cache" + - run: rustup component add rustfmt clippy - uses: actions-rs/cargo@v1 with: - command: test + command: fmt + args: --all -- --check + - uses: actions-rs/cargo@v1 + with: + command: clippy + args: -- -D warnings - fmt: - name: Rust fmt check + unit-tests: + name: Unit tests runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -43,27 +45,34 @@ jobs: - uses: Swatinem/rust-cache@v2 with: shared-key: "target-cache" - - run: rustup component add rustfmt - uses: actions-rs/cargo@v1 with: - command: fmt - args: --all -- --check + command: test - clippy: - name: Cargo Clippy check + docker-compose-test: + name: Quest Smoke and Load Tests for Standalone deployments runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true + - name: Checkout + uses: actions/checkout@v4 - uses: Swatinem/rust-cache@v2 with: shared-key: "target-cache" - - run: rustup component add clippy - - uses: actions-rs/cargo@v1 + - name: Start compose + run: docker compose -f docker-compose-test.yaml up --build --exit-code-from quest + - name: Stop compose + run: docker compose -f docker-compose-test.yaml down + + docker-compose-distributed-test: + name: Quest Smoke and Load Tests for Distributed deployments + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 with: - command: clippy - args: -- -D warnings + shared-key: "target-cache" + - name: Start compose + run: docker compose -f docker-compose-distributed-test.yaml up --build --exit-code-from quest + - name: Stop compose + run: docker compose -f docker-compose-distributed-test.yaml down From 077a3930adb027b188f9edf1b7d36be40393de06 Mon Sep 17 00:00:00 2001 From: Devdutt Shenoi Date: Mon, 25 Nov 2024 17:30:52 +0530 Subject: [PATCH 3/4] fix: docker warning --- Dockerfile | 2 +- Dockerfile.debug | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index cfd88348b..a1c446862 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ # along with this program. If not, see . # build stage -FROM rust:1.77.1-bookworm as builder +FROM rust:1.77.1-bookworm AS builder LABEL org.opencontainers.image.title="Parseable" LABEL maintainer="Parseable Team " diff --git a/Dockerfile.debug b/Dockerfile.debug index acbc44698..a1846d4a7 100644 --- a/Dockerfile.debug +++ b/Dockerfile.debug @@ -14,7 +14,7 @@ # along with this program. If not, see . # build stage -FROM rust:1.77.1-bookworm as builder +FROM rust:1.77.1-bookworm AS builder LABEL org.opencontainers.image.title="Parseable" LABEL maintainer="Parseable Team " From f5591a72502045a718e99a571f7cd86f2c29c7b9 Mon Sep 17 00:00:00 2001 From: Devdutt Shenoi Date: Mon, 25 Nov 2024 17:31:45 +0530 Subject: [PATCH 4/4] ignore scripts on build --- .github/workflows/build-push-edge-debug.yaml | 11 ++++++----- .github/workflows/build-push-edge.yaml | 11 ++++++----- .github/workflows/pull.yaml | 3 ++- .github/workflows/release.yml | 3 ++- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-push-edge-debug.yaml b/.github/workflows/build-push-edge-debug.yaml index 6fe503bfc..f93b01d2d 100644 --- a/.github/workflows/build-push-edge-debug.yaml +++ b/.github/workflows/build-push-edge-debug.yaml @@ -3,12 +3,13 @@ name: Build and push edge debug tag on: push: branches: - - 'main' + - "main" paths-ignore: - - 'docs/**' - - 'helm/**' - - 'assets/**' - - '**.md' + - "assets/**" + - "docs/**" + - "helm/**" + - "scripts/**" + - "**.md" jobs: docker: diff --git a/.github/workflows/build-push-edge.yaml b/.github/workflows/build-push-edge.yaml index a93e6673e..cb002635e 100644 --- a/.github/workflows/build-push-edge.yaml +++ b/.github/workflows/build-push-edge.yaml @@ -3,12 +3,13 @@ name: Build and push edge tag on: push: branches: - - 'main' + - "main" paths-ignore: - - 'docs/**' - - 'helm/**' - - 'assets/**' - - '**.md' + - "assets/**" + - "docs/**" + - "helm/**" + - "scripts/**" + - "**.md" jobs: docker: diff --git a/.github/workflows/pull.yaml b/.github/workflows/pull.yaml index 52efb6858..d18fc8869 100644 --- a/.github/workflows/pull.yaml +++ b/.github/workflows/pull.yaml @@ -3,9 +3,10 @@ name: Integration on: pull_request: paths-ignore: + - "assets/**" - "docs/**" - "helm/**" - - "assets/**" + - "scripts/**" - "**.md" jobs: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 770a5af1e..dd06b49bc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,9 +5,10 @@ on: tags: - v[0-9]+.[0-9]+.[0-9]+* paths-ignore: + - "assets/**" - "docs/**" - "helm/**" - - "assets/**" + - "scripts/**" - "**.md" jobs: