fix(ci): merge build-native and docker into one job to avoid 117MB artifact upload
CI / Build Native (push) Failing after 11m27s
CI / Build Native (push) Failing after 11m27s
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).
This commit is contained in:
+16
-47
@@ -63,52 +63,21 @@ jobs:
|
|||||||
|
|
||||||
- name: Verify native binary
|
- name: Verify native binary
|
||||||
run: |
|
run: |
|
||||||
ls -la target/
|
ls -la target/shot-crafter-calculator-1.0.0-runner
|
||||||
file target/shot-crafter-calculator-1.0.0-runner 2>/dev/null || echo "binary not found"
|
|
||||||
|
|
||||||
- name: Upload Native binary
|
- name: Build & Push Docker image
|
||||||
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'
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
steps:
|
run: |
|
||||||
- name: Checkout
|
set -e
|
||||||
uses: actions/checkout@v4
|
echo "=== Build Docker image ==="
|
||||||
|
docker build -t shot-crafter-calculator:ci .
|
||||||
- name: Download native binary
|
echo "=== Login to Gitea Registry ==="
|
||||||
uses: actions/download-artifact@v4
|
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login gitea.danielarroyo.cl -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
|
||||||
with:
|
echo "=== Tag ==="
|
||||||
name: shot-crafter-calculator-runner
|
docker tag shot-crafter-calculator:ci gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:latest
|
||||||
path: target/
|
docker tag shot-crafter-calculator:ci gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:${GITHUB_SHA::7}
|
||||||
|
echo "=== Push ==="
|
||||||
- name: Set up Docker Buildx
|
docker push gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:latest
|
||||||
uses: docker/setup-buildx-action@v3
|
docker push gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:${GITHUB_SHA::7}
|
||||||
|
echo "=== Logout ==="
|
||||||
- name: Login to Gitea Container Registry
|
docker logout gitea.danielarroyo.cl
|
||||||
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
|
|
||||||
|
|||||||
Reference in New Issue
Block a user