Testing workflow
Some checks failed
Multi-Platform Release Build / build (false, native) (push) Failing after 12m51s
Multi-Platform Release Build / build (true, aarch64-linux-gnu-gcc, aarch64-unknown-linux-gnu) (push) Failing after 1m54s
Multi-Platform Release Build / build (true, arm-linux-gnueabihf-gcc, armv7-unknown-linux-gnueabihf) (push) Failing after 1m37s
Multi-Platform Release Build / build (true, x86_64-linux-gnu-gcc, x86_64-unknown-linux-gnu) (push) Failing after 1m38s
Multi-Platform Release Build / build (true, x86_64-w64-mingw32-gcc, x86_64-pc-windows-gnu) (push) Failing after 2m1s
Multi-Platform Release Build / create-release (push) Has been skipped

This commit is contained in:
Marco De Araujo 2025-12-31 07:28:55 -04:00
parent 7082ce4dfc
commit 98da3e0c05

View file

@ -24,33 +24,48 @@ jobs:
- target: x86_64-pc-windows-gnu - target: x86_64-pc-windows-gnu
cross: true cross: true
linker: x86_64-w64-mingw32-gcc linker: x86_64-w64-mingw32-gcc
container:
image: rust:alpine
options: --platform linux/arm64
steps: steps:
- name: Checkout code - name: Checkout code
uses: docker/checkout@v4 uses: https://code.forgejo.org/actions/checkout@v4
- name: Install build dependencies - name: Setup Rust
run: | uses: https://github.com/dtolnay/rust-toolchain@stable
apk update with:
apk add --no-cache \ toolchain: stable
build-base \
gcc-arm-linux-gnueabihf \
gcc-aarch64-linux-gnu \
gcc-x86_64-linux-gnu \
g++-arm-linux-gnueabihf \
g++-aarch64-linux-gnu \
mingw-w64 \
libc6-dev-armhf-cross \
libc6-dev-arm64-cross \
musl-dev \
linux-headers
- name: Add Rust target - name: Add Rust target
if: matrix.target != 'native' if: matrix.target != 'native'
run: rustup target add ${{ matrix.target }} run: rustup target add ${{ matrix.target }}
- name: Install cross-compilation tools
if: matrix.cross
run: |
sudo apt-get update
sudo apt-get install -y \
gcc-arm-linux-gnueabihf \
gcc-aarch64-linux-gnu \
gcc-x86-64-linux-gnu \
g++-arm-linux-gnueabihf \
g++-aarch64-linux-gnu \
mingw-w64 \
libc6-dev-armhf-cross \
libc6-dev-arm64-cross
- name: Cache Rust dependencies
uses: https://code.forgejo.org/actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ matrix.target }}-
${{ runner.os }}-cargo-
- name: Configure cross-compilation - name: Configure cross-compilation
if: matrix.cross && matrix.target != 'native' if: matrix.cross && matrix.target != 'native'
run: | run: |
@ -63,16 +78,15 @@ jobs:
- name: Build release - name: Build release
run: | run: |
if [ "${{ matrix.target }}" = "native" ]; then if [ "${{ matrix.target }}" = "native" ]; then
# Build nativo para a arquitetura do runner
NATIVE_TARGET=$(rustc -vV | grep 'host:' | cut -d' ' -f2) NATIVE_TARGET=$(rustc -vV | grep 'host:' | cut -d' ' -f2)
echo "Building for native target: $NATIVE_TARGET" echo "Building for native target: $NATIVE_TARGET"
cargo build --release --features production cargo build --release
TARGET_BINARY="target/release/uptime-kuma-dashboard" TARGET_BINARY="target/release/uptime-kuma-dashboard"
OUTPUT_NAME="uptime-kuma-dashboard-$NATIVE_TARGET" OUTPUT_NAME="uptime-kuma-dashboard-$NATIVE_TARGET"
else else
# Build com target específico
echo "Building for target: ${{ matrix.target }}" echo "Building for target: ${{ matrix.target }}"
cargo build --release --target ${{ matrix.target }} --features production cargo build --release --target ${{ matrix.target }}
if [[ "${{ matrix.target }}" == *"windows"* ]]; then if [[ "${{ matrix.target }}" == *"windows"* ]]; then
TARGET_BINARY="target/${{ matrix.target }}/release/uptime-kuma-dashboard.exe" TARGET_BINARY="target/${{ matrix.target }}/release/uptime-kuma-dashboard.exe"
OUTPUT_NAME="uptime-kuma-dashboard-${{ matrix.target }}.exe" OUTPUT_NAME="uptime-kuma-dashboard-${{ matrix.target }}.exe"
@ -81,29 +95,29 @@ jobs:
OUTPUT_NAME="uptime-kuma-dashboard-${{ matrix.target }}" OUTPUT_NAME="uptime-kuma-dashboard-${{ matrix.target }}"
fi fi
fi fi
# Criar diretório de artifacts
mkdir -p release-artifacts mkdir -p release-artifacts
# Verificar se o binário foi criado
if [ ! -f "$TARGET_BINARY" ]; then if [ ! -f "$TARGET_BINARY" ]; then
echo "Error: Binary not found at $TARGET_BINARY" echo "Error: Binary not found at $TARGET_BINARY"
exit 1 exit 1
fi fi
# Copiar binário
cp "$TARGET_BINARY" "release-artifacts/$OUTPUT_NAME" cp "$TARGET_BINARY" "release-artifacts/$OUTPUT_NAME"
# Strip binário para Linux (reduz tamanho)
if [[ "${{ matrix.target }}" == *"linux"* ]] || [ "${{ matrix.target }}" = "native" ]; then if [[ "${{ matrix.target }}" == *"linux"* ]] || [ "${{ matrix.target }}" = "native" ]; then
strip "release-artifacts/$OUTPUT_NAME" 2>/dev/null || echo "Strip failed, continuing..." strip "release-artifacts/$OUTPUT_NAME" 2>/dev/null || echo "Strip failed, continuing..."
fi fi
# Tornar executável
if [[ "${{ matrix.target }}" != *"windows"* ]]; then if [[ "${{ matrix.target }}" != *"windows"* ]]; then
chmod +x "release-artifacts/$OUTPUT_NAME" chmod +x "release-artifacts/$OUTPUT_NAME"
fi fi
# Mostrar informações do arquivo
ls -lh "release-artifacts/$OUTPUT_NAME" ls -lh "release-artifacts/$OUTPUT_NAME"
file "release-artifacts/$OUTPUT_NAME" || true file "release-artifacts/$OUTPUT_NAME" || true
- name: Upload artifacts - name: Upload artifacts
uses: docker/upload-artifact@v4 uses: https://code.forgejo.org/actions/upload-artifact@v4
with: with:
name: binary-${{ matrix.target }} name: binary-${{ matrix.target }}
path: release-artifacts/ path: release-artifacts/
@ -116,10 +130,10 @@ jobs:
contents: write contents: write
steps: steps:
- name: Checkout code - name: Checkout code
uses: docker/checkout@v4 uses: https://code.forgejo.org/actions/checkout@v4
- name: Download all artifacts - name: Download all artifacts
uses: docker/download-artifact@v4 uses: https://code.forgejo.org/actions/download-artifact@v4
with: with:
path: all-artifacts/ path: all-artifacts/
@ -136,13 +150,15 @@ jobs:
cat SHA256SUMS.txt cat SHA256SUMS.txt
- name: Create Release - name: Create Release
uses: docker/gitea-release-action@v1 uses: https://code.forgejo.org/actions/forgejo-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
files: release-artifacts/* direction: upload
token: ${{ secrets.FORGEGO_TOKEN }} release-dir: release-artifacts
tag_name: ${{ forgejo.ref_name }} title: "Release ${{ github.ref_name }}"
name: Release ${{ forgejo.ref_name }} tag: ${{ github.ref_name }}
body: | release-notes: |
## 🚀 Multi-Platform Release ## 🚀 Multi-Platform Release
Compiled on runner **${{ env.RUNNER_ARCH }}** Compiled on runner **${{ env.RUNNER_ARCH }}**
### 📦 Available Binaries ### 📦 Available Binaries