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: 5G AI Professional CI/CD | |
| # Trigger conditions: Execute on pushes and pull requests to main/master branches | |
| on: | |
| push: | |
| branches: ["main", "master"] | |
| pull_request: | |
| branches: ["main", "master"] | |
| # Pipeline jobs: Build, test, and validate Docker container | |
| jobs: | |
| build-and-test: | |
| name: Build & Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Step 1: Checkout source code from repository | |
| - name: Checkout Code | |
| uses: actions/checkout@v3 | |
| # Step 2: Configure Python environment | |
| - name: Set up Python 3.9 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.9" | |
| # Step 3: Install project dependencies with pip caching for faster builds | |
| - name: Install Dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| # Step 4: Execute unit test suite | |
| - name: Run Unit Tests | |
| run: | | |
| python -m unittest discover tests | |
| docker-validation: | |
| name: Docker Build Check | |
| needs: build-and-test # Execute only if build-and-test job succeeds | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v3 | |
| # Step 5: Build Docker container to validate production deployment | |
| - name: Build Docker Image | |
| run: docker build . --file Dockerfile --tag 5g-forecaster:latest |