mirror of
https://github.com/shiroyashik/sculptor.git
synced 2025-12-06 04:51:13 +03:00
rework the build system
- use rustls for reqwest, so we don't need to compile OpenSSL - use better defaults for build arguments in Dockerfile - add Continuous Integration workflow for master branch and it's pull requests - add Release workflow for tags matching SemVer - add release template for automatic release notes generation with GH CLI - remove old and unused assets under .github
This commit is contained in:
parent
1c38c402b9
commit
e21cbd1f63
13 changed files with 462 additions and 810 deletions
48
.github/actions/build/action.yml
vendored
Normal file
48
.github/actions/build/action.yml
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
name: Build project
|
||||||
|
description: Builds the project for specified targets using cargo-zigbuild.
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
targets:
|
||||||
|
description: A comma-separated list of Rust targets.
|
||||||
|
default: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu,x86_64-pc-windows-gnu
|
||||||
|
lint:
|
||||||
|
description: A boolean indicating if linting (cargo-fmt, clippy) should be run
|
||||||
|
default: true
|
||||||
|
test:
|
||||||
|
description: A boolean indicating if tests should be run
|
||||||
|
default: true
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Convert input targets to Bash array
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
readarray -d $'\0' -t targets < <(awk -F, '{ for (i = 1; i <= NF; i++) printf "--target\0%s\0", $i }' <<< "${{ inputs.targets }}")
|
||||||
|
declare -p targets > /tmp/targets.sh
|
||||||
|
|
||||||
|
- name: Check with cargo-fmt
|
||||||
|
if: inputs.lint == true
|
||||||
|
shell: sh
|
||||||
|
run: cargo fmt -v --all -- --check
|
||||||
|
|
||||||
|
- name: Run Clippy
|
||||||
|
if: inputs.lint == true
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
. /tmp/targets.sh
|
||||||
|
cargo-zigbuild clippy -v --all-targets "${targets[@]}" -- -D warnings
|
||||||
|
|
||||||
|
- name: Build with cargo-zigbuild
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
. /tmp/targets.sh
|
||||||
|
cargo-zigbuild build -v -r --bin sculptor "${targets[@]}"
|
||||||
|
|
||||||
|
- name: Test with cargo-zigbuild
|
||||||
|
shell: bash
|
||||||
|
if: inputs.test == true
|
||||||
|
run: |
|
||||||
|
. /tmp/targets.sh
|
||||||
|
cargo-zigbuild test -v -r "${targets[@]}"
|
||||||
32
.github/actions/dependencies/action.yml
vendored
Normal file
32
.github/actions/dependencies/action.yml
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
name: Install cargo-zigbuild
|
||||||
|
description: Installs cargo-zigbuild and its dependencies
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
zig-version:
|
||||||
|
description: Version of Zig to install
|
||||||
|
default: 0.14.1
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Install Zig
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
ZIG_VERSION="${{ inputs.zig-version }}"
|
||||||
|
[ "$RUNNER_ARCH" == "X64" ] && ZIG_ARCH="x86_64" || ZIG_ARCH="aarch64"
|
||||||
|
wget -q "https://ziglang.org/download/${ZIG_VERSION}/zig-${ZIG_ARCH}-linux-${ZIG_VERSION}.tar.xz" \
|
||||||
|
-O /tmp/zig.tar.xz
|
||||||
|
|
||||||
|
sudo tar -xJf /tmp/zig.tar.xz -C / \
|
||||||
|
--transform='s|^[^/]+/zig$|usr/local/bin/zig|x' \
|
||||||
|
--transform='s|^[^/]+/lib|usr/local/lib/zig|x' \
|
||||||
|
--transform='s|^[^/]+/doc|usr/local/share/doc/zig|x' \
|
||||||
|
--transform='s|^[^/]+/LICENSE$|usr/local/share/doc/zig/copyright|x' \
|
||||||
|
--transform='s|^[^/]+/README.md$|usr/local/share/doc/zig/README.md|x' \
|
||||||
|
--wildcards \
|
||||||
|
"*/"{zig,lib,doc,LICENSE,README.md}
|
||||||
|
|
||||||
|
- name: Install cargo-zigbuild
|
||||||
|
shell: sh
|
||||||
|
run: cargo install cargo-zigbuild
|
||||||
12
.github/release-body.md
vendored
12
.github/release-body.md
vendored
|
|
@ -1,12 +0,0 @@
|
||||||
## Release (✧ω✧)
|
|
||||||
|
|
||||||
> [!CAUTION]
|
|
||||||
> **Update your Config.toml according to the example in the repository!**
|
|
||||||
|
|
||||||
What's added:
|
|
||||||
- Added support for **Assets**! As well as their automatic update from Figura repository!
|
|
||||||
- WebSocket reworked! *No more panics!*
|
|
||||||
- Reworked auto-update of conf files.
|
|
||||||
- Fixed avatar size limits
|
|
||||||
|
|
||||||
**Full Changelog**: https://github.com/shiroyashik/sculptor/compare/v0.3.1...v0.4.0
|
|
||||||
17
.github/release.yml
vendored
Normal file
17
.github/release.yml
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
changelog:
|
||||||
|
exclude:
|
||||||
|
labels:
|
||||||
|
- ignore-for-release
|
||||||
|
categories:
|
||||||
|
- title: Breaking Changes 🛠
|
||||||
|
labels:
|
||||||
|
- breaking-change
|
||||||
|
- title: New Features 🎉
|
||||||
|
labels:
|
||||||
|
- enhancement
|
||||||
|
- title: Bug fixes 🐛
|
||||||
|
labels:
|
||||||
|
- bug
|
||||||
|
- title: Other Changes 🔄
|
||||||
|
labels:
|
||||||
|
- "*"
|
||||||
8
.github/scripts/compress-artifact.sh
vendored
Executable file
8
.github/scripts/compress-artifact.sh
vendored
Executable file
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/bash
|
||||||
|
BINARY_FILE="target/$1/release/sculptor"
|
||||||
|
COMMON_FILES=("Config.example.toml")
|
||||||
|
ARTIFACT_OUTPUT="${OUTPUT_DIR}/sculptor-$2-$3"
|
||||||
|
if [ "$2" = "windows" ]
|
||||||
|
then zip -j "${ARTIFACT_OUTPUT}.zip" "${BINARY_FILE}.exe" "${COMMON_FILES[@]}"
|
||||||
|
else tar --transform 's|^.*/||' -czf "${ARTIFACT_OUTPUT}.tar.gz" "$BINARY_FILE" "${COMMON_FILES[@]}"
|
||||||
|
fi
|
||||||
12
.github/scripts/package-artifacts.sh
vendored
Executable file
12
.github/scripts/package-artifacts.sh
vendored
Executable file
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
export OUTPUT_DIR
|
||||||
|
mkdir -p "$OUTPUT_DIR"
|
||||||
|
|
||||||
|
printenv CARGO_BUILD_TARGETS | awk -F, '{
|
||||||
|
for (i = 1; i <= NF; i++)
|
||||||
|
if (match($i, /^([^-]+)(-[^-]+)*-(linux|windows|darwin)(-[^-]+)*$/, matches))
|
||||||
|
printf "%s\0%s\0%s\0", $i, matches[3], matches[1]
|
||||||
|
else print "DEBUG: awk: No regex match for field index " i ": \047" $i "\047" > /dev/stderr
|
||||||
|
}' | xargs -0 -n 3 "$(dirname -- "$(readlink -f -- "$0")")/compress-artifact.sh"
|
||||||
71
.github/workflows/ci.yml
vendored
Normal file
71
.github/workflows/ci.yml
vendored
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
name: Continuous Integration
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "master" ]
|
||||||
|
paths:
|
||||||
|
- src
|
||||||
|
- Cargo*
|
||||||
|
- Dockerfile
|
||||||
|
pull_request:
|
||||||
|
branches: [ "master" ]
|
||||||
|
paths:
|
||||||
|
- src
|
||||||
|
- Cargo*
|
||||||
|
- Dockerfile
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
env:
|
||||||
|
ZIG_VERSION: 0.14.1
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
CARGO_BUILD_TARGETS: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu,x86_64-pc-windows-gnu
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build, lint and test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
OUTPUT_DIR: target/output
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
toolchain:
|
||||||
|
- 1.87
|
||||||
|
# - stable
|
||||||
|
# - nightly
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Checkout the code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Use build cache
|
||||||
|
uses: Swatinem/rust-cache@v2
|
||||||
|
with:
|
||||||
|
prefix-key: "cargo-v0"
|
||||||
|
cache-all-crates: true
|
||||||
|
|
||||||
|
- name: Set up Rust toolchain
|
||||||
|
uses: dtolnay/rust-toolchain@master
|
||||||
|
with:
|
||||||
|
toolchain: ${{ matrix.toolchain }}
|
||||||
|
targets: ${{ env.CARGO_BUILD_TARGETS }}
|
||||||
|
components: clippy, rustfmt
|
||||||
|
|
||||||
|
- name: Install the build dependencies
|
||||||
|
uses: ./.github/actions/dependencies
|
||||||
|
with:
|
||||||
|
zig-version: ${{ env.ZIG_VERSION }}
|
||||||
|
|
||||||
|
- name: Build the project
|
||||||
|
uses: ./.github/actions/build
|
||||||
|
with:
|
||||||
|
targets: ${{ env.CARGO_BUILD_TARGETS }}
|
||||||
|
|
||||||
|
- name: Package the artifacts
|
||||||
|
run: ./.github/scripts/package-artifacts.sh
|
||||||
|
|
||||||
|
- name: Upload the artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
path: ${{ env.OUTPUT_DIR }}/*
|
||||||
44
.github/workflows/dev-release.yml
vendored
44
.github/workflows/dev-release.yml
vendored
|
|
@ -1,44 +0,0 @@
|
||||||
name: Push Dev
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- "**"
|
|
||||||
tags-ignore:
|
|
||||||
- '**'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
docker:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
# - name: Checkout code
|
|
||||||
# uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
# - name: Login to Docker Hub
|
|
||||||
# uses: docker/login-action@v3
|
|
||||||
# with:
|
|
||||||
# username: ${{ vars.DOCKERHUB_USERNAME }}
|
|
||||||
# password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.repository_owner }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Get short SHA
|
|
||||||
id: short_sha
|
|
||||||
run: echo "sha=$(echo ${GITHUB_SHA} | cut -c1-7)" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
push: true
|
|
||||||
# context: .
|
|
||||||
tags: ghcr.io/${{ github.repository_owner }}/sculptor:${{ steps.short_sha.outputs.sha }}
|
|
||||||
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/sculptor:buildcache
|
|
||||||
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/sculptor:buildcache,mode=max
|
|
||||||
239
.github/workflows/release.yml
vendored
239
.github/workflows/release.yml
vendored
|
|
@ -1,145 +1,154 @@
|
||||||
# Stolen from https://github.com/mrjackwills/oxker :D
|
name: Release
|
||||||
name: Release CI
|
run-name: Release ${{ github.ref_name }}
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- "v[0-9]+.[0-9]+.[0-9]+"
|
- 'v*.*.*'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
env:
|
||||||
|
RUST_VERSION: 1.87
|
||||||
|
ZIG_VERSION: 0.14.1
|
||||||
|
ALPINE_VERSION: 3.22
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
CARGO_BUILD_TARGETS: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu,x86_64-pc-windows-gnu
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
#################################################
|
build-binary:
|
||||||
## Cross platform binary build for release page #
|
name: Build binaries and upload them as artifacts
|
||||||
#################################################
|
|
||||||
|
|
||||||
cross_platform_build:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- target: x86_64-unknown-linux-gnu
|
|
||||||
output_name: linux_x86_64.tar.gz
|
|
||||||
|
|
||||||
- target: x86_64-pc-windows-gnu
|
|
||||||
output_name: windows_x86_64.zip
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
OUTPUT_DIR: target/output
|
||||||
|
outputs:
|
||||||
|
binary-artifact-id: ${{ steps.artifact-upload.outputs.artifact-id }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
|
||||||
|
- name: Checkout the code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
# Install stable rust, and associated tools
|
- name: Use build cache
|
||||||
- name: Install rust
|
uses: Swatinem/rust-cache@v2
|
||||||
uses: dtolnay/rust-toolchain@stable
|
with:
|
||||||
|
prefix-key: "cargo-v0"
|
||||||
|
cache-all-crates: true
|
||||||
|
|
||||||
# Install cross-rs
|
- name: Set up Rust toolchain
|
||||||
- name: Install cross
|
uses: dtolnay/rust-toolchain@master
|
||||||
run: cargo install cross --git https://github.com/cross-rs/cross
|
with:
|
||||||
|
toolchain: ${{ env.RUST_VERSION }}
|
||||||
|
targets: ${{ env.CARGO_BUILD_TARGETS }}
|
||||||
|
# components: clippy, rustfmt
|
||||||
|
|
||||||
# Build binary
|
- name: Install the build dependencies
|
||||||
- name: Build
|
uses: ./.github/actions/dependencies
|
||||||
run: CROSS_NO_WARNINGS=0 cross build --target ${{ matrix.target }} --release
|
with:
|
||||||
|
zig-version: ${{ env.ZIG_VERSION }}
|
||||||
|
|
||||||
# Create necessary files and directories
|
|
||||||
- name: Create necessary files
|
|
||||||
run: |
|
|
||||||
mkdir -p target/output
|
|
||||||
cp Config.example.toml target/output/Config.toml
|
|
||||||
|
|
||||||
# Compress the output | Windows
|
- name: Build the project
|
||||||
- name: Compress | windows
|
uses: ./.github/actions/build
|
||||||
if: matrix.target == 'x86_64-pc-windows-gnu'
|
with:
|
||||||
run: |
|
targets: ${{ env.CARGO_BUILD_TARGETS }}
|
||||||
cp target/${{ matrix.target }}/release/sculptor.exe target/output
|
lint: false
|
||||||
(cd target/output; zip "../../sculptor_${{ matrix.output_name }}" ./*)
|
|
||||||
|
|
||||||
# Compress the output | Linux
|
- name: Package the artifacts
|
||||||
- name: Compress | linux
|
run: ./.github/scripts/package-artifacts.sh
|
||||||
if: matrix.target != 'x86_64-pc-windows-gnu'
|
|
||||||
run: |
|
|
||||||
cp target/${{ matrix.target }}/release/sculptor target/output
|
|
||||||
tar -czvf "./sculptor_${{ matrix.output_name }}" -C "target/output" .
|
|
||||||
|
|
||||||
# Upload output for release page
|
- name: Upload artifact
|
||||||
- name: Upload Artifacts
|
id: artifact-upload
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
if-no-files-found: error
|
path: ${{ env.OUTPUT_DIR }}/*
|
||||||
name: ${{ matrix.target }}
|
name: binaries-${{ github.ref_name }}
|
||||||
path: sculptor_${{ matrix.output_name }}
|
|
||||||
retention-days: 1
|
|
||||||
|
|
||||||
###################
|
build-image:
|
||||||
## Create release #
|
name: Build image and push to GHCR
|
||||||
###################
|
|
||||||
|
|
||||||
create_release:
|
|
||||||
needs: [cross_platform_build]
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
|
||||||
|
- name: Checkout the code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup | Artifacts
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
|
|
||||||
- name: Update Release
|
|
||||||
uses: ncipollo/release-action@v1
|
|
||||||
with:
|
|
||||||
makeLatest: true
|
|
||||||
name: ${{ github.ref_name }}
|
|
||||||
tag: ${{ github.ref }}
|
|
||||||
bodyFile: ".github/release-body.md"
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
artifacts: |
|
|
||||||
**/sculptor_*.zip
|
|
||||||
**/sculptor_*.tar.gz
|
|
||||||
##################
|
|
||||||
## Cargo publish #
|
|
||||||
##################
|
|
||||||
|
|
||||||
# cargo_publish:
|
|
||||||
# needs: [create_release]
|
|
||||||
# runs-on: ubuntu-latest
|
|
||||||
# steps:
|
|
||||||
# - name: Checkout
|
|
||||||
# uses: actions/checkout@v4
|
|
||||||
|
|
||||||
# - name: publish to crates.io
|
|
||||||
# uses: katyo/publish-crates@v2
|
|
||||||
# with:
|
|
||||||
# registry-token: ${{ secrets.CRATES_IO_TOKEN }}
|
|
||||||
|
|
||||||
#########################################
|
|
||||||
## Build images for Dockerhub & ghcr.io #
|
|
||||||
#########################################
|
|
||||||
|
|
||||||
image_build:
|
|
||||||
needs: [create_release]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.repository_owner }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
# - name: Login to DockerHub
|
# - name: Login to DockerHub
|
||||||
# uses: docker/login-action@v3
|
# uses: docker/login-action@v3
|
||||||
# with:
|
# with:
|
||||||
# username: ${{ secrets.DOCKERHUB_USERNAME }}
|
# username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
# password: ${{ secrets.DOCKERHUB_TOKEN }}
|
# password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- uses: docker/setup-buildx-action@v3
|
# - name: Login to GitHub Container Registry
|
||||||
id: buildx
|
# uses: docker/login-action@v3
|
||||||
|
# with:
|
||||||
|
# registry: ghcr.io
|
||||||
|
# username: ${{ github.repository_owner }}
|
||||||
|
# password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
# - name: Set up QEMU
|
||||||
|
# uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
install: true
|
context: .
|
||||||
- name: Build for Dockerhub & ghcr.io
|
file: ./Dockerfile
|
||||||
|
build-args: |
|
||||||
|
ALPINE_VERSION
|
||||||
|
RUST_VERSION
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
# push: true
|
||||||
|
tags: |
|
||||||
|
ghcr.io/${{ github.repository_owner }}/sculptor:latest
|
||||||
|
ghcr.io/${{ github.repository_owner }}/sculptor:${{ github.ref_name }}
|
||||||
|
# If we were to push to DockerHub:
|
||||||
|
# ${{ github.repository_owner }}/sculptor:latest
|
||||||
|
# ${{ github.repository_owner }}/sculptor:${{ github.ref_name }}
|
||||||
|
provenance: false
|
||||||
|
sbom: false
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
|
create-release:
|
||||||
|
name: Create GitHub release
|
||||||
|
needs:
|
||||||
|
- build-binary
|
||||||
|
- build-image
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Checkout the code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-tags: true
|
||||||
|
ref: ${{ github.ref }}
|
||||||
|
|
||||||
|
- name: Download the artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
artifact-ids: ${{ needs.build-binary.outputs.binary-artifact-id }}
|
||||||
|
|
||||||
|
- name: Debug tag information
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
docker build --platform linux/amd64 \
|
echo "Workflow triggered by GITHUB_REF_NAME: ${{ github.ref_name }}"
|
||||||
-t ghcr.io/${{ github.repository_owner }}/sculptor:latest \
|
echo "--- Listing all local tags ---"
|
||||||
-t ghcr.io/${{ github.repository_owner }}/sculptor:${{ github.ref_name }} \
|
git tag -l
|
||||||
--provenance=false --sbom=false \
|
echo "--- Showing details for tag '${{ github.ref_name }}' ---"
|
||||||
--push \
|
git show ${{ github.ref_name }} || echo "Error: Tag '${{ github.ref_name }}' not found or 'git show' failed."
|
||||||
-f Dockerfile .
|
echo "--------------------------------"
|
||||||
|
|
||||||
|
- name: Create release
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
run: |
|
||||||
|
gh release create ${{ github.ref_name }} \
|
||||||
|
--verify-tag \
|
||||||
|
--generate-notes \
|
||||||
|
--latest \
|
||||||
|
--draft \
|
||||||
|
binaries-${{ github.ref_name }}/*
|
||||||
24
.github/workflows/rust.yml
vendored
24
.github/workflows/rust.yml
vendored
|
|
@ -1,24 +0,0 @@
|
||||||
name: Rust
|
|
||||||
|
|
||||||
on: workflow_dispatch
|
|
||||||
# push:
|
|
||||||
# branches: [ "master" ]
|
|
||||||
# pull_request:
|
|
||||||
# branches: [ "master" ]
|
|
||||||
|
|
||||||
env:
|
|
||||||
CARGO_TERM_COLOR: always
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: cargo build --verbose
|
|
||||||
|
|
||||||
- name: Run tests
|
|
||||||
run: cargo test --verbose
|
|
||||||
742
Cargo.lock
generated
742
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -25,7 +25,7 @@ dashmap = { version = "6.0", features = ["serde"] }
|
||||||
faster-hex = "0.10"
|
faster-hex = "0.10"
|
||||||
uuid = { version = "1.11", features = ["serde"] }
|
uuid = { version = "1.11", features = ["serde"] }
|
||||||
base64 = "0.22"
|
base64 = "0.22"
|
||||||
reqwest = { version = "0.12", features = ["blocking", "json"] }
|
reqwest = { version = "0.12", default-features = false, features = ["blocking", "json", "rustls-tls"] }
|
||||||
dotenvy = "0.15"
|
dotenvy = "0.15"
|
||||||
semver = "1.0"
|
semver = "1.0"
|
||||||
walkdir = "2.5"
|
walkdir = "2.5"
|
||||||
|
|
@ -34,7 +34,6 @@ zip = "2.2"
|
||||||
notify = "8.0"
|
notify = "8.0"
|
||||||
|
|
||||||
# Crypto
|
# Crypto
|
||||||
openssl = { version = "0.10", features = ["vendored"] }
|
|
||||||
ring = "0.17"
|
ring = "0.17"
|
||||||
rand = "0.9"
|
rand = "0.9"
|
||||||
|
|
||||||
|
|
|
||||||
16
Dockerfile
16
Dockerfile
|
|
@ -1,12 +1,12 @@
|
||||||
ARG ALPINE_VERSION="3.21"
|
ARG ALPINE_VERSION=""
|
||||||
ARG RUST_VERSION="1.85"
|
ARG RUST_VERSION="1"
|
||||||
## Chef
|
## Chef
|
||||||
|
# defaults to rust:1-alpine
|
||||||
FROM --platform=$BUILDPLATFORM rust:${RUST_VERSION}-alpine${ALPINE_VERSION} AS chef
|
FROM --platform=$BUILDPLATFORM rust:${RUST_VERSION}-alpine${ALPINE_VERSION} AS chef
|
||||||
USER root
|
USER root
|
||||||
RUN apk add --no-cache musl-dev libressl-dev zig perl make
|
RUN apk add --no-cache musl-dev cargo-zigbuild
|
||||||
RUN cargo install --locked cargo-chef cargo-zigbuild
|
RUN cargo install --locked cargo-chef
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
ENV PKG_CONFIG_SYSROOT_DIR=/
|
|
||||||
|
|
||||||
## Planner
|
## Planner
|
||||||
FROM chef AS planner
|
FROM chef AS planner
|
||||||
|
|
@ -17,8 +17,8 @@ RUN cargo chef prepare --recipe-path recipe.json
|
||||||
## Builder
|
## Builder
|
||||||
FROM chef AS builder
|
FROM chef AS builder
|
||||||
COPY --from=planner /build/recipe.json recipe.json
|
COPY --from=planner /build/recipe.json recipe.json
|
||||||
# Map Docker's TARGETPLATFORM to Rust's target
|
# Map Docker's TARGETPLATFORM to Rust's build
|
||||||
# and save the result to a .env file
|
# target and save the result to a .env file
|
||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
RUN <<EOT
|
RUN <<EOT
|
||||||
case "${TARGETPLATFORM}" in
|
case "${TARGETPLATFORM}" in
|
||||||
|
|
@ -41,7 +41,7 @@ RUN . /tmp/builder.env && \
|
||||||
ln -s "$PWD/target/$CARGO_BUILD_TARGET/release" /tmp/build-output
|
ln -s "$PWD/target/$CARGO_BUILD_TARGET/release" /tmp/build-output
|
||||||
|
|
||||||
## Runtime
|
## Runtime
|
||||||
FROM alpine:${ALPINE_VERSION} AS runtime
|
FROM alpine:${ALPINE_VERSION:-latest} AS runtime
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=builder /tmp/build-output/sculptor /app/sculptor
|
COPY --from=builder /tmp/build-output/sculptor /app/sculptor
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue