Files
shot-crafter-calculator/.gitea/workflows/ci.yml
T
darroyo 08c0686aae
CI / Build Native (push) Failing after 11m6s
CI / Build & Push Native Image (push) Has been skipped
fix(ci): add verify step before upload to debug missing binary
The upload-artifact step failed with exit code 1 but no details.
The most likely cause is that the binary file does not exist
at the expected path `target/shot-crafter-calculator-1.0.0-runner`
because the native build may have failed silently.

Add a 'Verify native binary' step that runs `ls -la target/` and
`file target/shot-crafter-calculator-1.0.0-runner` so the next
log shows exactly what's in target/ and what type the runtime
sees the binary as. Also make the upload's 'if-no-files-found'
explicit so the failure mode is unambiguous.
2026-08-12 18:45:49 -04:00

115 lines
3.2 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build-native:
name: Build Native
runs-on: ubuntu-latest
container:
image: maven:3.9.6-eclipse-temurin-21
options: --memory=8g
steps:
- name: Install git, node, gcc, and basic tools
run: |
apt-get update
apt-get install -y git curl ca-certificates build-essential zlib1g-dev
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt-get install -y nodejs
rm -rf /var/lib/apt/lists/*
git --version
node --version
gcc --version
- name: Checkout
uses: actions/checkout@v4
- name: Cache Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Set up GraalVM
uses: graalvm/setup-graalvm@v1
with:
distribution: 'graalvm'
java-version: '21'
components: 'native-image'
- name: Cache Node + npm
uses: actions/cache@v4
with:
path: |
target/node
src/frontend/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('src/frontend/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- name: Build (Native)
run: mvn package -Pnative -B -DskipTests -Dquarkus.native.native-image-xmx=4g
- name: Verify native binary
run: |
ls -la target/
file target/shot-crafter-calculator-1.0.0-runner 2>/dev/null || echo "binary not found"
- name: Upload Native binary
uses: actions/upload-artifact@v4
with:
name: shot-crafter-calculator-runner
path: target/shot-crafter-calculator-1.0.0-runner
if-no-files-found: error
docker-native:
name: Build & Push Native Image
runs-on: ubuntu-latest
needs: build-native
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download native binary
uses: actions/download-artifact@v4
with:
name: shot-crafter-calculator-runner
path: target/
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Gitea Container Registry
uses: docker/login-action@v3
with:
registry: gitea.danielarroyo.cl
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Extract short SHA
id: meta
run: echo "short_sha=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: true
tags: |
gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:latest
gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:${{ steps.meta.outputs.short_sha }}
platforms: linux/amd64