CI refactor
Some checks failed
Build and Test / build-editions (terraria) (push) Failing after 1m12s
Build and Test / build-editions (DATABASE_SMM, puyopuyo) (push) Failing after 1m15s
Build and Test / build-editions (wii-u-chat) (push) Failing after 1m16s
Build and Test / build-editions (splatoon) (push) Failing after 1m16s
Build and Test / build-editions (fast-racing-neo) (push) Failing after 1m16s
Build and Test / build-editions (DATABASE_FRIENDS, friends) (push) Failing after 1m16s
Build and Test / build-editions (mario-tennis) (push) Failing after 1m17s
Build and Test / build-editions (sonic-transformed) (push) Failing after 1m17s
Build and Test / build-editions (splatoon-testfire) (push) Failing after 1m18s
Build and Test / build-editions (minecraft-wiiu) (push) Failing after 1m18s
Build and Test / build-editions (DATABASE_SMM, wii-sports-club) (push) Failing after 1m18s
Build and Test / build-editions (DATABASE_SMM, super-mario-maker) (push) Failing after 1m18s

This commit is contained in:
red binder 2026-08-08 05:53:38 +02:00
commit 9a621ed6bd
3 changed files with 67 additions and 399 deletions

View file

@ -1,15 +1,33 @@
#!/usr/bin/env bash
export EDITION=$1
source /etc/environment
: "${RNEX_CONTAINER_PLATFORM:=podman}"
set -e
for TARGET in node-holder proxy-secure proxy-insecure backend-auth backend-secure; do
export EDITION=$1
source /etc/environment 2>/dev/null || true
: "${RNEX_CONTAINER_PLATFORM:=docker}"
export SHORT_SHA=${GITHUB_SHA::6}
export CI_COMMIT_SHORT_SHA=${CI_COMMIT_SHORT_SHA:-$SHORT_SHA}
echo "building $EDITION"
export RNEX_STATIC=1
export TARGET_DIR="target/x86_64-unknown-linux-musl/release"
./test-edition.sh
./build-edition.sh
mkdir -p dist/
cp $TARGET_DIR/rnex-server-backend-node-holder dist/
cp $TARGET_DIR/proxy_insecure dist/
cp $TARGET_DIR/proxy_secure dist/
cp $TARGET_DIR/rnex-server-backend-auth dist/
cp $TARGET_DIR/rnex-server-backend-secure dist/
TARGETS=("node-holder" "proxy-secure" "proxy-insecure" "backend-auth" "backend-secure")
for TARGET in "${TARGETS[@]}"; do
$RNEX_CONTAINER_PLATFORM build \
--network=host \
--build-arg EDITION="$EDITION" \
--build-arg DATABASE_URL="$DATABASE_URL" \
-t "$CI_REGISTRY_IMAGE/$EDITION/$TARGET:$CI_COMMIT_SHORT_SHA" \
--target="$TARGET" .
--target="$TARGET" \
-t "$CI_REGISTRY_IMAGE/$EDITION/$TARGET:$CI_COMMIT_SHORT_SHA" .
$RNEX_CONTAINER_PLATFORM push "$CI_REGISTRY_IMAGE/$EDITION/$TARGET:$CI_COMMIT_SHORT_SHA"
done

View file

@ -7,11 +7,30 @@ on:
env:
DOCKER_TLS_CERTDIR: /certs
IMAGE_TAG: ${{ github.sha }}
SHORT_SHA: ${{ github.sha }}
jobs:
sonic-transformed:
build-editions:
runs-on: debian-trixie
strategy:
fail-fast: false
matrix:
include:
- edition: sonic-transformed
- edition: mario-tennis
- edition: wii-sports-club
db_secret: DATABASE_SMM
- edition: puyopuyo
db_secret: DATABASE_SMM
- edition: minecraft-wiiu
- edition: splatoon-testfire
- edition: fast-racing-neo
- edition: wii-u-chat
- edition: splatoon
- edition: friends
db_secret: DATABASE_FRIENDS
- edition: super-mario-maker
db_secret: DATABASE_SMM
- edition: terraria
steps:
- name: Checkout repository
@ -19,357 +38,26 @@ jobs:
with:
submodules: recursive
- name: Cache container storage
- name: Cache Cargo registry and target
uses: actions/cache@v6
with:
path: |
/var/lib/containers/storage
/run/containers/storage
~/.local/share/containers/storage
key: image-cache
~/.cargo/registry
~/.cargo/git
target/
key: cargo-${{ matrix.edition }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-${{ matrix.edition }}-
- name: Login to registry
run: docker login -u ${{ secrets.PACKAGE_USER }} -p ${{ secrets.PACKAGE_PWD }} git.spbr.net
- name: Set short SHA
run: echo "SHORT_SHA=${GITHUB_SHA::6}" >> $GITHUB_ENV
- name: Build Sonic Transformed edition
- name: Set environment variables & build
env:
CI_REGISTRY_IMAGE: git.spbr.net/spacebar/rust-nex
CI_COMMIT_SHORT_SHA: ${{ env.SHORT_SHA }}
run: ./.ci-scripts/make-edition.sh sonic-transformed
mario-tennis:
runs-on: debian-trixie
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
submodules: recursive
- name: Cache container storage
uses: actions/cache@v6
with:
path: |
/var/lib/containers/storage
/run/containers/storage
~/.local/share/containers/storage
key: image-cache
- name: Login to registry
run: docker login -u ${{ secrets.PACKAGE_USER }} -p ${{ secrets.PACKAGE_PWD }} git.spbr.net
- name: Set short SHA
run: echo "SHORT_SHA=${GITHUB_SHA::6}" >> $GITHUB_ENV
- name: Build MTUS edition
env:
CI_REGISTRY_IMAGE: git.spbr.net/spacebar/rust-nex
CI_COMMIT_SHORT_SHA: ${{ env.SHORT_SHA }}
run: ./.ci-scripts/make-edition.sh mario-tennis
wii-sports-club:
runs-on: debian-trixie
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
submodules: recursive
- name: Cache container storage
uses: actions/cache@v6
with:
path: |
/var/lib/containers/storage
/run/containers/storage
~/.local/share/containers/storage
key: image-cache
- name: Login to registry
run: docker login -u ${{ secrets.PACKAGE_USER }} -p ${{ secrets.PACKAGE_PWD }} git.spbr.net
- name: Set short SHA
run: echo "SHORT_SHA=${GITHUB_SHA::6}" >> $GITHUB_ENV
- name: Build Wii Sports Club edition
env:
CI_REGISTRY_IMAGE: git.spbr.net/spacebar/rust-nex
CI_COMMIT_SHORT_SHA: ${{ env.SHORT_SHA }}
DATABASE_URL: ${{ secrets.DATABASE_SMM }}
run: ./.ci-scripts/make-edition.sh wii-sports-club
puyopuyo:
runs-on: debian-trixie
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
submodules: recursive
- name: Cache container storage
uses: actions/cache@v6
with:
path: |
/var/lib/containers/storage
/run/containers/storage
~/.local/share/containers/storage
key: image-cache
- name: Login to registry
run: docker login -u ${{ secrets.PACKAGE_USER }} -p ${{ secrets.PACKAGE_PWD }} git.spbr.net
- name: Set short SHA
run: echo "SHORT_SHA=${GITHUB_SHA::6}" >> $GITHUB_ENV
- name: Build puyo puyo tetris edition
env:
CI_REGISTRY_IMAGE: git.spbr.net/spacebar/rust-nex
CI_COMMIT_SHORT_SHA: ${{ env.SHORT_SHA }}
DATABASE_URL: ${{ secrets.DATABASE_SMM }}
run: ./.ci-scripts/make-edition.sh puyopuyo
minecraft-wiiu:
runs-on: debian-trixie
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
submodules: recursive
- name: Cache container storage
uses: actions/cache@v6
with:
path: |
/var/lib/containers/storage
/run/containers/storage
~/.local/share/containers/storage
key: image-cache
- name: Login to registry
run: docker login -u ${{ secrets.PACKAGE_USER }} -p ${{ secrets.PACKAGE_PWD }} git.spbr.net
- name: Set short SHA
run: echo "SHORT_SHA=${GITHUB_SHA::6}" >> $GITHUB_ENV
- name: Build Minecraft Wii U edition
env:
CI_REGISTRY_IMAGE: git.spbr.net/spacebar/rust-nex
CI_COMMIT_SHORT_SHA: ${{ env.SHORT_SHA }}
run: ./.ci-scripts/make-edition.sh minecraft-wiiu
splatoon-testfire:
runs-on: debian-trixie
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
submodules: recursive
- name: Cache container storage
uses: actions/cache@v6
with:
path: |
/var/lib/containers/storage
/run/containers/storage
~/.local/share/containers/storage
key: image-cache
- name: Login to registry
run: docker login -u ${{ secrets.PACKAGE_USER }} -p ${{ secrets.PACKAGE_PWD }} git.spbr.net
- name: Set short SHA
run: echo "SHORT_SHA=${GITHUB_SHA::6}" >> $GITHUB_ENV
- name: Build Splatoon Testfire edition
env:
CI_REGISTRY_IMAGE: git.spbr.net/spacebar/rust-nex
CI_COMMIT_SHORT_SHA: ${{ env.SHORT_SHA }}
run: ./.ci-scripts/make-edition.sh splatoon-testfire
fast-racing-neo:
runs-on: debian-trixie
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
submodules: recursive
- name: Cache container storage
uses: actions/cache@v6
with:
path: |
/var/lib/containers/storage
/run/containers/storage
~/.local/share/containers/storage
key: image-cache
- name: Login to registry
run: docker login -u ${{ secrets.PACKAGE_USER }} -p ${{ secrets.PACKAGE_PWD }} git.spbr.net
- name: Set short SHA
run: echo "SHORT_SHA=${GITHUB_SHA::6}" >> $GITHUB_ENV
- name: Build Fast Racing NEO edition
env:
CI_REGISTRY_IMAGE: git.spbr.net/spacebar/rust-nex
CI_COMMIT_SHORT_SHA: ${{ env.SHORT_SHA }}
run: ./.ci-scripts/make-edition.sh fast-racing-neo
wii-u-chat:
runs-on: debian-trixie
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
submodules: recursive
- name: Cache container storage
uses: actions/cache@v6
with:
path: |
/var/lib/containers/storage
/run/containers/storage
~/.local/share/containers/storage
key: image-cache
- name: Login to registry
run: docker login -u ${{ secrets.PACKAGE_USER }} -p ${{ secrets.PACKAGE_PWD }} git.spbr.net
- name: Set short SHA
run: echo "SHORT_SHA=${GITHUB_SHA::6}" >> $GITHUB_ENV
- name: Build Wii U Chat edition
env:
CI_REGISTRY_IMAGE: git.spbr.net/spacebar/rust-nex
CI_COMMIT_SHORT_SHA: ${{ env.SHORT_SHA }}
run: ./.ci-scripts/make-edition.sh wii-u-chat
splatoon:
runs-on: debian-trixie
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
submodules: recursive
- name: Cache container storage
uses: actions/cache@v6
with:
path: |
/var/lib/containers/storage
/run/containers/storage
~/.local/share/containers/storage
key: image-cache
- name: Login to registry
run: docker login -u ${{ secrets.PACKAGE_USER }} -p ${{ secrets.PACKAGE_PWD }} git.spbr.net
- name: Set short SHA
run: echo "SHORT_SHA=${GITHUB_SHA::6}" >> $GITHUB_ENV
- name: Build Splatoon edition
env:
CI_REGISTRY_IMAGE: git.spbr.net/spacebar/rust-nex
CI_COMMIT_SHORT_SHA: ${{ env.SHORT_SHA }}
run: ./.ci-scripts/make-edition.sh splatoon
friends:
runs-on: debian-trixie
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
submodules: recursive
- name: Cache container storage
uses: actions/cache@v6
with:
path: |
/var/lib/containers/storage
/run/containers/storage
~/.local/share/containers/storage
key: image-cache
- name: Set short SHA
run: echo "SHORT_SHA=${GITHUB_SHA::6}" >> $GITHUB_ENV
- name: Login to registry
run: podman login -u ${{ secrets.PACKAGE_USER }} -p ${{ secrets.PACKAGE_PWD }} git.spbr.net
- name: Build Friends edition
env:
CI_REGISTRY_IMAGE: git.spbr.net/spacebar/rust-nex
CI_COMMIT_SHORT_SHA: ${{ env.SHORT_SHA }}
DATABASE_URL: ${{ secrets.DATABASE_FRIENDS }}
run: ./.ci-scripts/make-edition.sh friends
super-mario-maker:
runs-on: debian-trixie
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
submodules: recursive
- name: Cache container storage
uses: actions/cache@v6
with:
path: |
/var/lib/containers/storage
/run/containers/storage
~/.local/share/containers/storage
key: image-cache
- name: Set short SHA
run: echo "SHORT_SHA=${GITHUB_SHA::6}" >> $GITHUB_ENV
- name: Login to registry
run: podman login -u ${{ secrets.PACKAGE_USER }} -p ${{ secrets.PACKAGE_PWD }} git.spbr.net
- name: Build Super Mario Maker edition
env:
CI_REGISTRY_IMAGE: git.spbr.net/spacebar/rust-nex
CI_COMMIT_SHORT_SHA: ${{ env.SHORT_SHA }}
DATABASE_URL: ${{ secrets.DATABASE_SMM }}
run: ./.ci-scripts/make-edition.sh super-mario-maker
terraria:
runs-on: debian-trixie
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
submodules: recursive
- name: Cache container storage
uses: actions/cache@v6
with:
path: |
/var/lib/containers/storage
/run/containers/storage
~/.local/share/containers/storage
key: image-cache
- name: Login to registry
run: docker login -u ${{ secrets.PACKAGE_USER }} -p ${{ secrets.PACKAGE_PWD }} git.spbr.net
- name: Set short SHA
run: echo "SHORT_SHA=${GITHUB_SHA::6}" >> $GITHUB_ENV
- name: Build Terraria edition
env:
CI_REGISTRY_IMAGE: git.spbr.net/spacebar/rust-nex
CI_COMMIT_SHORT_SHA: ${{ env.SHORT_SHA }}
run: ./.ci-scripts/make-edition.sh terraria
SHORT_SHA: ${{ github.sha }}
DATABASE_URL: ${{ matrix.db_secret != '' && secrets[matrix.db_secret] || '' }}
run: |
echo "SHORT_SHA=${SHORT_SHA::6}" >> $GITHUB_ENV
export CI_COMMIT_SHORT_SHA="${SHORT_SHA::6}"
./.ci-scripts/make-edition.sh ${{ matrix.edition }}

View file

@ -1,58 +1,20 @@
# syntax=docker/dockerfile:1
FROM rust:alpine AS chef
RUN apk add --no-cache musl-dev lld g++ make
RUN cargo install cargo-chef
WORKDIR /app
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
RUN apk add --no-cache protobuf-dev git openssl-dev openssl-libs-static bash yq ca-certificates
COPY --from=planner /app/recipe.json recipe.json
ARG EDITION
ARG DATABASE_URL
RUN --mount=type=cache,id=${EDITION}-registry,target=/usr/local/cargo/registry \
--mount=type=cache,id=${EDITION}-target,target=/app/target \
cargo chef cook --release --recipe-path recipe.json --target x86_64-unknown-linux-musl && \
cargo chef cook --tests --target x86_64-unknown-linux-musl --recipe-path recipe.json
COPY . .
RUN --mount=type=cache,id=${EDITION}-registry,target=/usr/local/cargo/registry \
--mount=type=cache,id=${EDITION}-target,target=/app/target \
RNEX_STATIC=1 ./test-edition.sh && RNEX_STATIC=1 ./build-edition.sh && \
mkdir -p /app/dist && \
cp /app/target/x86_64-unknown-linux-musl/release/rnex-server-backend-node-holder /app/dist/ && \
cp /app/target/x86_64-unknown-linux-musl/release/proxy_insecure /app/dist/ && \
cp /app/target/x86_64-unknown-linux-musl/release/proxy_secure /app/dist/ && \
cp /app/target/x86_64-unknown-linux-musl/release/rnex-server-backend-auth /app/dist/ && \
cp /app/target/x86_64-unknown-linux-musl/release/rnex-server-backend-secure /app/dist/
FROM scratch AS node-holder
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /app/dist/rnex-server-backend-node-holder /rnex-server-backend-node-holder
COPY dist/rnex-server-backend-node-holder /rnex-server-backend-node-holder
ENTRYPOINT ["/rnex-server-backend-node-holder"]
FROM scratch AS proxy-insecure
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /app/dist/proxy_insecure /proxy_insecure
COPY dist/proxy_insecure /proxy_insecure
ENTRYPOINT ["/proxy_insecure"]
FROM scratch AS proxy-secure
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /app/dist/proxy_secure /proxy_secure
COPY dist/proxy_secure /proxy_secure
ENTRYPOINT ["/proxy_secure"]
FROM scratch AS backend-auth
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /app/dist/rnex-server-backend-auth /rnex-server-backend-auth
COPY dist/rnex-server-backend-auth /rnex-server-backend-auth
ENTRYPOINT ["/rnex-server-backend-auth"]
FROM scratch AS backend-secure
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /app/dist/rnex-server-backend-secure /rnex-server-backend-secure
ENTRYPOINT ["/rnex-server-backend-secure"]
COPY dist/rnex-server-backend-secure /rnex-server-backend-secure
ENTRYPOINT ["/rnex-server-backend-secure"]