mirror of
https://git.asonix.dog/asonix/pict-rs
synced 2024-11-20 11:21:14 +00:00
Attempt to add forgjo CI
This commit is contained in:
parent
533db60fdd
commit
422e24e1d4
2 changed files with 237 additions and 0 deletions
24
.forgejo/workflows/check.yaml
Normal file
24
.forgejo/workflows/check.yaml
Normal file
|
@ -0,0 +1,24 @@
|
|||
on:
|
||||
push:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
clippy:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: docker.io/asonix/rust-builder:latest-linux-amd64
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- rustup component add clippy
|
||||
- cargo clippy --no-default-features -- -D warnings
|
||||
- cargo clippy --no-default-features --features io-uring -- -D warnings
|
||||
|
||||
tests:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: docker.io/asonix/rust-builder:latest-linux-amd64
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- cargo test
|
213
.forgejo/workflows/publish.yaml
Normal file
213
.forgejo/workflows/publish.yaml
Normal file
|
@ -0,0 +1,213 @@
|
|||
on: [tag]
|
||||
|
||||
env:
|
||||
REGISTRY_IMAGE: asonix/pictrs
|
||||
|
||||
jobs:
|
||||
clippy:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: docker.io/asonix/rust-builder:latest-linux-amd64
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- rustup component add clippy
|
||||
- cargo clippy --no-default-features -- -D warnings
|
||||
- cargo clippy --no-default-features --features io-uring -- -D warnings
|
||||
|
||||
tests:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: docker.io/asonix/rust-builder:latest-linux-amd64
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- cargo test
|
||||
|
||||
build-amd64:
|
||||
needs:
|
||||
- clippy
|
||||
- tests
|
||||
runs-on: docker
|
||||
container:
|
||||
image: docker.io/asonix/rust-builder:latest-linux-amd64
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- cargo build --target=$TARGET --release
|
||||
- mkdir artifacts
|
||||
- cp target/$TARGET/release/pict-rs artifacts/pict-rs
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: linux-amd64
|
||||
path: artifacts/
|
||||
|
||||
build-arm32v7:
|
||||
needs:
|
||||
- clippy
|
||||
- tests
|
||||
runs-on: docker
|
||||
container:
|
||||
image: docker.io/asonix/rust-builder:latest-linux-arm32v7
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- cargo build --target=$TARGET --release
|
||||
- mkdir artifacts
|
||||
- cp target/$TARGET/release/pict-rs artifacts/pict-rs
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: linux-arm32v7
|
||||
path: artifacts/
|
||||
|
||||
build-arm64v8:
|
||||
needs:
|
||||
- clippy
|
||||
- tests
|
||||
runs-on: docker
|
||||
container:
|
||||
image: docker.io/asonix/rust-builder:latest-linux-arm64v8
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- cargo build --target=$TARGET --release
|
||||
- mkdir artifacts
|
||||
- cp target/$TARGET/release/pict-rs artifacts/pict-rs
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: linux-arm64v8
|
||||
path: artifacts/
|
||||
|
||||
prepare-docker:
|
||||
needs:
|
||||
- build-amd64
|
||||
- build-arm32v7
|
||||
- build-arm64v8
|
||||
runs-on: docker
|
||||
container:
|
||||
image: docker.io/_/ubuntu:latest
|
||||
strategy:
|
||||
matrix:
|
||||
fail-fast: false
|
||||
platform:
|
||||
- docker: linux/amd64
|
||||
artifact: linux-amd64
|
||||
- docker: linux/arm/v7
|
||||
artifact: linux-arm32v7
|
||||
- docker: linux/arm64
|
||||
artifact: linux-arm64v8
|
||||
steps:
|
||||
-
|
||||
name: Prepare
|
||||
run: |
|
||||
platform=${{ matrix.platform.docker }}
|
||||
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
||||
|
||||
-
|
||||
name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY_IMAGE }}
|
||||
-
|
||||
name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
-
|
||||
name: Docker login
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
-
|
||||
name: Download binaries
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.platform.artifact }}
|
||||
path: artifacts/
|
||||
-
|
||||
name: Build and push ${{ matrix.platform.docker }} docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
platforms: ${{ matrix.platform.docker }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
|
||||
-
|
||||
name: Export digest
|
||||
run: |
|
||||
mkdir -p /tmp/digests
|
||||
digest="${{ steps.build.outputs.digest }}"
|
||||
touch "/tmp/digests/${digest#sha256:}"
|
||||
-
|
||||
name: Upload ${{ matrix.platform.docker }} digest
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: digests
|
||||
path: /tmp/digests/*
|
||||
if-no-files-found: error
|
||||
retention-days: 1
|
||||
|
||||
publish-docker:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: docker.io/_/ubuntu:latest
|
||||
needs:
|
||||
- prepare-docker
|
||||
steps:
|
||||
-
|
||||
name: Download digests
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: digests
|
||||
path: /tmp/digests
|
||||
pattern: digests-*
|
||||
merge-multiple: true
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
-
|
||||
name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY_IMAGE }}
|
||||
tags: |
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
-
|
||||
name: Docker login
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
-
|
||||
name: Create manifest list and push
|
||||
working-directory: /tmp/digests
|
||||
run: |
|
||||
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
||||
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
|
||||
-
|
||||
name: Inspect Image
|
||||
run: |
|
||||
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
|
||||
|
||||
upload-release:
|
||||
needs:
|
||||
- build-amd64
|
||||
- build-arm32v7
|
||||
- build-arm64v8
|
||||
runs-on: docker
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
- uses: actions/forgejo-release@v1
|
||||
with:
|
||||
direction: upload
|
||||
release-dir: artifacts/
|
||||
|
||||
publish-crate:
|
||||
needs:
|
||||
- build-amd64
|
||||
- build-arm32v7
|
||||
- build-arm64v8
|
||||
runs-on: docker
|
||||
steps:
|
||||
- run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}
|
Loading…
Reference in a new issue