1
0
mirror of https://github.com/aziascreations/BakaShrot.git synced 2026-11-23 20:58:46 +01:00
Files
BakaShrot/.github/workflows/ci.yml
T
aziascreations 5045019df4 Moved the workspace to the root, Added the build scripts, ARM64 releases and the Docker image
Source/'s content is at the root now, Source/README.md merged into
readme.md. Scripts at the root: build.ps1, test.ps1 (was check.ps1),
release.ps1 (over release.py) and clean.ps1. Everything is LF except the
.ps1 files.

CI (.github/workflows/ci.yml) runs on a v* tag or by hand: the checks,
then a release for Windows x64 and ARM64 and Linux x64 and ARM64, each on
its own kind of runner, the archives kept as artifacts. release.py names
the platform from the Rust host, make_wheel.py tags the wheel from the
library's header.

docker/: the server's image (built from source, the tools beside it, uid
10001), compose.yml and test.sh. CI builds amd64 and arm64 natively,
checks them, and on a tag pushes them to ghcr.io with an index for
<version> and latest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 01:13:44 +01:00

143 lines
5.2 KiB
YAML

# On a version tag, or run by hand: the same checks as test.ps1 (Windows
# and Linux), then a release for each platform (release.py), its archive
# kept as the run's artifact, and the server's Docker image for amd64 and
# arm64, checked (docker/test.sh), pushed to ghcr.io on a tag only. Gitea
# Actions runs this file too.
name: CI
on:
push:
tags: ["v*"]
workflow_dispatch:
env:
IMAGE: ghcr.io/aziascreations/bakashrot-server
jobs:
check:
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
# Installs the toolchain rust-toolchain.toml pins.
- run: rustup toolchain install
- run: cargo fmt --all -- --check
- run: cargo clippy --workspace --all-targets --all-features -- -D warnings
- run: cargo test --workspace --all-features
- run: cargo doc --workspace --no-deps --all-features
env:
RUSTDOCFLAGS: -D warnings
release:
# Build, package, smoke test, each on its own kind of machine: no
# cross-compiling, and the smoke test runs where the release will.
# Linux builds in manylinux 2.28 (glibc 2.28): the programs, the .so
# and the wheel run on systems that old.
needs: check
strategy:
fail-fast: false
matrix:
include:
- platform: windows-x64
os: windows-latest
arch: x64
- platform: windows-arm64
# aws-lc needs clang-cl there: Visual Studio's, on this image.
os: windows-11-arm
arch: arm64
- platform: linux-x64
os: ubuntu-latest
container: quay.io/pypa/manylinux_2_28_x86_64
- platform: linux-arm64
os: ubuntu-24.04-arm
container: quay.io/pypa/manylinux_2_28_aarch64
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
# Windows: a Python of the machine's architecture (the smoke test
# loads the DLL into it). Linux: the container's.
- if: ${{ !matrix.container }}
uses: actions/setup-python@v5
with:
python-version: "3.12"
architecture: ${{ matrix.arch }}
- if: ${{ matrix.container }}
run: echo "/opt/python/cp312-cp312/bin" >> "$GITHUB_PATH"
# rustup, where the image has none.
- run: |
if ! command -v rustup; then
if [ "$RUNNER_OS" = Windows ]; then
curl --proto '=https' -sSfo rustup-init.exe https://static.rust-lang.org/rustup/dist/aarch64-pc-windows-msvc/rustup-init.exe
./rustup-init.exe -y --default-toolchain none
rm rustup-init.exe
echo "$USERPROFILE/.cargo/bin" >> "$GITHUB_PATH"
else
curl --proto '=https' -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
fi
fi
- run: rustup toolchain install
- run: python release.py
- uses: actions/upload-artifact@v4
with:
name: bakashrot-${{ matrix.platform }}
path: |
target/dist/*.zip
target/dist/*.tar.gz
if-no-files-found: error
docker:
# The server's image, each architecture built on its own kind of
# machine (no emulation), checked, then pushed as <version>-<arch> on a
# tag. Run by hand, it's built and checked only.
needs: check
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
os: ubuntu-latest
- arch: arm64
os: ubuntu-24.04-arm
runs-on: ${{ matrix.os }}
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- run: |
if [ "$GITHUB_REF_TYPE" = tag ]; then version=${GITHUB_REF_NAME#v}; else version=manual; fi
echo "TAG=$IMAGE:$version-${{ matrix.arch }}" >> "$GITHUB_ENV"
- run: docker build -f docker/Dockerfile -t "$TAG" .
- run: sh docker/test.sh "$TAG"
- if: github.ref_type == 'tag'
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
docker push "$TAG"
docker-index:
# One image for both architectures, <version> and latest: an index of
# the two, once the releases passed too. GitHub reads the source label
# on an index from its annotations.
if: github.ref_type == 'tag'
needs: [docker, release]
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
version=${GITHUB_REF_NAME#v}
docker buildx imagetools create -t "$IMAGE:$version" -t "$IMAGE:latest" \
--annotation "index:org.opencontainers.image.source=https://github.com/aziascreations/BakaShrot" \
--annotation "index:org.opencontainers.image.description=BakaShrot server" \
--annotation "index:org.opencontainers.image.licenses=CC0-1.0" \
"$IMAGE:$version-amd64" "$IMAGE:$version-arm64"