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.
This commit is contained in:
Bruno Domingues
2025-10-02 12:18:52 -03:00
parent 9a1355fe9b
commit 4285ddb59d

View File

@@ -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: |