Fix Gitea CI stuck at setup-dotnet/setup-node due to blocked CDNs

Root cause: actions/setup-dotnet@v4 downloads .NET from
download.visualstudio.microsoft.com and actions/setup-node@v4 downloads
Node from nodejs.org — both CDNs are blocked from Iran so jobs hang at 0s.

Fix:
- All .NET jobs: add container: mcr.microsoft.com/dotnet/sdk:10.0
  so .NET is already inside the image — no download needed.
  Remove actions/setup-dotnet step entirely.
- All Node.js jobs: add container: node:20-alpine
  so Node/npm are already inside the image — no download needed.
  Remove actions/setup-node step entirely.
- api-build: add postgres + redis service containers + env vars so
  dotnet test can actually connect to a database (was silently failing).
- deploy job: change back to runs-on: self-hosted
  ubuntu-latest containers don't have Docker CLI — docker compose
  commands would fail immediately. Deploy MUST run on the server.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-05-28 11:08:42 +03:30
parent 8f81a62ec9
commit dcddcf77d6
+40 -24
View File
@@ -13,6 +13,7 @@ concurrency:
# ───────────────────────────────────────────────────────────────────────────── # ─────────────────────────────────────────────────────────────────────────────
# CI — runs on every push AND every PR # CI — runs on every push AND every PR
# Uses pre-built container images so nothing is downloaded from blocked CDNs.
# ───────────────────────────────────────────────────────────────────────────── # ─────────────────────────────────────────────────────────────────────────────
jobs: jobs:
@@ -20,14 +21,31 @@ jobs:
api-build: api-build:
name: "CI · API (dotnet build + test)" name: "CI · API (dotnet build + test)"
runs-on: ubuntu-latest runs-on: ubuntu-latest
# Use official .NET SDK image — no setup-dotnet download needed
container:
image: mcr.microsoft.com/dotnet/sdk:10.0
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_DB: meezi_test
POSTGRES_USER: meezi
POSTGRES_PASSWORD: meezi_test_pass
options: >-
--health-cmd pg_isready
--health-interval 5s
--health-timeout 5s
--health-retries 10
redis:
image: redis:7-alpine
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 3s
--health-retries 10
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Setup .NET 10
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.x"
- name: Restore - name: Restore
run: dotnet restore src/Meezi.API/Meezi.API.csproj run: dotnet restore src/Meezi.API/Meezi.API.csproj
@@ -36,19 +54,19 @@ jobs:
- name: Test - name: Test
run: dotnet test --no-build -c Release --logger "console;verbosity=minimal" run: dotnet test --no-build -c Release --logger "console;verbosity=minimal"
env:
ConnectionStrings__DefaultConnection: "Host=postgres;Port=5432;Database=meezi_test;Username=meezi;Password=meezi_test_pass"
ConnectionStrings__Redis: "redis:6379"
# ── Admin API ─────────────────────────────────────────────────────────────── # ── Admin API ───────────────────────────────────────────────────────────────
admin-api-build: admin-api-build:
name: "CI · Admin API (dotnet build)" name: "CI · Admin API (dotnet build)"
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/dotnet/sdk:10.0
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Setup .NET 10
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.x"
- name: Restore - name: Restore
run: dotnet restore src/Meezi.Admin.API/Meezi.Admin.API.csproj run: dotnet restore src/Meezi.Admin.API/Meezi.Admin.API.csproj
@@ -59,14 +77,13 @@ jobs:
dashboard-check: dashboard-check:
name: "CI · Dashboard (tsc)" name: "CI · Dashboard (tsc)"
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: node:20-alpine
defaults: defaults:
run: run:
working-directory: web/dashboard working-directory: web/dashboard
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- run: npm install --legacy-peer-deps --ignore-scripts - run: npm install --legacy-peer-deps --ignore-scripts
- run: npx tsc --noEmit - run: npx tsc --noEmit
env: env:
@@ -76,14 +93,13 @@ jobs:
admin-web-check: admin-web-check:
name: "CI · Admin Web (tsc)" name: "CI · Admin Web (tsc)"
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: node:20-alpine
defaults: defaults:
run: run:
working-directory: web/admin working-directory: web/admin
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- run: npm install --legacy-peer-deps --ignore-scripts - run: npm install --legacy-peer-deps --ignore-scripts
- run: npx tsc --noEmit - run: npx tsc --noEmit
env: env:
@@ -93,14 +109,13 @@ jobs:
website-check: website-check:
name: "CI · Website (tsc)" name: "CI · Website (tsc)"
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: node:20-alpine
defaults: defaults:
run: run:
working-directory: web/website working-directory: web/website
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- run: npm install --legacy-peer-deps --ignore-scripts - run: npm install --legacy-peer-deps --ignore-scripts
- run: npx tsc --noEmit - run: npx tsc --noEmit
env: env:
@@ -110,25 +125,26 @@ jobs:
finder-check: finder-check:
name: "CI · Finder (tsc)" name: "CI · Finder (tsc)"
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: node:20-alpine
defaults: defaults:
run: run:
working-directory: web/finder working-directory: web/finder
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- run: npm install --legacy-peer-deps --ignore-scripts - run: npm install --legacy-peer-deps --ignore-scripts
- run: npx tsc --noEmit - run: npx tsc --noEmit
env: env:
NEXT_PUBLIC_API_URL: http://localhost:5080 NEXT_PUBLIC_API_URL: http://localhost:5080
# ───────────────────────────────────────────────────────────────────────────── # ─────────────────────────────────────────────────────────────────────────────
# DEPLOY — only on push to main, only if ALL CI jobs pass # DEPLOY — only on push to main, only if ALL CI jobs pass.
# MUST run on self-hosted: needs Docker CLI on the actual production server.
# ubuntu-latest containers do not have Docker inside them.
# ───────────────────────────────────────────────────────────────────────────── # ─────────────────────────────────────────────────────────────────────────────
deploy: deploy:
name: "Deploy · all services" name: "Deploy · all services"
runs-on: ubuntu-latest runs-on: self-hosted
needs: needs:
- api-build - api-build
- admin-api-build - admin-api-build