Testing workflow
Some checks failed
Multi-Platform Release Build / build (false, linux/arm64, native) (push) Failing after 11s
Multi-Platform Release Build / build (true, linux/amd64, x86_64-pc-windows-gnu) (push) Failing after 1s
Multi-Platform Release Build / build (true, linux/amd64, x86_64-unknown-linux-gnu) (push) Failing after 1s
Multi-Platform Release Build / create-release (push) Has been skipped

This commit is contained in:
Marco De Araujo 2026-01-01 08:34:48 -04:00
parent 041e5622b6
commit 1de395dfc0

View file

@ -52,56 +52,53 @@ jobs:
${{ runner.os }}-cargo-${{ matrix.target }}- ${{ runner.os }}-cargo-${{ matrix.target }}-
${{ runner.os }}-cargo- ${{ runner.os }}-cargo-
- name: Configure cross-compilation - name: Native Build Release
if: matrix.cross && matrix.target != 'native' && !matrix.container if: matrix.target == 'native'
run: | run: |
mkdir -p .cargo NATIVE_TARGET=$(rustc -vV | grep 'host:' | cut -d' ' -f2)
cat >> .cargo/config.toml << EOF echo "Building for native target: $NATIVE_TARGET"
[target.${{ matrix.target }}] cargo build --release
linker = "${{ matrix.linker }}" TARGET_BINARY="target/release/uptime-kuma-dashboard"
EOF OUTPUT_NAME="uptime-kuma-dashboard-$NATIVE_TARGET"
- name: Build release
run: |
if [ "${{ matrix.target }}" = "native" ]; then
NATIVE_TARGET=$(rustc -vV | grep 'host:' | cut -d' ' -f2)
echo "Building for native target: $NATIVE_TARGET"
cargo build --release
TARGET_BINARY="target/release/uptime-kuma-dashboard"
OUTPUT_NAME="uptime-kuma-dashboard-$NATIVE_TARGET"
else
echo "Building for target: ${{ matrix.target }}"
# Os containers especializados já têm tudo configurado
cargo build --release --target ${{ matrix.target }}
if [[ "${{ matrix.target }}" == *"windows"* ]]; then
TARGET_BINARY="target/${{ matrix.target }}/release/uptime-kuma-dashboard.exe"
OUTPUT_NAME="uptime-kuma-dashboard-${{ matrix.target }}.exe"
else
TARGET_BINARY="target/${{ matrix.target }}/release/uptime-kuma-dashboard"
OUTPUT_NAME="uptime-kuma-dashboard-${{ matrix.target }}"
fi
fi
mkdir -p release-artifacts mkdir -p release-artifacts
if [ ! -f "$TARGET_BINARY" ]; then
echo "Error: Binary not found at $TARGET_BINARY"
exit 1
fi
cp "$TARGET_BINARY" "release-artifacts/$OUTPUT_NAME" cp "$TARGET_BINARY" "release-artifacts/$OUTPUT_NAME"
strip "release-artifacts/$OUTPUT_NAME" 2>/dev/null || true
if [[ "${{ matrix.target }}" == *"linux"* ]] || [ "${{ matrix.target }}" = "native" ]; then chmod +x "release-artifacts/$OUTPUT_NAME"
strip "release-artifacts/$OUTPUT_NAME" 2>/dev/null || echo "Strip failed, continuing..."
fi
if [[ "${{ matrix.target }}" != *"windows"* ]]; then
chmod +x "release-artifacts/$OUTPUT_NAME"
fi
ls -lh "release-artifacts/$OUTPUT_NAME" ls -lh "release-artifacts/$OUTPUT_NAME"
file "release-artifacts/$OUTPUT_NAME" || true
- name: Cross-Build Release (Linux x86_64)
if: matrix.target == 'x86_64-unknown-linux-gnu'
uses: docker://rust:alpine
with:
args: >
sh -c "
apk add --no-cache build-base musl-dev gcc g++ &&
rustup target add x86_64-unknown-linux-gnu &&
cargo build --release --target x86_64-unknown-linux-gnu &&
mkdir -p release-artifacts &&
cp target/x86_64-unknown-linux-gnu/release/uptime-kuma-dashboard release-artifacts/uptime-kuma-dashboard-x86_64-unknown-linux-gnu &&
strip release-artifacts/uptime-kuma-dashboard-x86_64-unknown-linux-gnu &&
chmod +x release-artifacts/uptime-kuma-dashboard-x86_64-unknown-linux-gnu &&
ls -lh release-artifacts/"
env:
CARGO_TARGET_DIR: target
options: --platform linux/amd64
- name: Cross-Build Release (Windows x86_64)
if: matrix.target == 'x86_64-pc-windows-gnu'
uses: docker://rust:alpine
with:
args: >
sh -c "
apk add --no-cache build-base mingw-w64-gcc mingw-w64-headers mingw-w64-crt mingw-w64-winpthreads &&
rustup target add x86_64-pc-windows-gnu &&
cargo build --release --target x86_64-pc-windows-gnu &&
mkdir -p release-artifacts &&
cp target/x86_64-pc-windows-gnu/release/uptime-kuma-dashboard.exe release-artifacts/uptime-kuma-dashboard-x86_64-pc-windows-gnu.exe &&
ls -lh release-artifacts/"
env:
CARGO_TARGET_DIR: target
options: --platform linux/amd64
- name: Upload artifacts - name: Upload artifacts
uses: https://data.forgejo.org/forgejo/upload-artifact@v4 uses: https://data.forgejo.org/forgejo/upload-artifact@v4