-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Avi Deitcher <avi@deitcher.net>
- Loading branch information
Showing
4 changed files
with
109 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
name: PR build | ||
on: | ||
pull_request_target: | ||
paths-ignore: | ||
- '.github/workflows/**' | ||
branches: | ||
- "main" | ||
push: | ||
branches: | ||
- "main" | ||
|
||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
steps: | ||
- name: Starting Report | ||
run: | | ||
echo Git Ref: ${{ github.event.pull_request.head.ref }} | ||
echo GitHub Event: ${{ github.event_name }} | ||
echo Disk usage | ||
df -h | ||
echo Memory | ||
free -m | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
fetch-depth: 0 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
push: false | ||
tags: | | ||
${{ github.event.pull_request.head.repo.full_name }}:${{ github.event.pull_request.head.ref }} | ||
${{ github.event.pull_request.head.repo.full_name }}:latest | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: release | ||
on: | ||
push: | ||
tags: | ||
- "[0-9]+.[0-9]+.[0-9]+" | ||
paths-ignore: | ||
- '.github/workflows/**' | ||
|
||
env: | ||
OCIREPO: lfedge/eve-rust | ||
|
||
jobs: | ||
build_and_push: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Get rust version | ||
id: rust_version | ||
run: | | ||
RUST_VERSION=$(awk -F= '/ARG RUST_VERSION/ {print $2}' Dockerfile) | ||
# make sure we got a rust version | ||
if [ -z "$RUST_VERSION" ]; then | ||
echo "Failed to get RUST_VERSION" | ||
exit 1 | ||
fi | ||
# strip off any potential eve-specific extensions to the tag | ||
TAG="${{ github.ref_name }}" | ||
TAG="${TAG%%-*}" | ||
if [ "$TAG" != "$RUST_VERSION" ]; then | ||
echo "Tag $TAG does not match RUST_VERSION $RUST_VERSION" | ||
exit 1 | ||
fi | ||
echo "::set-output name=RUST_VERSION::$RUST_VERSION" | ||
- name: Login to Docker Hub | ||
if: ${{ github.event.repository.full_name }} == 'lf-edge/eve-rust' | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.RELEASE_DOCKERHUB_ACCOUNT }} | ||
password: ${{ secrets.RELEASE_DOCKERHUB_TOKEN }} | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: | | ||
${{ env.OCIREPO }}:${{ steps.rust_version.outputs.RUST_VERSION }} | ||
${{ env.OCIREPO }}:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
FROM rust:1.80.1-alpine3.19 | ||
ARG RUST_VERSION=1.80.1 | ||
FROM rust:${RUST_VERSION}-alpine3.19 | ||
ENV TARGETS x86_64-unknown-linux-musl aarch64-unknown-linux-musl x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu riscv64gc-unknown-linux-gnu | ||
RUN rustup target add x86_64-unknown-linux-musl | ||
RUN cargo install cargo-chef cargo-sbom |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters