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

Deps updated. #160

Merged
merged 23 commits into from
Dec 11, 2024
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
35 changes: 35 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

on:
workflow_dispatch:
release:
types:
- released

jobs:
upload_docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install dependencies
run: pip install mkdocs-material pygments
- name: Build docs
run: mkdocs build -d /tmp/docs
- uses: actions/checkout@v2
with:
ref: gh-pages
- name: Commit files
run: |
ls -A | grep -vE "^(.git|.gitignore|helm_releases)" | xargs rm -rfv
cp -a /tmp/docs/. .
git config --local user.email "${{ github.actor }}@users.noreply.github.com"
git config --local user.name "${{ github.actor }}"
git add .
git commit -m "Docs update"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
135 changes: 30 additions & 105 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Release

on:
push:
tags:
- '*'
release:
types: [released]

permissions:
contents: write
packages: write

jobs:
publish:
Expand Down Expand Up @@ -43,7 +46,6 @@ jobs:
architecture: arm64
binary-postfix: ""
use-cross: true

steps:
- name: Checkout repository
uses: actions/checkout@v2
Expand All @@ -60,31 +62,18 @@ jobs:
command: build
use-cross: ${{ matrix.job.use-cross }}
toolchain: ${{ matrix.rust }}
args: --release --features=all --target ${{ matrix.job.target }}
args: --release --target ${{ matrix.job.target }}
env:
JEMALLOC_SYS_WITH_MALLOC_CONF: "background_thread:true,metadata_thp:auto,tcache:false,dirty_decay_ms:30000,muzzy_decay_ms:30000,abort_conf:true"

- name: install strip command
shell: bash
run: |
if [[ ${{ matrix.job.target }} == aarch64-unknown-linux-gnu ]]; then
sudo apt update
sudo apt-get install -y binutils-aarch64-linux-gnu
fi
- name: Packaging final binary
shell: bash
run: |
cd target/${{ matrix.job.target }}/release

####### reduce binary size by removing debug symbols #######
BINARY_NAME=rustus${{ matrix.job.binary-postfix }}
if [[ ${{ matrix.job.target }} == aarch64-unknown-linux-gnu ]]; then
GCC_PREFIX="aarch64-linux-gnu-"
else
GCC_PREFIX=""
fi
"$GCC_PREFIX"strip $BINARY_NAME

########## create tar.gz ##########
RELEASE_NAME=rustus-${GITHUB_REF/refs\/tags\//}-${{ matrix.job.os-name }}-${{ matrix.job.architecture }}
RELEASE_NAME=rustus-${{ github.ref_name }}-${{ matrix.job.os-name }}-${{ matrix.job.architecture }}
tar czvf $RELEASE_NAME.tar.gz $BINARY_NAME

########## create sha256 ##########
Expand Down Expand Up @@ -114,106 +103,42 @@ jobs:
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Export version
run: echo "APP_VERSION=$(head -n 5 Cargo.toml | grep version | cut -d '"' -f2)" >> $GITHUB_ENV
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
file: deploy/Dockerfile
file: ./Dockerfile
target: base
tags: s3rius/rustus:latest,s3rius/rustus:${{env.APP_VERSION}}
platforms: linux/amd64
tags: ghcr.io/s3rius/rustus:latest,ghcr.io/s3rius/rustus:${{ github.ref_name }}
- name: Build and push rootless
uses: docker/build-push-action@v2
with:
context: .
push: true
file: deploy/Dockerfile
file: ./Dockerfile
target: rootless
tags: s3rius/rustus:${{env.APP_VERSION}}-rootless
platforms: linux/amd64
tags: ghcr.io/s3rius/rustus:${{ github.ref_name }}-rootless

upload_helm:
runs-on: ubuntu-latest
needs: [docker_build]
steps:
- uses: actions/checkout@v2
- name: Export version
run: echo "APP_VERSION=$(head -n 5 Cargo.toml | grep version | cut -d '"' -f2)" >> $GITHUB_ENV
- name: Publish Helm charts
uses: stefanprodan/helm-gh-pages@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
charts_dir: deploy
target_dir: helm_releases
app_version: ${{env.APP_VERSION}}

upload_docs:
runs-on: ubuntu-latest
needs:
- upload_helm
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: azure/setup-helm@v4.2.0
with:
python-version: 3.x
- name: Install dependencies
run: pip install mkdocs-material pygments
- name: Build docs
run: mkdocs build -d /tmp/docs
- uses: actions/checkout@v2
with:
ref: gh-pages
- name: Commit files
version: latest
- name: Build Helm chart
run: |
ls -A | grep -vE "^(.git|.gitignore|helm_releases)" | xargs rm -rfv
cp -a /tmp/docs/. .
git config --local user.email "s3rius@users.noreply.github.com"
git config --local user.name "s3rius"
git add .
git commit -m "Docs update"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
helm package --app-version "${{ github.ref_name }}" --dependency-update ./helm
helm show chart *.tgz
helm registry login -u "${{ github.actor }}" -p "${{ secrets.GITHUB_TOKEN }}" ghcr.io
helm push *.tgz oci://ghcr.io/s3rius/charts
env:
HELM_EXPERIMENTAL_OCI: 1

docker_build_alpine:
runs-on: ubuntu-latest
needs:
- publish
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Export version
run: echo "APP_VERSION=$(head -n 5 Cargo.toml | grep version | cut -d '"' -f2)" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
file: deploy/alpine.Dockerfile
target: base
tags: s3rius/rustus:latest-alpine,s3rius/rustus:${{env.APP_VERSION}}-alpine
build-args: |
app_version=${{env.APP_VERSION}}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
file: deploy/alpine.Dockerfile
target: rootless
tags: s3rius/rustus:${{env.APP_VERSION}}-rootless-alpine
build-args: |
app_version=${{env.APP_VERSION}}
42 changes: 15 additions & 27 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Adding component
run: rustup component add rustfmt
- name: Checking code format
run: cargo fmt -- --check --config use_try_shorthand=true,imports_granularity=Crate
run: cargo fmt -- --check

code_check:
needs: pre_job
Expand All @@ -49,33 +49,14 @@ jobs:
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features -p rustus -- -W clippy::all -W clippy::pedantic -D warnings
args: -p rustus

tests:
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
services:
redis:
image: redis:6.2-alpine3.15
ports:
- 6379/tcp
pg:
image: postgres:13.1
ports:
- 5432/tcp
env:
POSTGRES_PASSWORD: "rustus"
POSTGRES_USER: "rustus"
POSTGRES_DB: "rustus"
rabbit:
image: rabbitmq:3.8.27-alpine
ports:
- 5672/tcp
env:
RABBITMQ_DEFAULT_USER: "guest"
RABBITMQ_DEFAULT_PASS: "guest"
RABBITMQ_DEFAULT_VHOST: "/"
permissions:
contents: read
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -85,9 +66,16 @@ jobs:
with:
toolchain: stable
override: true
- uses: KengoTODA/actions-setup-docker-compose@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: start docker services
run: docker compose up -d --wait
- name: Run tests
run: cargo test --features=all,integration_tests -- --test-threads 1
run: cargo test
env:
TEST_REDIS_URL: redis://localhost:${{ job.services.redis.ports['6379'] }}/0
TEST_DB_URL: postgresql://rustus:rustus@localhost:${{ job.services.pg.ports['5432'] }}/rustus
TEST_AMQP_URL: amqp://guest:guest@localhost:${{ job.services.rabbit.ports['5672'] }}
TEST_REDIS_URL: redis://localhost:6379/0
TEST_AMQP_URL: amqp://guest:guest@localhost:5672
- name: stop docker compose
if: always()
run: docker compose down -v
15 changes: 0 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ repos:
pass_filenames: false
args:
- fmt
- --
- --config
- use_try_shorthand=true,imports_granularity=Crate

- id: clippy
types:
Expand All @@ -27,17 +24,6 @@ repos:
entry: cargo
args:
- clippy
- --features=all
- --all
- -p
- rustus
- --
- -W
- clippy::all
- -W
- clippy::pedantic
- -D
- warnings

- id: check
types:
Expand All @@ -58,4 +44,3 @@ repos:
pass_filenames: false
args:
- check
- --features=all
Loading
Loading