updated some data and speed #2
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: Test and Deploy | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| SUPABASE_URL: ${{ secrets.SUPABASE_URL }} | |
| SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }} | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Run tests | |
| run: | | |
| pytest tests/ -v --cov=hackflow --cov-report=xml | |
| - name: Upload coverage | |
| if: github.event_name == 'pull_request' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage | |
| path: coverage.xml | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: github.event_name == 'push' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Configure Docker | |
| run: echo '${{ secrets.GCP_SA_KEY }}' | gcloud auth activate-service-account --key-file=- | |
| - name: Build and push | |
| env: | |
| IMAGE: gcr.io/${{ secrets.GCP_PROJECT }}/hackflow:${{ github.sha }} | |
| run: | | |
| gcloud builds submit --tag=$IMAGE --substitutions=SHORT_SHA=${{ github.sha }} | |
| - name: Deploy to Cloud Run | |
| env: | |
| IMAGE: gcr.io/${{ secrets.GCP_PROJECT }}/hackflow:${{ github.sha }} | |
| run: | | |
| gcloud run deploy hackflow \ | |
| --image=$IMAGE \ | |
| --platform=managed \ | |
| --region=${{ secrets.CLOUD_RUN_REGION }} \ | |
| --allow-unauthenticated \ | |
| --service-account=hackflow@${{ secrets.GCP_PROJECT }}.iam.gserviceaccount.com |