build(deps): bump typed.js from 2.1.0 to 3.0.0 #506
Workflow file for this run
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: Quantum Infrastructure CI/CD | ||
| on: | ||
| push: | ||
| branches: [ main, develop, 'feature/*' ] | ||
| paths: | ||
| - 'src/**' | ||
| - 'deploy/**' | ||
| - 'tests/**' | ||
| - 'pyproject.toml' | ||
| - 'requirements*.txt' | ||
| pull_request: | ||
| branches: [ main, develop ] | ||
| env: | ||
| DOCKER_IMAGE: ghcr.io/${{ github.repository }}/quantum-node | ||
| HELM_VERSION: 3.14.0 | ||
| KUBE_VERSION: 1.28.0 | ||
| PYTHON_VERSION: '3.10' | ||
| DOCKER_BUILDKIT: 1 | ||
| jobs: | ||
| test: | ||
| name: Run Tests | ||
| runs-on: ubuntu-latest | ||
| services: | ||
| # Add any required services like Redis, PostgreSQL, etc. | ||
| redis: | ||
| image: redis:7 | ||
| ports: | ||
| - 6379:6379 | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Python ${{ env.PYTHON_VERSION }} | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: ${{ env.PYTHON_VERSION }} | ||
| cache: 'pip' | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r requirements-dev.txt | ||
| pip install pytest pytest-cov pytest-asyncio | ||
| - name: Run unit tests | ||
| run: | | ||
| pytest tests/unit/ --cov=src --cov-report=xml --cov-report=term | ||
| - name: Run integration tests | ||
| run: | | ||
| pytest tests/integration/ -v | ||
| - name: Upload coverage to Codecov | ||
| uses: codecov/codecov-action@v3 | ||
| with: | ||
| file: ./coverage.xml | ||
| fail_ci_if_error: false | ||
| build: | ||
| name: Build and Push Docker Image | ||
| needs: test | ||
| runs-on: ubuntu-latest | ||
| if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v2 | ||
| - name: Log in to GitHub Container Registry | ||
| uses: docker/login-action@v2 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Extract metadata (tags, labels) for Docker | ||
| id: meta | ||
| uses: docker/metadata-action@v4 | ||
| with: | ||
| images: ${{ env.DOCKER_IMAGE }} | ||
| tags: | | ||
| type=sha,format=long | ||
| type=ref,event=branch | ||
| type=ref,event=pr | ||
| type=semver,pattern={{version}} | ||
| type=semver,pattern={{major}}.{{minor}} | ||
| type=sha,prefix=sha- | ||
| - name: Build and push Docker image | ||
| uses: docker/build-push-action@v4 | ||
| with: | ||
| context: . | ||
| push: ${{ github.event_name != 'pull_request' }} | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
| build-args: | | ||
| PYTHON_VERSION=${{ env.PYTHON_VERSION }} | ||
| deploy-staging: | ||
| name: Deploy to Staging | ||
| needs: build | ||
| if: github.ref == 'refs/heads/develop' | ||
| runs-on: ubuntu-latest | ||
| environment: staging | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Helm | ||
| uses: azure/setup-helm@v3 | ||
| with: | ||
| version: ${{ env.HELM_VERSION }} | ||
| - name: Set up kubectl | ||
| uses: azure/setup-kubectl@v3 | ||
| with: | ||
| version: ${{ env.KUBE_VERSION }} | ||
| - name: Configure AWS Credentials | ||
| if: env.AWS_ACCESS_KEY_ID == '' | ||
| uses: aws-actions/configure-aws-credentials@v2 | ||
| with: | ||
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| aws-region: ${{ secrets.AWS_REGION }} | ||
| - name: Configure kubeconfig | ||
| run: | | ||
| aws eks --region ${{ secrets.AWS_REGION }} update-kubeconfig \ | ||
| --name ${{ secrets.EKS_CLUSTER_NAME }} | ||
| - name: Deploy to Kubernetes | ||
| run: | | ||
| helm upgrade --install quantum-node ./deploy/helm/quantum-infra-zero \ | ||
| --namespace staging \ | ||
| --create-namespace \ | ||
| --values ./deploy/helm/quantum-infra-zero/values-staging.yaml \ | ||
| --set image.tag=${{ github.sha }} \ | ||
| --atomic \ | ||
| --timeout 5m \ | ||
| --wait | ||
| - name: Run smoke tests | ||
| run: | | ||
| # Add smoke tests here | ||
| echo "Running smoke tests..." | ||
| # Example: curl -sSf http://quantum-node.staging.svc.cluster.local:8000/health | ||
| deploy-production: | ||
| name: Deploy to Production | ||
| needs: deploy-staging | ||
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | ||
| runs-on: ubuntu-latest | ||
| environment: production | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Helm | ||
| uses: azure/setup-helm@v3 | ||
| with: | ||
| version: ${{ env.HELM_VERSION }} | ||
| - name: Set up kubectl | ||
| uses: azure/setup-kubectl@v3 | ||
| with: | ||
| version: ${{ env.KUBE_VERSION }} | ||
| - name: Configure AWS Credentials | ||
| uses: aws-actions/configure-aws-credentials@v2 | ||
| with: | ||
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| aws-region: ${{ secrets.AWS_REGION }} | ||
| - name: Configure kubeconfig | ||
| run: | | ||
| aws eks --region ${{ secrets.AWS_REGION }} update-kubeconfig \ | ||
| --name ${{ secrets.EKS_CLUSTER_NAME }} | ||
| - name: Deploy to Kubernetes | ||
| run: | | ||
| # Get the current production image tag | ||
| CURRENT_TAG=$(helm get values -n production quantum-node -o json | jq -r '.image.tag // empty') | ||
| # Deploy with canary strategy | ||
| helm upgrade --install quantum-node ./deploy/helm/quantum-infra-zero \ | ||
| --namespace production \ | ||
| --create-namespace \ | ||
| --values ./deploy/helm/quantum-infra-zero/values-production.yaml \ | ||
| --set image.tag=${{ github.sha }} \ | ||
| --set replicaCount=1 \ | ||
| --atomic \ | ||
| --timeout 5m \ | ||
| --wait | ||
| # Run canary tests | ||
| echo "Running canary tests..." | ||
| # Example: run tests against the new deployment | ||
| # If tests pass, scale up | ||
| kubectl scale deployment quantum-node -n production --replicas=3 | ||
| # Optionally, rollback if tests fail | ||
| # if [ $? -ne 0 ]; then | ||
| # echo "Canary tests failed, rolling back..." | ||
| # helm rollback quantum-node -n production | ||
| # exit 1 | ||
| # fi | ||
| - name: Notify Slack | ||
| if: always() | ||
| uses: rtCamp/action-slack-notify@v2.2.0 | ||
| env: | ||
| SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
| SLACK_COLOR: ${{ job.status == 'success' && '#36a64f' || '#ff0000' }} | ||
| SLACK_TITLE: 'Deployment to Production ${{ job.status == 'success' && '✅ Succeeded' || '❌ Failed' }}' | ||
| SLACK_MESSAGE: "Quantum Infrastructure deployment to production ${{ job.status == 'success' && 'completed successfully' || 'failed' }}.\nCommit: ${{ github.sha }}\nRun: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
| SLACK_USERNAME: GitHub Actions | ||
| MSG_MINIMAL: true | ||