name: CI/CD Pipeline on: push: branches: [ main, develop ] pull_request: branches: [ main ] jobs: test: runs-on: ubuntu-latest strategy: matrix: python-version: ['3.10', '3.11'] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install system dependencies run: | sudo apt-get update sudo apt-get install -y ffmpeg libsndfile1 - name: Install Python dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt pip install -r requirements-api.txt pip install pytest black flake8 - name: Lint with flake8 run: | flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Format check with black run: | black --check . - name: Run tests run: | pytest tests/ -v docker: runs-on: ubuntu-latest needs: test if: github.event_name == 'push' && github.ref == 'refs/heads/main' steps: - uses: actions/checkout@v3 - 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 uses: docker/build-push-action@v4 with: context: . push: true tags: ${{ secrets.DOCKER_USERNAME }}/whisper-german-asr:latest cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/whisper-german-asr:buildcache cache-to: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/whisper-german-asr:buildcache,mode=max