name: CI/CD Pipeline on: push: branches: [master] jobs: build: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - name: Login to Docker Hub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Build Docker images run: | docker-compose -f docker-compose.yml build test: runs-on: ubuntu-latest needs: build services: docker: image: docker:19.03.12 options: --privileged ports: - 8000:8000 #- 8002:8000 - 9090:9090 - 3000:3000 #- 8080:8080 steps: - name: Checkout code uses: actions/checkout@v2 - name: Set up Docker Compose run: | docker-compose -f docker-compose.yml up -d - name: Run tests run: | docker-compose -f docker-compose.yml run tests push: runs-on: ubuntu-latest needs: test steps: - name: Checkout code uses: actions/checkout@v2 - name: Login to Docker Hub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Push Docker images run: | docker-compose -f docker-compose.yml push deploy: runs-on: ubuntu-latest needs: push steps: - uses: actions/checkout@v2 with: fetch-depth: 0 - name: Deploy to Hugging Face Spaces env: HF_TOKEN: ${{ secrets.HF_TOKEN }} run: git push --force https://macrdel:$HF_TOKEN@huggingface.co/spaces/macrdel/sentiment-summarize-youtube-comms master:main