Update docker image tags #27
Workflow file for this run
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 ] | |
| workflow_dispatch: | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| ci: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 | |
| - name: Set up Python | |
| uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 | |
| with: | |
| python-version: '3.14.2' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 | |
| - name: Install dependencies | |
| run: uv sync --all-extras | |
| - name: Run linter | |
| run: make lint | |
| - name: Run tests | |
| run: make test-verbose | |
| docker-build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 | |
| - name: Build Docker image | |
| uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 | |
| with: | |
| context: . | |
| platforms: linux/amd64 | |
| push: false | |
| tags: ${{ env.IMAGE_NAME }}:test | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Build and load image for testing | |
| uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 | |
| with: | |
| context: . | |
| load: true | |
| tags: ${{ env.IMAGE_NAME }}:test | |
| cache-from: type=gha | |
| - name: Run Docker container | |
| run: | | |
| docker run -d \ | |
| --name pia-test \ | |
| -p 8000:8000 \ | |
| -e PIA_DEPENDENCY_TRACK_API_KEY=test-key \ | |
| -e PIA_projects_PATH=/app/projects.yaml \ | |
| -v $PWD/projects.yaml.example:/app/projects.yaml:ro \ | |
| ${{ env.IMAGE_NAME }}:test | |
| - name: Wait for container to be healthy | |
| run: | | |
| timeout 30 bash -c 'while ! curl -f http://localhost:8000/docs &>/dev/null; do sleep 1; done' | |
| - name: Test API response | |
| run: | | |
| response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8000/docs) | |
| if [ "$response" != "200" ]; then | |
| echo "API test failed with response code: $response" | |
| docker logs pia-test | |
| exit 1 | |
| fi | |
| echo "API test passed with response code: $response" | |
| - name: Clean up | |
| run: | | |
| docker stop pia-test || true | |
| docker rm pia-test || true |