fixed smoke test #10
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: Build, Test and Publish Docker image | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| jobs: | |
| smoke-and-publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python for smoke test | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install Python deps for smoke test | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install --no-cache-dir -r requirements.txt | |
| - name: Run smoke import test | |
| run: | | |
| python -c ' | |
| import sys | |
| try: | |
| import gradio, google, PIL | |
| except Exception as e: | |
| print("Smoke test failed:", e) | |
| sys.exit(1) | |
| print("Smoke test passed") | |
| ' | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: true | |
| tags: | | |
| ${{ secrets.DOCKER_USERNAME }}/car_classifier:latest | |
| ${{ secrets.DOCKER_USERNAME }}/car_classifier:${{ github.sha }} |