fix: ci tests #28
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: [master] | |
| pull_request: | |
| branches: [master] | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| test: | |
| 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: Log in to GHCR | |
| # run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin | |
| # - name: Build container | |
| # run: | | |
| # IMAGE_NAME=ghcr.io/query-farm/python-airport-test-server | |
| # docker build -t $IMAGE_NAME:latest . | |
| # - name: Start server container | |
| # run: | | |
| # IMAGE_NAME=ghcr.io/query-farm/python-airport-test-server | |
| # docker run -d --name airport_test_server -p 50003:50003 $IMAGE_NAME:latest | |
| # - name: Stop server | |
| # run: | | |
| # docker stop airport_test_server | |
| # - name: Push Docker image to GHCR | |
| # run: | | |
| # IMAGE_NAME=ghcr.io/query-farm/python-airport-test-server | |
| # docker push $IMAGE_NAME:latest | |
| # Build Linux images on ubuntu runner | |
| build-linux: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: 'read' | |
| id-token: 'write' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - 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 }} | |
| - name: Show complete auth info | |
| run: | | |
| echo "=== Authentication Status ===" | |
| gcloud auth list | |
| echo "" | |
| echo "=== Current Configuration ===" | |
| gcloud config list | |
| echo "" | |
| echo "=== Active Account ===" | |
| gcloud auth list --filter=status:ACTIVE --format="value(account)" | |
| - name: Set up Docker to use gcloud as a credential helper | |
| run: | | |
| gcloud auth configure-docker us-east1-docker.pkg.dev | |
| - uses: RafikFarhad/push-to-gcr-github-action@v5-rc1 | |
| with: | |
| registry: gcr.io | |
| project_id: airport-ci-service | |
| image_name: backend | |
| image_tag: latest,v1 | |
| dockerfile: ./Dockerfile | |