Add Task Service unit tests #320
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: PR Docker Build | |
| env: | |
| LABEL_NAME: build-image | |
| on: | |
| pull_request: | |
| types: [labeled, synchronize, opened, reopened] | |
| permissions: | |
| contents: write | |
| packages: write | |
| pull-requests: write | |
| id-token: write | |
| jobs: | |
| setup: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| label-name: ${{ steps.set-vars.outputs.label-name }} | |
| should-build: ${{ steps.check-label.outputs.should-build }} | |
| steps: | |
| - name: Set variables | |
| id: set-vars | |
| run: | | |
| echo "label-name=${{ env.LABEL_NAME }}" >> $GITHUB_OUTPUT | |
| - name: Check if should build | |
| id: check-label | |
| run: | | |
| if [[ "${{ contains(github.event.pull_request.labels.*.name, env.LABEL_NAME) }}" == "true" ]]; then | |
| echo "should-build=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "should-build=false" >> $GITHUB_OUTPUT | |
| fi | |
| print-label: | |
| needs: [setup] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Print PR labels | |
| run: | | |
| echo "PR Labels:" | |
| echo "${{ toJson(github.event.pull_request.labels) }}" | |
| echo "Checking for label: '${{ needs.setup.outputs.label-name }}'" | |
| check-and-build: | |
| needs: [setup] | |
| runs-on: ubuntu-latest | |
| if: needs.setup.outputs.should-build == 'true' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: "1.23" | |
| - name: Build | |
| run: go build -v ./... | |
| - name: Test | |
| run: go test -v ./... | |
| build-and-push: | |
| needs: [setup, check-and-build] | |
| if: needs.setup.outputs.should-build == 'true' | |
| uses: ./.github/workflows/docker-image.yaml | |
| secrets: inherit |