From ed992e4c94a8d83bda17e0181254283f625adb09 Mon Sep 17 00:00:00 2001 From: andersonid Date: Thu, 25 Sep 2025 17:40:26 -0300 Subject: [PATCH] Optimize GitHub Actions workflow - Remove heavy Python dependencies installation from CI - Add basic syntax check instead of full dependency install - Optimize Podman installation with quiet flags - Add build cache with --layers flag - Add 30-minute timeout to prevent hanging - Use single build with tag instead of double build - Improve overall workflow performance --- .github/workflows/openshift-deploy.yml | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/openshift-deploy.yml b/.github/workflows/openshift-deploy.yml index 664ae30..e161ae1 100644 --- a/.github/workflows/openshift-deploy.yml +++ b/.github/workflows/openshift-deploy.yml @@ -15,6 +15,7 @@ env: jobs: build-and-deploy: runs-on: ubuntu-latest + timeout-minutes: 30 steps: - name: Checkout code @@ -25,19 +26,15 @@ jobs: with: python-version: '3.11' - - name: Install dependencies + - name: Run basic syntax check run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - - - name: Run tests - run: | - python -c "import app.main; print('✅ App imports successfully')" + python -m py_compile app/main.py + echo "✅ Syntax check passed" - name: Set up Podman run: | - sudo apt-get update - sudo apt-get install -y podman buildah skopeo + sudo apt-get update -qq + sudo apt-get install -y -qq podman buildah skopeo - name: Login to Docker Hub run: | @@ -45,9 +42,11 @@ jobs: - name: Build and push image with Podman run: | - # Build da imagem - podman build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} . - podman build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest . + # Build da imagem com cache + podman build --layers -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} . + + # Tag como latest + podman tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest # Push das imagens podman push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}