Files
shot-crafter-calculator/.gitea/workflows/ci.yml
T
darroyo fb26361f85
CI / Build Native (push) Failing after 11m27s
fix(ci): merge build-native and docker into one job to avoid 117MB artifact upload
The runner (runner-lxc-quarkus, using act) fails to upload the
117MB native binary via actions/upload-artifact@v4 with exit code 1
after 3 minutes. Avoid the artifact transfer entirely by collapsing
build-native and docker-native into a single job: build native
binary, then build the Docker image directly from the working tree
in the same container.

The container has the binary at target/shot-crafter-calculator-1.0.0-runner
and the Dockerfile expects it at the same path, so the build
chain works without any artifact download/upload.

Push only happens on push to main (not on PRs).
2026-08-12 19:04:48 -04:00

84 lines
2.7 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/shot-crafter-calculator-1.0.0-runner
- name: Build & Push Docker image
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
set -e
echo "=== Build Docker image ==="
docker build -t shot-crafter-calculator:ci .
echo "=== Login to Gitea Registry ==="
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login gitea.danielarroyo.cl -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
echo "=== Tag ==="
docker tag shot-crafter-calculator:ci gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:latest
docker tag shot-crafter-calculator:ci gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:${GITHUB_SHA::7}
echo "=== Push ==="
docker push gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:latest
docker push gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:${GITHUB_SHA::7}
echo "=== Logout ==="
docker logout gitea.danielarroyo.cl