Skip to content

expose underlying methods #189

expose underlying methods

expose underlying methods #189

Workflow file for this run

name: Build Assets
permissions:
pull-requests: write
contents: write
on:
push:
branches:
- main
release:
types: [published]
env:
INTERPRETER: "3.12"
RUSTFLAGS: "-C debuginfo=0"
jobs:
build:
name: Build ${{ matrix.os }}-${{ matrix.arch }} (${{ matrix.feature }})
strategy:
fail-fast: false
matrix:
include:
# Linux builds
- os: ubuntu-22.04
arch: amd64
target: x86_64-unknown-linux-gnu
archive_ext: tar.gz
feature: kafka
- os: ubuntu-22.04
arch: amd64
target: x86_64-unknown-linux-gnu
archive_ext: tar.gz
feature: rabbitmq
- os: ubuntu-22.04-arm
arch: arm64
target: aarch64-unknown-linux-gnu
archive_ext: tar.gz
feature: kafka
- os: ubuntu-22.04-arm
arch: arm64
target: aarch64-unknown-linux-gnu
archive_ext: tar.gz
feature: rabbitmq
# macOS builds
- os: macos-latest
arch: arm64
target: aarch64-apple-darwin
archive_ext: zip
feature: kafka
- os: macos-latest
arch: arm64
target: aarch64-apple-darwin
archive_ext: zip
feature: rabbitmq
- os: macos-13
arch: amd64
target: x86_64-apple-darwin
archive_ext: zip
feature: kafka
- os: macos-13
arch: amd64
target: x86_64-apple-darwin
archive_ext: zip
feature: rabbitmq
env:
TARGET: ${{ matrix.target }}
runs-on: ${{ matrix.os}}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Rust
run: |
rustup override set stable
rustup update
rustup target add ${{ matrix.target }}
rustup component add rust-src
- name: Install dependencies (Linux)
if: contains(matrix.os, 'linux')
run: |
sudo apt-get update -y
sudo apt-get install -y build-essential
- name: Build binaries
run: |
cargo build -p scouter-server \
--release \
--target ${{ matrix.target }} \
--features ${{ matrix.feature }}
- name: Prepare binary directory
shell: bash
run: |
mkdir -p release-bin
cp target/${{ matrix.target }}/release/scouter-server release-bin/scouter-server-${{ matrix.feature }}
chmod +x release-bin/scouter-server-${{ matrix.feature }}
- name: Create archive
shell: bash
run: |
cd release-bin
if [[ "${{ matrix.archive_ext }}" == "zip" ]]; then
zip -r ../scouter-server-${{ matrix.target }}-${{ matrix.feature }}.zip ./*
else
tar -czf ../scouter-server-${{ matrix.target }}-${{ matrix.feature }}.tar.gz ./*
fi
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: scouter-server-${{ matrix.target }}-${{ matrix.feature }}
path: |
scouter-server-${{ matrix.target }}-${{ matrix.feature }}.${{ matrix.archive_ext }}
retention-days: 1
publish-docker-images:
#if: github.event_name == 'release'
needs: build
name: Publish scouter base images to Dockerhub
runs-on: ubuntu-22.04
strategy:
matrix:
include:
# Kafka amd64 images
- image: "ubuntu"
tag_suffix: "ubuntu"
feature: "kafka"
target: x86_64-unknown-linux-gnu
arch: "amd64"
- image: "alpine"
tag_suffix: "alpine"
feature: "kafka"
target: x86_64-unknown-linux-gnu
arch: "amd64"
- image: "scratch"
tag_suffix: "scratch"
feature: "kafka"
target: x86_64-unknown-linux-gnu
arch: "amd64"
- image: "debian"
tag_suffix: "debian"
feature: "kafka"
target: x86_64-unknown-linux-gnu
arch: "amd64"
- image: "distroless"
tag_suffix: "distroless"
feature: "kafka"
target: x86_64-unknown-linux-gnu
arch: "amd64"
# RabbitMQ amd64 images
- image: "ubuntu"
tag_suffix: "ubuntu"
feature: "rabbitmq"
target: x86_64-unknown-linux-gnu
arch: "amd64"
- image: "alpine"
tag_suffix: "alpine"
feature: "rabbitmq"
target: x86_64-unknown-linux-gnu
arch: "amd64"
- image: "scratch"
tag_suffix: "scratch"
feature: "rabbitmq"
target: x86_64-unknown-linux-gnu
arch: "amd64"
- image: "debian"
tag_suffix: "debian"
feature: "rabbitmq"
target: x86_64-unknown-linux-gnu
arch: "amd64"
- image: "distroless"
tag_suffix: "distroless"
feature: "rabbitmq"
target: x86_64-unknown-linux-gnu
arch: "amd64"
# Kafka arm64 images
- image: "ubuntu"
tag_suffix: "ubuntu"
feature: "kafka"
target: aarch64-unknown-linux-gnu
arch: "arm64"
- image: "alpine"
tag_suffix: "alpine"
feature: "kafka"
target: aarch64-unknown-linux-gnu
arch: "arm64"
- image: "scratch"
tag_suffix: "scratch"
feature: "kafka"
target: aarch64-unknown-linux-gnu
arch: "arm64"
- image: "debian"
tag_suffix: "debian"
feature: "kafka"
target: aarch64-unknown-linux-gnu
arch: "arm64"
- image: "distroless"
tag_suffix: "distroless"
feature: "kafka"
target: aarch64-unknown-linux-gnu
arch: "arm64"
# RabbitMQ arm64 images
- image: "ubuntu"
tag_suffix: "ubuntu"
feature: "rabbitmq"
target: aarch64-unknown-linux-gnu
arch: "arm64"
- image: "alpine"
tag_suffix: "alpine"
feature: "rabbitmq"
target: aarch64-unknown-linux-gnu
arch: "arm64"
- image: "scratch"
tag_suffix: "scratch"
feature: "rabbitmq"
target: aarch64-unknown-linux-gnu
arch: "arm64"
- image: "debian"
tag_suffix: "debian"
feature: "rabbitmq"
target: aarch64-unknown-linux-gnu
arch: "arm64"
- image: "distroless"
tag_suffix: "distroless"
feature: "rabbitmq"
target: aarch64-unknown-linux-gnu
arch: "arm64"
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Download binary artifact
uses: actions/download-artifact@v4
with:
name: scouter-server-${{ matrix.target }}-${{ matrix.feature }}
path: ./artifacts
- name: Extract binary
run: |
mkdir -p binary
tar -xzf ./artifacts/scouter-server-${{ matrix.target }}-${{ matrix.feature }}.tar.gz -C ./binary
- name: Set up binary permissions
run: |
chmod +x ./binary/scouter-server-${{ matrix.feature }}
- name: Set version tag
id: set-version
run: |
if [[ "${{ github.event_name }}" == "release" ]]; then
echo "VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
else
echo "VERSION=latest" >> $GITHUB_OUTPUT
fi
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push images
uses: docker/build-push-action@v5
with:
context: .
file: docker/official/${{ matrix.image }}/Dockerfile
push: true
platforms: linux/${{ matrix.arch }}
build-args: |
SCOUTER_SERVER_BINARY=./binary/scouter-server-${{ matrix.feature }}
tags: |
demml/scouter:${{ matrix.tag_suffix }}-${{ matrix.arch }}-${{ matrix.feature }}-${{ steps.set-version.outputs.VERSION }}
demml/scouter:${{ matrix.tag_suffix }}-${{ matrix.arch }}-${{ matrix.feature }}-latest
cache-from: type=gha
cache-to: type=gha,mode=max
release-binary-assets:
if: github.event_name == 'release'
needs: [build, publish-docker-images]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: get dist artifacts
uses: actions/download-artifact@v4
with:
pattern: scouter-server-*
path: dist
- name: list dist files
run: |
ls -lhR dist
echo "`ls dist | wc -l` files"
- name: Upload files to GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for file in $(find dist -type f -not -path "*/\.*"); do
echo "Uploading $file to release"
gh release upload ${{ github.event.release.tag_name }} "$file" --clobber
done