mirror of
https://git.asonix.dog/asonix/pict-rs
synced 2024-12-22 19:31:35 +00:00
Try for docker action
This commit is contained in:
parent
29f565b115
commit
49ab2e0cb2
5 changed files with 88 additions and 19 deletions
7
.forgejo/actions/build-amd64/Dockerfile
Normal file
7
.forgejo/actions/build-amd64/Dockerfile
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
FROM docker.io/asonix/rust-builder:latest-linux-amd64
|
||||||
|
|
||||||
|
RUN rustup component add clippy
|
||||||
|
|
||||||
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
25
.forgejo/actions/build-amd64/action.yaml
Normal file
25
.forgejo/actions/build-amd64/action.yaml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
name: Build x86_64 Rust Binary
|
||||||
|
desctiption: Compiles a rust binary with a bespoke rust image
|
||||||
|
inputs:
|
||||||
|
name:
|
||||||
|
description: Name of the binary being compiled
|
||||||
|
required: true
|
||||||
|
action:
|
||||||
|
description: Action to take
|
||||||
|
required: true
|
||||||
|
default: build
|
||||||
|
build_mode:
|
||||||
|
description: debug or release
|
||||||
|
required: true
|
||||||
|
default: debug
|
||||||
|
outputs:
|
||||||
|
path:
|
||||||
|
description: Path to the produced binary
|
||||||
|
runs:
|
||||||
|
using: docker
|
||||||
|
image: Dockerfile
|
||||||
|
steps:
|
||||||
|
args:
|
||||||
|
- ${{ inputs.name }}
|
||||||
|
- ${{ inputs.action }}
|
||||||
|
- ${{ inputs.build_mode }}
|
21
.forgejo/actions/build-amd64/entrypoint.sh
Normal file
21
.forgejo/actions/build-amd64/entrypoint.sh
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
name=$1
|
||||||
|
action=$2
|
||||||
|
build_mode=$3
|
||||||
|
|
||||||
|
cargo "${action}" "--${build_mode}" "--target=${TARGET}"
|
||||||
|
|
||||||
|
case "$action" in
|
||||||
|
build)
|
||||||
|
echo "path=target/${TARGET}/release/${name}" >> "${GITHUB_OUTPUT}"
|
||||||
|
;;
|
||||||
|
check)
|
||||||
|
;;
|
||||||
|
test)
|
||||||
|
;;
|
||||||
|
clippy)
|
||||||
|
;;
|
||||||
|
esac
|
|
@ -5,6 +5,18 @@ on:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
test-action:
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: docker.io/node:20-bookworm
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: ./.forgejo/actions/build-amd64
|
||||||
|
with:
|
||||||
|
name: pict-rs
|
||||||
|
action: clippy
|
||||||
|
build_mode: debug
|
||||||
|
|
||||||
clippy:
|
clippy:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
container:
|
container:
|
||||||
|
|
|
@ -11,6 +11,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- run: |
|
- run: |
|
||||||
git clone ${{ env.github_server_url }}/${{ env.github_repository }} .
|
git clone ${{ env.github_server_url }}/${{ env.github_repository }} .
|
||||||
|
git checkout ${{ env.github_sha }}
|
||||||
rustup component add clippy
|
rustup component add clippy
|
||||||
cargo clippy --no-default-features -- -D warnings
|
cargo clippy --no-default-features -- -D warnings
|
||||||
cargo clippy --no-default-features --features io-uring -- -D warnings
|
cargo clippy --no-default-features --features io-uring -- -D warnings
|
||||||
|
@ -22,6 +23,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- run: |
|
- run: |
|
||||||
git clone ${{ env.github_server_url }}/${{ env.github_repository }} .
|
git clone ${{ env.github_server_url }}/${{ env.github_repository }} .
|
||||||
|
git checkout ${{ env.github_sha }}
|
||||||
cargo test
|
cargo test
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
@ -30,21 +32,23 @@ jobs:
|
||||||
- tests
|
- tests
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
- tag: latest-linux-amd64
|
include:
|
||||||
artifact: linux-amd64
|
- tag: latest-linux-amd64
|
||||||
target: x86_64-unknown-linux-musl
|
artifact: linux-amd64
|
||||||
- tag: latest-linux-arm32v7
|
target: x86_64-unknown-linux-musl
|
||||||
target: armv7-unknown-linux-musleabihf
|
- tag: latest-linux-arm32v7
|
||||||
artifact: linux-arm32v7
|
target: armv7-unknown-linux-musleabihf
|
||||||
- tag: latest-linux-arm64v8
|
artifact: linux-arm32v7
|
||||||
artifact: linux-arm64v8
|
- tag: latest-linux-arm64v8
|
||||||
target: aarch64-unknown-linux-musl
|
artifact: linux-arm64v8
|
||||||
|
target: aarch64-unknown-linux-musl
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
container:
|
container:
|
||||||
image: docker.io/asonix/rust-builder:${{ matrix.tag }}
|
image: docker.io/asonix/rust-builder:${{ matrix.tag }}
|
||||||
steps:
|
steps:
|
||||||
- run: |
|
- run: |
|
||||||
git clone ${{ env.github_server_url }}/${{ env.github_repository }} .
|
git clone ${{ env.github_server_url }}/${{ env.github_repository }} .
|
||||||
|
git checkout ${{ env.github_sha }}
|
||||||
cargo build --target=${{ matrix.target }} --release
|
cargo build --target=${{ matrix.target }} --release
|
||||||
mkdir artifacts
|
mkdir artifacts
|
||||||
cp target/${{ matrix.target }}/release/pict-rs artifacts/pict-rs
|
cp target/${{ matrix.target }}/release/pict-rs artifacts/pict-rs
|
||||||
|
@ -59,12 +63,12 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
platform:
|
include:
|
||||||
- docker: linux/amd64
|
- platform: linux/amd64
|
||||||
artifact: linux-amd64
|
artifact: linux-amd64
|
||||||
- docker: linux/arm/v7
|
- platform: linux/arm/v7
|
||||||
artifact: linux-arm32v7
|
artifact: linux-arm32v7
|
||||||
- docker: linux/arm64
|
- platform: linux/arm64
|
||||||
artifact: linux-arm64v8
|
artifact: linux-arm64v8
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
container:
|
container:
|
||||||
|
@ -73,7 +77,7 @@ jobs:
|
||||||
-
|
-
|
||||||
name: Prepare
|
name: Prepare
|
||||||
run: |
|
run: |
|
||||||
platform=${{ matrix.platform.docker }}
|
platform=${{ matrix.platform }}
|
||||||
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
||||||
|
|
||||||
-
|
-
|
||||||
|
@ -98,14 +102,14 @@ jobs:
|
||||||
name: Download binaries
|
name: Download binaries
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.platform.artifact }}
|
name: ${{ matrix.artifact }}
|
||||||
path: artifacts/
|
path: artifacts/
|
||||||
-
|
-
|
||||||
name: Build and push ${{ matrix.platform.docker }} docker image
|
name: Build and push ${{ matrix.platform }} docker image
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: ./docker/forgejo"
|
||||||
platforms: ${{ matrix.platform.docker }}
|
platforms: ${{ matrix.platform }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
|
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
|
||||||
-
|
-
|
||||||
|
@ -115,7 +119,7 @@ jobs:
|
||||||
digest="${{ steps.build.outputs.digest }}"
|
digest="${{ steps.build.outputs.digest }}"
|
||||||
touch "/tmp/digests/${digest#sha256:}"
|
touch "/tmp/digests/${digest#sha256:}"
|
||||||
-
|
-
|
||||||
name: Upload ${{ matrix.platform.docker }} digest
|
name: Upload ${{ matrix.platform }} digest
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: digests
|
name: digests
|
||||||
|
|
Loading…
Reference in a new issue