SRS initial commit #49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI/CD Pipeline | |
| on: | |
| push: | |
| branches: [ '**' ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| env: | |
| PYTHON_VERSION: '3.9' | |
| jobs: | |
| setup: | |
| name: Setup Virtual Environment | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 1 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Create virtual environment | |
| run: | | |
| echo "Standing up venv for tests..." | |
| make venv | |
| - name: Archive venv (preserve structure) | |
| run: | | |
| tar -czf venv.tar.gz venv/pat_dev_vm | |
| ls -lh venv.tar.gz | |
| - name: Upload venv artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: venv-tar | |
| path: venv.tar.gz | |
| retention-days: 1 | |
| version-canary: | |
| name: Version Canary Check | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| if: github.ref != 'refs/heads/develop' && github.ref != 'refs/heads/main' | |
| steps: | |
| - name: Checkout (needed before using local action) | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 1 | |
| - name: Prepare env | |
| uses: ./.github/actions/use-venv | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| venv-artifact-name: 'venv-tar' | |
| - name: Run version canary | |
| run: | | |
| echo "Running version canary..." | |
| make version_canary | |
| unit-tests: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| if: github.ref != 'refs/heads/develop' && github.ref != 'refs/heads/main' | |
| steps: | |
| - name: Checkout (needed before using local action) | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 1 | |
| - name: Prepare env | |
| uses: ./.github/actions/use-venv | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| venv-artifact-name: 'venv-tar' | |
| - name: Run unit tests | |
| run: | | |
| echo "Running unit tests..." | |
| make test | |
| # Summary job that depends on all other jobs | |
| ci-complete: | |
| name: CI Pipeline Complete | |
| runs-on: ubuntu-latest | |
| needs: [setup, version-canary, unit-tests] | |
| if: always() | |
| steps: | |
| - name: Check all jobs status | |
| run: | | |
| echo "Setup: ${{ needs.setup.result }}" | |
| echo "Version Canary: ${{ needs.version-canary.result }}" | |
| echo "Unit Tests: ${{ needs.unit-tests.result }}" | |
| if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]]; then | |
| echo "One or more jobs failed" | |
| exit 1 | |
| else | |
| echo "All applicable jobs completed successfully" | |
| fi |