From 1f3ec085cd70301faaecb5ed66b135d5021fce08 Mon Sep 17 00:00:00 2001 From: Damir Mukimov Date: Fri, 26 Dec 2025 13:23:17 +0100 Subject: [PATCH] Refactor CI workflow to verify and install CGO dependencies - Change step name to "Verify CGO dependencies" and implement a check for GCC availability - Update environment variables to ensure CGO is enabled during Go module operations - Allow the installation of GCC to continue on error for improved resilience --- .gitea/workflows/ci.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index fcf63d8..471785a 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -65,15 +65,23 @@ jobs: with: go-version: '1.25.3' cache: true - - name: Install CGO dependencies + - name: Verify CGO dependencies run: | - sudo apt-get update - sudo apt-get install -y gcc + # Check if gcc is available (usually pre-installed on Ubuntu runners) + if command -v gcc &> /dev/null; then + echo "gcc is already available" + gcc --version + else + echo "gcc not found, attempting to install..." + apt-get update && apt-get install -y gcc || echo "gcc installation failed, but continuing..." + fi + continue-on-error: true - name: Install dependencies working-directory: bugulma/backend run: go mod download env: GO111MODULE: on + CGO_ENABLED: 1 GOPROXY: https://proxy.golang.org,direct GOSUMDB: sum.golang.org - name: Tidy and verify modules @@ -83,6 +91,7 @@ jobs: go mod verify env: GO111MODULE: on + CGO_ENABLED: 1 GOPROXY: https://proxy.golang.org,direct GOSUMDB: sum.golang.org - name: Verify module setup @@ -95,6 +104,7 @@ jobs: go list ./... env: GO111MODULE: on + CGO_ENABLED: 1 GOPROXY: https://proxy.golang.org,direct GOSUMDB: sum.golang.org - name: Build module to populate cache @@ -102,6 +112,7 @@ jobs: run: go build ./... env: GO111MODULE: on + CGO_ENABLED: 1 GOPROXY: https://proxy.golang.org,direct GOSUMDB: sum.golang.org - name: Vet @@ -109,6 +120,7 @@ jobs: run: go vet ./... env: GO111MODULE: on + CGO_ENABLED: 1 GOPROXY: https://proxy.golang.org,direct GOSUMDB: sum.golang.org - name: Test