name: clustertool-go-tests on: workflow_dispatch: workflow_call: push: branches: - main tags: - "*" paths: - 'main.go' - 'go.mod' - 'go.sum' - 'pkg/**' - 'cmd/**' - 'clustertool/**' - ".github/workflows/clustertool.test.yaml" #pull_request: # branches: # - main # paths: # - 'main.go' # - 'go.mod' # - 'go.sum' # - 'pkg/**' # - 'cmd/**' # - 'clustertool/**' # - ".github/workflows/clsutertool.test.yaml" permissions: contents: read jobs: check_changes: runs-on: ubuntu-latest outputs: changes_detected: ${{ steps.filter.outputs.changed }} steps: - name: Checkout code uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 - name: Filter paths id: filter uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3 with: list-files: json filters: | changed: - 'clustertool/**' build: runs-on: actions-runners if: needs.check_changes.outputs.changes_detected == 'true' steps: - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6 with: go-version: stable - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 - run: | cd ./clustertool go build -o /usr/local/bin/clustertool go test -v ./... -race -covermode=atomic clustertool-dev