Skip to content
Open
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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @jucr-io
49 changes: 49 additions & 0 deletions .github/actions/publish-binaries/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: publish-binaries
description: publish rust binaries
inputs:
os:
description: github action OS
target:
description: rust target
version:
description: release tag
name:
description: release name
bin:
description: rust bin name


runs:
using: composite
steps:
- name: setup toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ inputs.target }}

- name: set version
shell: bash
run: cargo install cargo-edit && cargo set-version $VERSION
env:
VERSION: ${{ github.ref_name }}

- name: run build
uses: houseabsolute/actions-rust-cross@v0
with:
command: "build"
target: ${{ inputs.target }}
toolchain: "stable"
args: "--locked --release"
strip: true

- name: package
shell: bash
run: |
cd target/${{ inputs.target }}/release
tar czvf ../../../${{ inputs.name }} ${{ inputs.bin }}
cd -

- name: upload artifacts
uses: softprops/action-gh-release@v2
with:
files: "pathfinder-*"
60 changes: 60 additions & 0 deletions .github/actions/publish-docker-image/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: docker
description: build and publish docker image
inputs:
config-path:
description: The path to the chart-testing configuration file
default: .ct/ct.yaml
name:
description: pathfinder release name
token:
description: github token

runs:
using: composite
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ inputs.token }}

- name: Set up Docker Buildx
uses: docker/[email protected]
with:
driver-opts: |
image=moby/buildkit:v0.16.0

- name: download pathfinder release
id: download_pathfinder
shell: bash
run: |
gh release download -p ${{ inputs.name }} --clobber -O pathfinder.tar.gz
tar -xvf pathfinder.tar.gz

- name: set docker tags
id: set_tags
shell: bash
run: |
repository_name=${${{ github.repository }}#${{ github.repository_owner }}}
image_name="ghcr.io/${{ github.repository }}"
echo "image_name=$image_name" >> $GITHUB_OUTPUT
echo "repository_name=$repository_name" >> $GITHUB_OUTPUT

- name: Build and Push Docker Image
uses: docker/build-push-action@v6
id: docker_build
with:
context: .
github-token: ${{ inputs.token }}
push: true
tags: |
${{steps.set_tags.outputs.image_name}}:${{ github.sha }}
${{steps.set_tags.outputs.image_name}}:${{ github.ref_name }}
${{steps.set_tags.outputs.image_name}}:latest
labels: |
org.opencontainers.image.title=${{ steps.set_tags.outputs.repository_name }}
org.opencontainers.image.source=https://github.com/${{ github.repository }}
platforms: linux/arm64,linux/amd64
build-args: |
ARG CONFIG=${{ inputs.config-path }}
74 changes: 0 additions & 74 deletions .github/workflows/publish-binaries.yaml

This file was deleted.

92 changes: 92 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: publish pathfinder
on:
release:
types: [released, prereleased]

permissions:
contents: write
packages: write
id-token: write

env:
GH_TOKEN: ${{ github.token }}

jobs:
publish-binaries:
name: ${{ matrix.platform.target }}
runs-on: ${{ matrix.platform.os }}
if: ${{ !startsWith(github.ref_name, 'v') }}
strategy:
fail-fast: false
matrix:
platform:
- os_name: Linux-x86_64
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
bin: pathfinder
name: pathfinder-linux-x86_64-gnu.tar.gz

- os_name: Linux-aarch64-gnu
os: ubuntu-latest
target: aarch64-unknown-linux-gnu
bin: pathfinder
name: pathfinder-linux-aarch64-gnu.tar.gz

- os_name: macOS-aarch64
os: macOS-latest
target: aarch64-apple-darwin
bin: pathfinder
name: pathfinder-apple-darwin-aarch64.tar.gz

steps:
- name: checkout
uses: actions/[email protected]

- name: Install dependencies for Linux
if: matrix.platform.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install -y libssl-dev

- name: publish rust binaries
uses: ./.github/actions/publish-binaries
continue-on-error: false
with:
os: ${{ matrix.platform.os }}
version: ${{ github.ref_name }}
target: ${{ matrix.platform.target }}
name: ${{ matrix.platform.name }}
bin: ${{ matrix.platform.bin }}


build-and-push-docker-image:
needs: [publish-binaries]
name: ${{ matrix.platform.target }}
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: false
matrix:
platform:
- os_name: Linux-x86_64
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
bin: pathfinder
name: pathfinder-linux-x86_64-gnu.tar.gz
platform: linux/amd64

- os_name: Linux-aarch64-gnu
os: ubuntu-latest
target: aarch64-unknown-linux-gnu
bin: pathfinder
name: pathfinder-linux-aarch64-gnu.tar.gz
platform: linux/arm64

steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Build and push Docker image
uses: ./.github/actions/publish-docker-image
with:
config-path: 'example-config.yaml'
name: ${{ matrix.platform.name }}
token: ${{ github.token }}
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ rand = { version = "0.8.5" }
[dependencies]
anyhow = "1.0.86"
futures-util = "0.3.30"
rdkafka = { version = "0.36.2", features = ["ssl-vendored"] }
openssl = { version = "0.10", features = ["vendored"] }
openssl-sys = { version = "0.9", features = ["vendored"] }
rdkafka = { version = "0.36.2", features = ["cmake-build"] }
tokio = { version = "1.39.2", features = ["full"] }
tokio-util = { version = "0.7.11", features = ["rt"] }
tokio-macros = "2.4.0"
Expand Down
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM debian:bullseye-slim AS build

RUN apt-get update && apt-get install -y unzip curl

ARG CONFIG=example-config.yaml
COPY $CONFIG /config.yaml
COPY pathfinder .

RUN cp pathfinder /usr/local/bin/pathfinder

FROM debian:bullseye-slim

RUN apt-get update && apt-get install -y libssl-dev ca-certificates && rm -rf /var/lib/apt/lists/*

COPY --from=build /usr/local/bin/pathfinder /usr/local/bin/pathfinder

COPY --from=build /config.yaml /etc/pf-config.yaml

ENTRYPOINT ["/usr/local/bin/pathfinder", "--config-path", "/etc/pf-config.yaml", "listen"]