Skip to content

Commit 06a94e0

Browse files
Acquartsclaude
andcommitted
ci(gaming-assistant): add CI/CD workflows to repo root
GitHub Actions only runs workflows from .github/workflows/ at the repo root. Moved and adapted workflows with path filters so they only trigger on changes to ai-gaming-assistant-agent/. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent a01cfde commit 06a94e0

2 files changed

Lines changed: 134 additions & 0 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: "Gaming Assistant: CI"
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "ai-gaming-assistant-agent/**"
8+
pull_request:
9+
branches: [main]
10+
paths:
11+
- "ai-gaming-assistant-agent/**"
12+
13+
defaults:
14+
run:
15+
working-directory: ai-gaming-assistant-agent
16+
17+
jobs:
18+
lint-and-test:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: "3.11"
29+
cache: "pip"
30+
cache-dependency-path: ai-gaming-assistant-agent/requirements*.txt
31+
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install -r requirements-dev.txt
36+
37+
- name: Lint with ruff
38+
run: |
39+
ruff check .
40+
ruff format --check .
41+
42+
- name: Run tests
43+
env:
44+
GOOGLE_GENAI_USE_VERTEXAI: "False"
45+
run: |
46+
pytest tests/ -v
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: "Gaming Assistant: Deploy to Cloud Run"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "ai-gaming-assistant-agent/**"
9+
workflow_dispatch:
10+
11+
env:
12+
PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
13+
GAR_LOCATION: us-central1
14+
REPOSITORY: videogames-assistant-repo
15+
SERVICE: videogames-assistant
16+
REGION: us-central1
17+
18+
defaults:
19+
run:
20+
working-directory: ai-gaming-assistant-agent
21+
22+
jobs:
23+
deploy:
24+
runs-on: ubuntu-latest
25+
26+
permissions:
27+
contents: read
28+
id-token: write
29+
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@v4
33+
34+
- name: Google Auth
35+
id: auth
36+
uses: google-github-actions/auth@v2
37+
with:
38+
token_format: "access_token"
39+
workload_identity_provider: ${{ secrets.WIF_PROVIDER }}
40+
service_account: ${{ secrets.WIF_SERVICE_ACCOUNT }}
41+
42+
- name: Docker Auth to Artifact Registry
43+
uses: docker/login-action@v3
44+
with:
45+
registry: ${{ env.GAR_LOCATION }}-docker.pkg.dev
46+
username: oauth2accesstoken
47+
password: ${{ steps.auth.outputs.access_token }}
48+
49+
- name: Build Docker image
50+
run: |
51+
docker build \
52+
-t "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:${{ github.sha }}" \
53+
-t "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:latest" \
54+
.
55+
56+
- name: Push Docker image
57+
run: |
58+
docker push "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:${{ github.sha }}"
59+
docker push "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:latest"
60+
61+
- name: Deploy to Cloud Run
62+
id: deploy
63+
uses: google-github-actions/deploy-cloudrun@v2
64+
with:
65+
service: ${{ env.SERVICE }}
66+
region: ${{ env.REGION }}
67+
image: "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:${{ github.sha }}"
68+
flags: |
69+
--allow-unauthenticated
70+
--memory=1Gi
71+
--cpu=1
72+
--min-instances=0
73+
--max-instances=10
74+
--timeout=300s
75+
env_vars: |
76+
GOOGLE_CLOUD_PROJECT=${{ env.PROJECT_ID }}
77+
GOOGLE_CLOUD_LOCATION=${{ env.REGION }}
78+
GOOGLE_GENAI_USE_VERTEXAI=True
79+
SERVE_WEB_INTERFACE=true
80+
secrets: |
81+
ARIZE_API_KEY=ARIZE_API_KEY:latest
82+
ARIZE_SPACE_ID=ARIZE_SPACE_ID:latest
83+
84+
- name: Output URL
85+
run: |
86+
echo "## Deployment Successful! :rocket:" >> $GITHUB_STEP_SUMMARY
87+
echo "" >> $GITHUB_STEP_SUMMARY
88+
echo "**Service URL:** ${{ steps.deploy.outputs.url }}" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)