feat: moderate snake names, tournament text, and saved-game titles wi… #567
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 | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| rustfmt: | |
| uses: ./.github/workflows/rustfmt.yml | |
| clippy: | |
| uses: ./.github/workflows/clippy.yml | |
| rust-tests: | |
| uses: ./.github/workflows/rust-tests.yml | |
| e2e: | |
| uses: ./.github/workflows/e2e.yml | |
| docker-build: | |
| name: Docker Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Build Docker image | |
| run: docker build -t arena:${{ github.sha }} . | |
| - name: Save Docker image | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| run: docker save arena:${{ github.sha }} | zstd -o arena-image.tar.zst | |
| - name: Upload Docker image artifact | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: docker-image | |
| path: arena-image.tar.zst | |
| retention-days: 1 | |
| deploy: | |
| name: Deploy to Cloud Run | |
| needs: [rustfmt, clippy, rust-tests, e2e, docker-build] | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Download Docker image artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: docker-image | |
| - name: Load Docker image | |
| run: zstd -d arena-image.tar.zst -o arena-image.tar && docker load -i arena-image.tar | |
| - name: Authenticate to Google Cloud | |
| uses: google-github-actions/auth@v2 | |
| with: | |
| workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} | |
| service_account: ${{ secrets.GCP_SERVICE_ACCOUNT_EMAIL }} | |
| - name: Set up Cloud SDK | |
| uses: google-github-actions/setup-gcloud@v2 | |
| - name: Configure Docker for Artifact Registry | |
| run: gcloud auth configure-docker ${{ secrets.GCP_REGION }}-docker.pkg.dev --quiet | |
| - name: Tag and push Docker image | |
| run: | | |
| docker tag arena:${{ github.sha }} ${{ secrets.GCP_REGION }}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_ARTIFACT_REGISTRY }}/arena:${{ github.sha }} | |
| docker tag arena:${{ github.sha }} ${{ secrets.GCP_REGION }}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_ARTIFACT_REGISTRY }}/arena:latest | |
| docker push ${{ secrets.GCP_REGION }}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_ARTIFACT_REGISTRY }}/arena:${{ github.sha }} | |
| docker push ${{ secrets.GCP_REGION }}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_ARTIFACT_REGISTRY }}/arena:latest | |
| - name: Deploy to Cloud Run | |
| env: | |
| EYES_ORG_ID: ${{ secrets.EYES_ORG_ID }} | |
| EYES_APP_ID: ${{ secrets.EYES_APP_ID }} | |
| run: | | |
| # Eyes telemetry is keyed by these two UUIDs. They live in repo | |
| # secrets rather than this file because the Eyes ingest endpoint is | |
| # unauthenticated -- the (org, app) pair is what authorizes writes, | |
| # and this repo is public. | |
| # | |
| # --update-env-vars *merges*; --set-env-vars would wipe DATABASE_URL, | |
| # GCP_LOGGING and friends off the service. | |
| update_env_vars="BASE_URL=https://arena.battlesnake.com,EYES_TRANSPORT=batching" | |
| if [ -n "$EYES_ORG_ID" ] && [ -n "$EYES_APP_ID" ]; then | |
| update_env_vars="$update_env_vars,EYES_ORG_ID=$EYES_ORG_ID,EYES_APP_ID=$EYES_APP_ID" | |
| else | |
| echo "::warning::EYES_ORG_ID/EYES_APP_ID not set -- deploying without Eyes telemetry" | |
| fi | |
| gcloud run services update ${{ secrets.GCP_CLOUD_RUN_SERVICE }} \ | |
| --region ${{ secrets.GCP_REGION }} \ | |
| --image ${{ secrets.GCP_REGION }}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_ARTIFACT_REGISTRY }}/arena:${{ github.sha }} \ | |
| --update-env-vars "$update_env_vars" |