Add gitea actions and earthly
Some checks failed
CI / build (push) Failing after 1m52s

This commit is contained in:
Fabian Stamm 2023-07-13 23:13:04 +02:00
parent db18e03513
commit 384d451410
6 changed files with 61 additions and 29 deletions

View File

@ -1 +0,0 @@
target/

1
.earthlyignore Normal file
View File

@ -0,0 +1 @@
target/

36
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,36 @@
# .github/workflows/ci.yml
name: CI
on:
push:
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
env:
MY_DOCKER_USERNAME: ${{ secrets.MY_DOCKER_USERNAME }}
MY_DOCKER_PASSWORD: ${{ secrets.MY_DOCKER_PASSWORD }}
FORCE_COLOR: 1
steps:
- uses: https://github.com/earthly/actions-setup@v1
with:
version: v0.7.0
- uses: actions/checkout@v2
- name: Put back the git branch into git (Earthly uses it for tagging)
run: |
branch=""
if [ -n "$GITHUB_HEAD_REF" ]; then
branch="$GITHUB_HEAD_REF"
else
branch="${GITHUB_REF##*/}"
fi
git checkout -b "$branch" || true
- name: Docker Login
run: docker login git.hibas.dev --username "$MY_DOCKER_USERNAME" --password "$MY_DOCKER_PASSWORD"
- name: Earthly version
run: earthly --version
- name: Run build
run: earthly --push +docker-multi

View File

@ -1,27 +0,0 @@
FROM docker.io/rust:1.67.0-slim-bullseye as builder
RUN apt-get update -yq && \
apt install -y --no-install-recommends \
build-essential \
libssl-dev \
pkg-config \
protobuf-compiler \
libprotobuf-dev
WORKDIR /src
COPY . .
RUN cargo build --release
FROM docker.io/debian:bullseye-slim
RUN apt-get update -yq && \
apt-get install -y --no-install-recommends glusterfs-client htop
COPY --from=builder /src/target/release/gluster-dir-csi /usr/local/bin/gluster-dir-csi
ENTRYPOINT ["/usr/local/bin/gluster-dir-csi"]

23
Earthfile Normal file
View File

@ -0,0 +1,23 @@
VERSION 0.7
FROM rust:1.68
WORKDIR /rustbuild
prepare-env:
RUN apt update && apt install -y protobuf-compiler
docker-multi:
BUILD --platform linux/amd64 --platform linux/arm64 +docker
build:
FROM +prepare-env
COPY . .
RUN cargo build --release
SAVE ARTIFACT target/release/gluster-dir-csi gluster-dir-csi
docker:
FROM debian:bullseye-slim
COPY +build/gluster-dir-csi gluster-dir-csi
ENTRYPOINT ["./gluster-dir-csi"]
ARG EARTHLY_TARGET_TAG_DOCKER
ARG TAG=$EARTHLY_TARGET_TAG_DOCKER
SAVE IMAGE --push git.hibas.dev/ops/gluster-dir-csi:$TAG

@ -1 +1 @@
Subproject commit 1de425b860085fa0e987d8ece6fe36ed47cdebb3 Subproject commit c7ab2f379311a9ae234ae42bdfbfebfa9c15e538