chore: add rate limiting #312
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build_go: | |
name: Build (Go) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
binary: | |
- s3 | |
- dynamo | |
- gateway | |
- cli | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
- name: Setup Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: ${{ matrix.binary }}/go.mod | |
check-latest: true | |
- name: Install dependencies | |
run: | | |
brew update | |
brew install protobuf protoc-gen-go protoc-gen-go-grpc | |
- name: Compile proto files | |
if: matrix.binary != 'cli' | |
run: make compile_${{ matrix.binary }} | |
- name: Build and run short tests | |
run: make build_${{ matrix.binary }} | |
- name: Run golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.54 | |
working-directory: ${{ matrix.binary }} | |
skip-pkg-cache: true | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Setup docker buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: ${{ matrix.binary }} | |
platforms: linux/arm64,linux/amd64 | |
push: true | |
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}/${{ matrix.binary }}:cache | |
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/${{ matrix.binary }}:cache,mode=max | |
tags: | | |
ghcr.io/${{ github.repository }}/${{ matrix.binary }}:latest | |
ghcr.io/${{ github.repository }}/${{ matrix.binary }}:1.0.0 | |
ci_go: | |
name: CI (Go) | |
needs: build_go | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- environment: consul | |
rollouts-enabled: false | |
- environment: nginx | |
rollouts-enabled: false | |
- environment: nginx | |
rollouts-enabled: true | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
- name: Setup Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.go-version }} | |
check-latest: true | |
- name: Install dependencies | |
run: | | |
brew update | |
brew install protobuf protoc-gen-go protoc-gen-go-grpc kind terraform k6 | |
- name: Run all tests | |
env: | |
ENVIRONMENT: ${{ matrix.environment }} | |
TF_VAR_argorollouts_enabled: ${{ matrix.rollouts-enabled }} | |
run: make go_ci | |
build_rust: | |
name: Build (Rust) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- binary: sql | |
feature: postgres | |
- binary: sql | |
feature: mysql | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
components: rustfmt, clippy | |
target: x86_64-unknown-linux-musl | |
- name: Install dependencies | |
run: | | |
sudo apt-get install musl-tools | |
brew update | |
brew install protobuf | |
- name: Run cargo linters | |
env: | |
FEATURE: ${{ matrix.feature }} | |
run: make lint_${{ matrix.binary }} | |
- name: Build and run short tests | |
env: | |
FEATURE: ${{ matrix.feature }} | |
run: make build_${{ matrix.binary }} | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Setup docker buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: ${{ matrix.binary }} | |
platforms: linux/arm64,linux/amd64 | |
push: true | |
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}/${{ matrix.binary }}-${{ matrix.feature }}:cache | |
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/${{ matrix.binary }}-${{ matrix.feature }}:cache,mode=max | |
build-args: feature=${{ matrix.feature }} | |
tags: | | |
ghcr.io/${{ github.repository }}/${{ matrix.binary }}-${{ matrix.feature }}:latest | |
ghcr.io/${{ github.repository }}/${{ matrix.binary }}-${{ matrix.feature }}:1.0.0 | |
ci_rust: | |
name: CI (Rust) | |
needs: build_rust | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt, clippy | |
target: x86_64-unknown-linux-musl | |
- name: Install dependencies | |
run: | | |
sudo apt-get install musl-tools | |
brew update | |
brew install protobuf kind terraform k6 | |
- name: Run all tests | |
env: | |
ENVIRONMENT: haproxy | |
run: make rust_ci |