Skip to content

Commit ee77d8b

Browse files
committed
fix: add ci
1 parent 8fe0904 commit ee77d8b

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

.github/workflows/ci.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
id-token: write
12+
13+
jobs:
14+
test:
15+
permissions:
16+
contents: 'read'
17+
id-token: 'write'
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Install the latest version of rye
24+
uses: eifinger/setup-rye@v4
25+
26+
- name: Add Python to PATH
27+
run: echo "$(rye show python-path | head -n 1 | xargs dirname | xargs dirname)/bin" >> $GITHUB_PATH
28+
29+
- name: Cache Rye
30+
uses: actions/cache@v4
31+
with:
32+
path: |
33+
~/.cache/rye
34+
~/.rye
35+
key: ${{ runner.os }}-rye-${{ hashFiles('**/pyproject.toml', '**/pyproject.lock') }}
36+
restore-keys: |
37+
${{ runner.os }}-rye-
38+
39+
- name: Sync dependencies
40+
run: rye sync
41+
42+
- name: Lint & Format (Ruff)
43+
run: rye run ruff check .
44+
45+
- name: Authenticate to Google Cloud
46+
uses: google-github-actions/auth@v2
47+
with:
48+
project_id: ${{ secrets.GOOGLE_PROJECT_ID }}
49+
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
50+
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
51+
52+
- name: Set up Docker to use gcloud as a credential helper
53+
run: |
54+
gcloud auth configure-docker us-east1-docker.pkg.dev
55+
56+
- name: Build docker image
57+
run: |
58+
IMAGE_NAME="us-east1-docker.pkg.dev/airport-ci-service/airport-ci-service/python-airport-hello-world-server"
59+
rye build --wheel --clean
60+
docker build -t $IMAGE_NAME:latest -t $IMAGE_NAME:${{ github.sha }} .
61+
docker push $IMAGE_NAME:latest
62+
docker push $IMAGE_NAME:${{ github.sha }}
63+
64+

0 commit comments

Comments
 (0)