diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 6424451..9195e28 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -41,23 +41,59 @@ jobs: needs: frontend-lint if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/master' steps: - - uses: actions/checkout@v4 - - name: Build and push frontend with Kaniko - uses: aevea/action-kaniko@v0.9.0 + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + driver-opts: | + image=moby/buildkit:latest + + - name: Login to Container Registry + uses: docker/login-action@v3 with: registry: registry.bk.glpx.pro username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - image: turash/turash-frontend - tag: latest,${{ gitea.sha }} - cache: true - cache_registry: registry.bk.glpx.pro/turash/turash-frontend + + - name: Build and push frontend + uses: docker/build-push-action@v5 + with: context: bugulma/frontend - dockerfile: bugulma/frontend/Dockerfile - kaniko_executor_image: gcr.io/kaniko-project/executor:debug-v1.24.0 + file: bugulma/frontend/Dockerfile + push: true + tags: | + registry.bk.glpx.pro/turash/turash-frontend:latest + registry.bk.glpx.pro/turash/turash-frontend:${{ gitea.sha }} + cache-from: type=registry,ref=registry.bk.glpx.pro/turash/turash-frontend:buildcache + cache-to: type=registry,ref=registry.bk.glpx.pro/turash/turash-frontend:buildcache,mode=max + platforms: linux/amd64 + build-args: | + BUILDKIT_INLINE_CACHE=1 backend-lint: runs-on: ubuntu-latest + services: + postgres: + image: postgis/postgis:16-3.4 + env: + POSTGRES_USER: turash + POSTGRES_PASSWORD: turash123 + POSTGRES_DB: postgres + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 5432:5432 + env: + POSTGRES_HOST: localhost + POSTGRES_PORT: 5432 + POSTGRES_USER: turash + POSTGRES_PASSWORD: turash123 + POSTGRES_DB: postgres steps: - uses: actions/checkout@v4 - name: Set up Go @@ -158,6 +194,25 @@ jobs: CGO_ENABLED: 0 GOPROXY: https://proxy.golang.org,direct GOSUMDB: sum.golang.org + - name: Install PostgreSQL client + run: | + apt-get update -qq + DEBIAN_FRONTEND=noninteractive apt-get install -y -qq postgresql-client || true + continue-on-error: true + - name: Wait for PostgreSQL to be ready + run: | + echo "Waiting for PostgreSQL to be ready..." + for i in {1..30}; do + if pg_isready -h localhost -p 5432 -U turash 2>/dev/null || nc -z localhost 5432 2>/dev/null; then + echo "PostgreSQL is ready!" + exit 0 + fi + echo "PostgreSQL is unavailable - attempt $i/30" + sleep 2 + done + echo "PostgreSQL did not become ready in time" + exit 1 + continue-on-error: true - name: Test working-directory: bugulma/backend run: | @@ -183,20 +238,36 @@ jobs: needs: backend-lint if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/master' steps: - - uses: actions/checkout@v4 - - name: Build and push backend with Kaniko - uses: aevea/action-kaniko@v0.9.0 + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + driver-opts: | + image=moby/buildkit:latest + + - name: Login to Container Registry + uses: docker/login-action@v3 with: registry: registry.bk.glpx.pro username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - image: turash/turash-backend - tag: latest,${{ gitea.sha }} - cache: true - cache_registry: registry.bk.glpx.pro/turash/turash-backend + + - name: Build and push backend + uses: docker/build-push-action@v5 + with: context: bugulma/backend - dockerfile: bugulma/backend/Dockerfile - kaniko_executor_image: gcr.io/kaniko-project/executor:debug-v1.24.0 + file: bugulma/backend/Dockerfile + push: true + tags: | + registry.bk.glpx.pro/turash/turash-backend:latest + registry.bk.glpx.pro/turash/turash-backend:${{ gitea.sha }} + cache-from: type=registry,ref=registry.bk.glpx.pro/turash/turash-backend:buildcache + cache-to: type=registry,ref=registry.bk.glpx.pro/turash/turash-backend:buildcache,mode=max + platforms: linux/amd64 + build-args: | + BUILDKIT_INLINE_CACHE=1 e2e-test: runs-on: ubuntu-latest