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