diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 471785a..6ec846e 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -65,17 +65,47 @@ jobs: with: go-version: '1.25.3' cache: true - - name: Verify CGO dependencies + - name: Install CGO dependencies run: | - # Check if gcc is available (usually pre-installed on Ubuntu runners) + set -e + echo "Checking for gcc..." + # Check if gcc is available if command -v gcc &> /dev/null; then - echo "gcc is already available" + 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..." + echo "gcc not found, installing build-essential..." + # Install build-essential which includes gcc + # Check if we're root (common in CI environments) + if [ "$(id -u)" -eq 0 ]; then + echo "Running as root, installing directly..." + apt-get update + DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential + else + echo "Not root, trying with sudo..." + sudo apt-get update || apt-get update + DEBIAN_FRONTEND=noninteractive sudo apt-get install -y build-essential || \ + DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential + fi + # Verify installation - check common locations + if command -v gcc &> /dev/null; then + echo "✓ gcc successfully installed" + gcc --version + elif [ -f /usr/bin/gcc ]; then + echo "✓ gcc found at /usr/bin/gcc" + /usr/bin/gcc --version + export PATH="/usr/bin:$PATH" + else + echo "✗ gcc installation verification failed" + echo "PATH: $PATH" + echo "Searching for gcc..." + find /usr -name gcc 2>/dev/null | head -5 || echo "gcc not found in /usr" + exit 1 + fi fi - continue-on-error: true + # Final verification + echo "Final gcc check:" + gcc --version || /usr/bin/gcc --version || (echo "ERROR: gcc still not found" && exit 1) - name: Install dependencies working-directory: bugulma/backend run: go mod download @@ -91,7 +121,7 @@ jobs: go mod verify env: GO111MODULE: on - CGO_ENABLED: 1 + CGO_ENABLED: 0 GOPROXY: https://proxy.golang.org,direct GOSUMDB: sum.golang.org - name: Verify module setup @@ -104,7 +134,7 @@ jobs: go list ./... env: GO111MODULE: on - CGO_ENABLED: 1 + CGO_ENABLED: 0 GOPROXY: https://proxy.golang.org,direct GOSUMDB: sum.golang.org - name: Build module to populate cache @@ -112,7 +142,7 @@ jobs: run: go build ./... env: GO111MODULE: on - CGO_ENABLED: 1 + CGO_ENABLED: 0 GOPROXY: https://proxy.golang.org,direct GOSUMDB: sum.golang.org - name: Vet @@ -120,7 +150,7 @@ jobs: run: go vet ./... env: GO111MODULE: on - CGO_ENABLED: 1 + CGO_ENABLED: 0 GOPROXY: https://proxy.golang.org,direct GOSUMDB: sum.golang.org - name: Test