From 4285ddb59dcc61a0bac0750391ff7c459b51ec3c Mon Sep 17 00:00:00 2001 From: Bruno Domingues Date: Thu, 2 Oct 2025 12:18:52 -0300 Subject: [PATCH] SIENTIAPDE-1243: Improve versioning logic in quality gate and optimize workflow This commit refactors the version calculation logic in the quality gate workflow to handle initial releases and improve accuracy. It also adds disk space cleanup to the workflow and uses --no-cache-dir when installing dependencies to prevent caching issues. --- .github/workflows/quality-gate.yml | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/.github/workflows/quality-gate.yml b/.github/workflows/quality-gate.yml index 997202a..4cb59fc 100644 --- a/.github/workflows/quality-gate.yml +++ b/.github/workflows/quality-gate.yml @@ -101,16 +101,20 @@ jobs: per_page: 1 }); - let lastReleaseVersion = '0.0.0'; + let lastReleaseVersion = null; + let newVersion = null; + if (releases.length > 0) { lastReleaseVersion = releases[0].tag_name.replace(/^v/, ''); console.log(`Latest release version: ${lastReleaseVersion}`); + // Calcular a nova versão baseada na última release + newVersion = calculateVersion(lastReleaseVersion, branchName); } else { - console.log('No releases found, using 0.0.0 as baseline'); + console.log('No releases found, starting from 0.0.0'); + lastReleaseVersion = 'N/A'; + // Primeira release: começar com 0.0.0 independente do tipo de branch + newVersion = '0.0.0'; } - - // Calcular a nova versão baseada no branch - const newVersion = calculateVersion(lastReleaseVersion, branchName); console.log(`Calculated version: ${newVersion}`); // Exportar a versão como output @@ -176,6 +180,18 @@ jobs: run: | git config --global url."https://oauth2:${GH_APP_TOKEN}@github.com/".insteadOf "https://github.com/" + - name: 🧹 Free Disk Space + run: | + echo "Disk space before cleanup:" + df -h + sudo rm -rf /usr/share/dotnet + sudo rm -rf /usr/local/lib/android + sudo rm -rf /opt/ghc + sudo rm -rf /opt/hostedtoolcache/CodeQL + sudo docker image prune --all --force + echo "Disk space after cleanup:" + df -h + - name: 🔧 Setup Python uses: actions/setup-python@v4 with: @@ -192,8 +208,8 @@ jobs: - name: 📦 Install Dependencies run: | python -m pip install --upgrade pip - pip install -r ${{ steps.prepare-requirements.outputs.PROCESSED_REQUIREMENTS_FILE }} - pip install -r requirements-dev.txt + pip install --no-cache-dir -r ${{ steps.prepare-requirements.outputs.PROCESSED_REQUIREMENTS_FILE }} + pip install --no-cache-dir -r requirements-dev.txt - name: 📝 Code Formatting Check (Ruff) run: |