mirror of
https://github.com/DRYTRIX/TimeTracker.git
synced 2026-04-30 09:19:46 -05:00
ci: implement RC branch-based release workflow
Refactor GitHub Actions workflows to support a release candidate (RC) branch workflow instead of direct develop->main flow. Changes: - cd-development.yml: Trigger on PRs to RC branches (not push to develop) * Updated summary to show PR context (source/target branches) * Build development images when code is promoted to RC - cd-release.yml: Trigger on PRs from RC to main/master * Added path filters for code changes only * Enables release validation before merge to main - ci-comprehensive.yml: Run tests on PRs to RC branches * Full test suite now runs for PRs to main, master, and RC branches * Ensures code quality before RC promotion New workflow: develop (push) -> no actions develop -> rc (PR) -> run tests + development build rc -> main (PR) -> run tests + release build Supports both single RC branch (rc) and versioned RC branches (rc/*) Breaking change: Development builds no longer trigger on push to develop. They now require a PR to an RC branch.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
name: CD - Development Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ develop ]
|
||||
pull_request:
|
||||
branches: [ 'rc', 'rc/**' ]
|
||||
# Only trigger builds when actual code changes
|
||||
# This uses explicit paths to skip documentation, markdown, and other non-code changes
|
||||
paths:
|
||||
@@ -251,7 +251,8 @@ jobs:
|
||||
|
||||
**Version:** ${version}
|
||||
**Commit:** ${context.sha.substring(0, 7)}
|
||||
**Branch:** develop
|
||||
**PR:** #${{ github.event.pull_request.number }}
|
||||
**Target Branch:** ${{ github.base_ref }}
|
||||
**Build:** #${context.runNumber}
|
||||
|
||||
### Docker Image
|
||||
@@ -313,7 +314,8 @@ jobs:
|
||||
run: |
|
||||
echo "## 🚀 Development Build ${{ steps.status.outputs.status }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Branch:** develop" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Target Branch:** ${{ github.base_ref }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Source Branch:** ${{ github.head_ref }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Commit:** ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Build:** #${{ github.run_number }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Trigger:** ${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY
|
||||
@@ -340,5 +342,5 @@ jobs:
|
||||
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "---" >> $GITHUB_STEP_SUMMARY
|
||||
echo "💡 **Tip:** This workflow only runs for code changes. Documentation and test-only changes are skipped." >> $GITHUB_STEP_SUMMARY
|
||||
echo "💡 **Tip:** This workflow runs on PRs to RC branches. Documentation and test-only changes are skipped." >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
|
||||
@@ -9,12 +9,30 @@ name: CD - Release Build
|
||||
# - Tests can optionally be run via workflow_dispatch for manual releases
|
||||
#
|
||||
# Workflow is triggered by:
|
||||
# - Push to main/master (after PR merge)
|
||||
# - Pull request from RC branch to main/master
|
||||
# - Push to main/master (after PR merge from RC)
|
||||
# - Git tags (v*.*.*)
|
||||
# - Release events
|
||||
# - Manual workflow_dispatch
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ main, master ]
|
||||
# Only trigger from RC branches
|
||||
paths:
|
||||
- 'app/**'
|
||||
- 'migrations/**'
|
||||
- 'requirements*.txt'
|
||||
- 'setup.py'
|
||||
- 'Dockerfile'
|
||||
- 'docker-compose*.yml'
|
||||
- 'package*.json'
|
||||
- 'tailwind.config.js'
|
||||
- 'postcss.config.js'
|
||||
- '.github/workflows/cd-release.yml'
|
||||
- 'babel.cfg'
|
||||
- 'pytest.ini'
|
||||
- 'Makefile'
|
||||
push:
|
||||
branches: [ main, master ]
|
||||
tags: [ 'v*.*.*' ]
|
||||
|
||||
@@ -5,15 +5,19 @@ name: Comprehensive CI Pipeline
|
||||
# Test Strategy:
|
||||
# - Smoke tests (fast, critical) run first
|
||||
# - Unit, integration, security, and code quality tests run in parallel
|
||||
# - Full test suite with PostgreSQL runs for PRs to main/master
|
||||
# - Full test suite with PostgreSQL runs for PRs to main/master and RC branches
|
||||
# - Docker build test ensures the image builds correctly
|
||||
# - Test summary posted as PR comment
|
||||
#
|
||||
# All tests must pass before a PR can be merged to main
|
||||
# All tests must pass before a PR can be merged
|
||||
#
|
||||
# Workflow triggers:
|
||||
# - PRs to RC branches (from develop) - validates code before RC build
|
||||
# - PRs to main/master (from RC) - validates code before release
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ main, develop ]
|
||||
branches: [ main, master, 'rc', 'rc/**' ]
|
||||
|
||||
env:
|
||||
PYTHON_VERSION: '3.11'
|
||||
@@ -300,13 +304,13 @@ jobs:
|
||||
docker rm test-container
|
||||
|
||||
# ============================================================================
|
||||
# Full Test Suite (runs on all PRs to main/master)
|
||||
# Full Test Suite (runs on all PRs to main/master/rc)
|
||||
# ============================================================================
|
||||
full-test-suite:
|
||||
name: Full Test Suite with PostgreSQL
|
||||
runs-on: ubuntu-latest
|
||||
needs: [smoke-tests, unit-tests, integration-tests]
|
||||
if: github.event_name == 'pull_request' && (github.base_ref == 'main' || github.base_ref == 'master')
|
||||
if: github.event_name == 'pull_request' && (github.base_ref == 'main' || github.base_ref == 'master' || startsWith(github.base_ref, 'rc'))
|
||||
timeout-minutes: 30
|
||||
|
||||
services:
|
||||
|
||||
Reference in New Issue
Block a user