Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use actions-rust-lang/setup-rust-toolchain@v1 & docker/setup-buildx-action@v3 for e2e #221

Merged
merged 1 commit into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,19 @@
Dockerfile
*.swp
.dockerignore
.gitignore
.git

.github
doc
.idea
**/*.yaml
**/*.md
**/*.json
**/*.sh
**/*.png
**/*.svg
# OSX files
.DS_Store
.DS_Store

# Exception - Used in docker build
!limitador-server/examples/limits.yaml
2 changes: 1 addition & 1 deletion .github/workflows/build-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Add latest tag
if: ${{ github.ref_name == env.MAIN_BRANCH_NAME }}
run: |
Expand Down
14 changes: 4 additions & 10 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@ jobs:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: abelfodil/protoc-action@v1
with:
protoc-version: '3.19.4'
Expand All @@ -36,17 +32,15 @@ jobs:
USER: username
PASS: password
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: supercharge/[email protected]
with:
redis-version: 5
# Nightly is required for code coverage with doctests
# https://github.com/taiki-e/cargo-llvm-cov/issues/2
- uses: actions-rs/toolchain@v1
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- uses: abelfodil/protoc-action@v1
with:
protoc-version: '3.19.4'
Expand Down
30 changes: 20 additions & 10 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,30 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
limitador-testing
tags: |
type=raw,value=latest
- name: Build Limitador Image
id: build-image
uses: redhat-actions/buildah-build@v2
uses: docker/build-push-action@v5
Copy link
Contributor Author

@KevFan KevFan Oct 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar changes were not done to

due to issues mentioned by #215.

Additionally as we pass the GITHUB_SHA build arg to the dockerfile, we always compile and build on each push as the SHA is always different, so this won't pull from cache anyway which is the most time intensive layer

build-args: |
GITHUB_SHA=${{ github.sha }}

ARG GITHUB_SHA

with:
image: limitador-testing
tags: latest
dockerfiles: |
./Dockerfile
context: .
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
load: true
- name: Create k8s Kind Cluster
uses: helm/kind-action@v1.1.0
uses: helm/kind-action@v1.8.0
with:
version: v0.11.1
version: v0.20.0
config: limitador-server/script/kind-cluster.yaml
cluster_name: limitador-local
wait: 120s
Expand All @@ -34,8 +45,7 @@ jobs:
kubectl cluster-info dump
- name: Load limitador docker image
run: |
podman save -o image.tar ${{ steps.build-image.outputs.image }}:${{ steps.build-image.outputs.tags }}
kind load image-archive --name limitador-local image.tar
kind load docker-image ${{ steps.meta.outputs.tags }} -n limitador-local
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kind loads from docker image? Great!

- name: Deploy limitador
run: |
kubectl apply -f limitador-server/e2e/file-watcher/configmap.yaml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: supercharge/[email protected]
with:
redis-version: 5
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: crate-v${{ github.event.inputs.version }}
- name: Build
Expand Down
80 changes: 21 additions & 59 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,12 @@ jobs:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: abelfodil/protoc-action@v1
with:
protoc-version: '3.19.4'
- uses: actions-rs/cargo@v1
with:
command: check
- run: cargo check

test:
name: Test Suite
Expand All @@ -41,100 +35,68 @@ jobs:
USER: username
PASS: password
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: supercharge/[email protected]
with:
redis-version: 5
# Nightly is required for code coverage with doctests
# https://github.com/taiki-e/cargo-llvm-cov/issues/2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: abelfodil/protoc-action@v1
with:
protoc-version: '3.19.4'
- uses: actions-rs/cargo@v1
with:
command: test
args: --all-features -vv
- run: cargo test --all-features -vv

fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
command: fmt
args: --all -- --check
components: rustfmt
- run: cargo fmt --all -- --check

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add clippy
components: clippy
- uses: abelfodil/protoc-action@v1
with:
protoc-version: '3.19.4'
- uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features --all-targets -- -D warnings
- run: cargo clippy --all-features --all-targets -- -D warnings

bench:
name: Bench
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: supercharge/[email protected]
with:
redis-version: 5
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: abelfodil/protoc-action@v1
with:
protoc-version: '3.19.4'
- uses: actions-rs/cargo@v1
with:
command: bench
- run: cargo bench

wasm-build:
name: Build for WASM
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
override: true
- uses: actions-rs/cargo@v1
with:
command: build
args: --target=wasm32-unknown-unknown --no-default-features --lib --manifest-path ./limitador/Cargo.toml
- run: cargo build --target=wasm32-unknown-unknown --no-default-features --lib --manifest-path ./limitador/Cargo.toml

kind:
name: Try in kind (Kubernetes in Docker)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4
- uses: engineerd/[email protected]
with:
version: v0.11.1
Expand Down
2 changes: 1 addition & 1 deletion limitador-server/e2e/file-watcher/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
spec:
containers:
- name: limitador
image: localhost/limitador-testing:latest
image: limitador-testing:latest
imagePullPolicy: IfNotPresent
env:
- name: RUST_LOG
Expand Down
Loading