feat: add server-backed client tests and task client-test for Pytho…
#26
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 and Push Docker Image | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - "v*.*" | |
| - "v*.*.*" | |
| workflow_dispatch: | |
| inputs: | |
| image_tag: | |
| description: "Optional Docker tag to publish, for example v0.2" | |
| required: false | |
| type: string | |
| checkout_ref: | |
| description: "Optional git ref to build. Defaults to image_tag when image_tag is set." | |
| required: false | |
| type: string | |
| push_latest: | |
| description: "Also publish latest" | |
| required: false | |
| default: true | |
| type: boolean | |
| env: | |
| IMAGE_NAME: hangrylabs/kokorotts | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ inputs.checkout_ref || inputs.image_tag || github.ref }} | |
| - name: Free up disk space | |
| run: | | |
| echo "Initial disk usage:" | |
| df -h | |
| sudo rm -rf /usr/share/dotnet || true | |
| sudo rm -rf /opt/ghc || true | |
| sudo rm -rf /usr/local/lib/android || true | |
| sudo rm -rf /opt/hostedtoolcache || true | |
| docker system prune -af || true | |
| echo "Disk usage after cleanup:" | |
| df -h | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| run: echo "${{ secrets.DOCKER_TOKEN }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | |
| - name: Extract version if tag | |
| id: get_version | |
| run: | | |
| if [[ "$GITHUB_REF" == refs/tags/v* ]]; then | |
| echo "VERSION=${GITHUB_REF##refs/tags/}" >> $GITHUB_ENV | |
| elif [[ -n "${{ inputs.image_tag }}" ]]; then | |
| echo "VERSION=${{ inputs.image_tag }}" >> $GITHUB_ENV | |
| fi | |
| - name: Build Docker image | |
| run: | | |
| docker build -t $IMAGE_NAME:latest . | |
| if [[ -n "$VERSION" ]]; then | |
| docker tag $IMAGE_NAME:latest $IMAGE_NAME:$VERSION | |
| fi | |
| - name: Push Docker image | |
| run: | | |
| if [[ "${{ github.event_name }}" != "workflow_dispatch" || "${{ inputs.push_latest }}" == "true" ]]; then | |
| docker push $IMAGE_NAME:latest | |
| fi | |
| if [[ -n "$VERSION" ]]; then | |
| docker push $IMAGE_NAME:$VERSION | |
| fi | |