Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b1c4de3
Run tool to determine which test to run
pietern Nov 27, 2025
352c618
.
pietern Nov 27, 2025
c2af5e1
Revert Makefile changes
pietern Nov 27, 2025
647b7f4
Format
pietern Nov 27, 2025
194b165
Interpolate SHAs
pietern Nov 27, 2025
a289e7f
Make PACKAGES usable var in Makefile
pietern Nov 27, 2025
ed8dc5b
.
pietern Nov 27, 2025
edc1f99
Use JSON array with targets
pietern Nov 27, 2025
e166105
Use fromJSON
pietern Nov 27, 2025
8d97d8f
Single quotes
pietern Nov 27, 2025
0fe377f
Reusable axction to setup job; split out jobs per target
pietern Nov 27, 2025
cc0c351
Multiple step ids
pietern Nov 27, 2025
72275e3
Fix
pietern Nov 27, 2025
08501cc
Fix
pietern Nov 27, 2025
5bd2beb
Fixes
pietern Nov 27, 2025
77679fd
Remove shell
pietern Nov 27, 2025
d1d7c0b
Bring back shell
pietern Nov 27, 2025
2a985f4
Rename
pietern Nov 27, 2025
f5364e4
Drop apps-mcp from main test target; Windows is broken
pietern Nov 28, 2025
1d4dfb9
Disable Windows tests for apps-mcp
pietern Nov 28, 2025
1fd2afc
Fix cache key
pietern Nov 28, 2025
3230dfc
Revert acceptance change
pietern Nov 28, 2025
3bec8a6
Merge branch 'main' into testmask
pietern Nov 28, 2025
87ef57d
Merge remote-tracking branch 'origin/testmask' into testmask
pietern Nov 28, 2025
1d5686c
Split lines
pietern Dec 2, 2025
1d9726a
Drop env vars
pietern Dec 2, 2025
fc4268b
Rename and simplify
pietern Dec 2, 2025
b9fcdbc
Split targets
pietern Dec 2, 2025
5982b8b
Move targets around
pietern Dec 2, 2025
459f899
Fix merge group testmask invocation
pietern Dec 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/actions/setup-build-environment/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: 'Setup Build Environment'
description: 'Sets up the build environment with Go, Python, uv, and ruff'

inputs:
cache-key:
description: 'Cache key identifier for Go cache'
required: true

runs:
using: 'composite'
steps:
- name: Checkout repository and submodules
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Create cache identifier
run: echo "${{ inputs.cache-key }}" > cache.txt
shell: bash

- name: Setup Go
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version-file: go.mod
cache-dependency-path: |
go.sum
cache.txt

- name: Setup Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: '3.13'

- name: Install uv
uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
with:
version: "0.8.9"

- name: Install ruff (Python linter and formatter)
uses: astral-sh/ruff-action@57714a7c8a2e59f32539362ba31877a1957dded1 # v3.5.1
with:
version: "0.9.1"
args: "--version"

- name: Pull external libraries
run: |
go mod download
pip3 install wheel==0.45.1
shell: bash
204 changes: 173 additions & 31 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,52 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh cache delete --all --repo databricks/cli || true

testmask:
runs-on: ubuntu-latest
outputs:
targets: ${{ steps.mask1.outputs.targets || steps.mask2.outputs.targets || steps.mask3.outputs.targets }}
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version-file: tools/go.mod

- name: Run testmask (pull requests)
if: ${{ github.event_name == 'pull_request' }}
id: mask1
working-directory: tools/testmask
run: |
go run . ${{ github.event.pull_request.head.sha }} ${{ github.event.pull_request.base.sha }} | tee output.json
echo "targets=$(jq -c '.' output.json)" >> $GITHUB_OUTPUT

- name: Run testmask (merge group)
if: ${{ github.event_name == 'merge_group' }}
id: mask2
working-directory: tools/testmask
run: |
go run . ${{ github.event.merge_group.head_sha }} ${{ github.event.merge_group.base_sha }} | tee output.json
echo "targets=$(jq -c '.' output.json)" >> $GITHUB_OUTPUT

- name: Run testmask (other events)
Copy link
Contributor

@denik denik Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  - name: Run testmask (merge group)
    if: ${{ github.event_name == 'merge_group' }}

In the above step name matches the condition, but this one does not? (the pull_request is excluded in both).

  - name: Run testmask (other events)
  - if: ${{ github.event_name != 'pull_request' && github.event_name != 'merge_group' }}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is another step above it for pull requests.

if: ${{ github.event_name != 'pull_request' && github.event_name != 'merge_group' }}
id: mask3
working-directory: tools/testmask
run: |
# Always run all tests
echo "targets=[\"test\"]" >> $GITHUB_OUTPUT

tests:
needs: cleanups
needs:
- cleanups
- testmask

# Only run if the target is in the list of targets from testmask
if: ${{ contains(fromJSON(needs.testmask.outputs.targets), 'test') }}
runs-on: ${{ matrix.os }}

strategy:
Expand All @@ -53,37 +97,10 @@ jobs:
- name: Checkout repository and submodules
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Create deployment-specific cache identifier
run: echo "${{ matrix.deployment }}" > deployment-type.txt

- name: Setup Go
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
- name: Setup build environment
uses: ./.github/actions/setup-build-environment
with:
go-version-file: go.mod
cache-dependency-path: |
go.sum
deployment-type.txt

- name: Setup Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: '3.13'

- name: Install uv
uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
with:
version: "0.8.9"

- name: Install ruff (Python linter and formatter)
uses: astral-sh/ruff-action@57714a7c8a2e59f32539362ba31877a1957dded1 # v3.5.1
with:
version: "0.9.1"
args: "--version"

- name: Pull external libraries
run: |
go mod download
pip3 install wheel==0.45.1
cache-key: test-${{ matrix.deployment }}

- name: Run tests without coverage
# We run tests without coverage on PR, merge_group, and schedule because we don't make use of coverage information
Expand All @@ -104,6 +121,131 @@ jobs:
- name: Analyze slow tests
run: make slowest

test-exp-aitools:
needs:
- cleanups
- testmask

# Only run if the target is in the list of targets from testmask
if: ${{ contains(fromJSON(needs.testmask.outputs.targets), 'test-exp-aitools') }}
name: "make test-exp-aitools"
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest

steps:
- name: Checkout repository and submodules
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Setup build environment
uses: ./.github/actions/setup-build-environment
with:
cache-key: test-exp-aitools
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each job has its own build cache to avoid interference.


- name: Run tests
run: |
make test-exp-aitools

test-exp-apps-mcp:
needs:
- cleanups
- testmask

# Only run if the target is in the list of targets from testmask
if: ${{ contains(fromJSON(needs.testmask.outputs.targets), 'test-exp-apps-mcp') }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not possible to use matrix.target in the if condition.

See https://docs.github.com/en/actions/reference/workflows-and-actions/contexts#context-availability

name: "make test-exp-apps-mcp"
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
# The Windows tests are broken; see https://github.com/databricks/cli/pull/4024.
# - windows-latest
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fjakobs Someone needs to take a look at these and uncomment when fixed.


steps:
- name: Checkout repository and submodules
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Setup build environment
uses: ./.github/actions/setup-build-environment
with:
cache-key: test-exp-apps-mcp

- name: Run tests
run: |
make test-exp-apps-mcp

test-exp-ssh:
needs:
- cleanups
- testmask

# Only run if the target is in the list of targets from testmask
if: ${{ contains(fromJSON(needs.testmask.outputs.targets), 'test-exp-ssh') }}
name: "make test-exp-ssh"
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest

steps:
- name: Checkout repository and submodules
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Setup build environment
uses: ./.github/actions/setup-build-environment
with:
cache-key: test-exp-ssh

- name: Run tests
run: |
make test-exp-ssh

test-pipelines:
needs:
- cleanups
- testmask

# Only run if the target is in the list of targets from testmask
if: ${{ contains(fromJSON(needs.testmask.outputs.targets), 'test-pipelines') }}
name: "make test-pipelines"
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest

steps:
- name: Checkout repository and submodules
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Setup build environment
uses: ./.github/actions/setup-build-environment
with:
cache-key: test-pipelines

- name: Run tests
run: |
make test-pipelines

validate-generated-is-up-to-date:
needs: cleanups
runs-on: ubuntu-latest
Expand Down
44 changes: 36 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
default: checks fmt lint

# gotestsum: when go test args are used with --rerun-fails the list of packages to test must be specified by the --packages flag
PACKAGES=--packages "./acceptance/... ./libs/... ./internal/... ./cmd/... ./bundle/... ./experimental/aitools/... ./experimental/ssh/... ."
# Default packages to test (all)
TEST_PACKAGES = ./acceptance/internal ./libs/... ./internal/... ./cmd/... ./bundle/... ./experimental/aitools/... ./experimental/ssh/... .
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --packages flag is now inlined where this is used so that the variable can be overridden.


# Default acceptance test filter (all)
ACCEPTANCE_TEST_FILTER = ""

GO_TOOL ?= go tool -modfile=tools/go.mod
GOTESTSUM_FORMAT ?= pkgname-and-test-fails
Expand Down Expand Up @@ -55,11 +58,24 @@ links:
# Checks other than 'fmt' and 'lint'; these are fast, so can be run first
checks: tidy ws links

test:
${GOTESTSUM_CMD} ${PACKAGES} -- -timeout=${LOCAL_TIMEOUT} -short

test-slow:
${GOTESTSUM_CMD} ${PACKAGES} -- -timeout=${LOCAL_TIMEOUT}
# Run short unit and acceptance tests (testing.Short() is true).
test: test-unit test-acc

# Run all unit and acceptance tests.
test-slow: test-slow-unit test-slow-acc

test-unit:
${GOTESTSUM_CMD} --packages "${TEST_PACKAGES}" -- -timeout=${LOCAL_TIMEOUT} -short

test-slow-unit:
${GOTESTSUM_CMD} --packages "${TEST_PACKAGES}" -- -timeout=${LOCAL_TIMEOUT}

test-acc:
${GOTESTSUM_CMD} --packages ./acceptance/... -- -timeout=${LOCAL_TIMEOUT} -short -run ${ACCEPTANCE_TEST_FILTER}

test-slow-acc:
${GOTESTSUM_CMD} --packages ./acceptance/... -- -timeout=${LOCAL_TIMEOUT} -run ${ACCEPTANCE_TEST_FILTER}

# Updates acceptance test output (local tests)
test-update:
Expand All @@ -82,7 +98,7 @@ slowest:

cover:
rm -fr ./acceptance/build/cover/
VERBOSE_TEST=1 CLI_GOCOVERDIR=build/cover ${GOTESTSUM_CMD} ${PACKAGES} -- -coverprofile=coverage.txt -timeout=${LOCAL_TIMEOUT}
VERBOSE_TEST=1 CLI_GOCOVERDIR=build/cover ${GOTESTSUM_CMD} --packages ${TEST_PACKAGES} -- -coverprofile=coverage.txt -timeout=${LOCAL_TIMEOUT}
rm -fr ./acceptance/build/cover-merged/
mkdir -p acceptance/build/cover-merged/
go tool covdata merge -i $$(printf '%s,' acceptance/build/cover/* | sed 's/,$$//') -o acceptance/build/cover-merged/
Expand Down Expand Up @@ -150,4 +166,16 @@ generate:
$(GENKIT_BINARY) update-sdk


.PHONY: lint lintfull tidy lintcheck fmt fmtfull test cover showcover build snapshot snapshot-release schema integration integration-short acc-cover acc-showcover docs ws wsfix links checks test-update test-update-templates test-update-aws test-update-all generate-validation
.PHONY: lint lintfull tidy lintcheck fmt fmtfull test test-unit test-acc test-slow test-slow-unit test-slow-acc cover showcover build snapshot snapshot-release schema integration integration-short acc-cover acc-showcover docs ws wsfix links checks test-update test-update-templates test-update-aws test-update-all generate-validation

test-exp-aitools:
make test TEST_PACKAGES="./experimental/aitools/..." ACCEPTANCE_TEST_FILTER="TestAccept/idontexistyet/aitools"

test-exp-apps-mcp:
make test TEST_PACKAGES="./experimental/apps-mcp/..." ACCEPTANCE_TEST_FILTER="TestAccept/idontexistyet/apps-mcp"

test-exp-ssh:
make test TEST_PACKAGES="./experimental/ssh/..." ACCEPTANCE_TEST_FILTER="TestAccept/ssh"

test-pipelines:
make test TEST_PACKAGES="./cmd/pipelines/..." ACCEPTANCE_TEST_FILTER="TestAccept/pipelines"
25 changes: 25 additions & 0 deletions tools/testmask/git.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package main

import (
"fmt"
"os/exec"
"strings"
)

// GetChangedFiles returns the list of files changed between two git refs.
func GetChangedFiles(headRef, baseRef string) ([]string, error) {
cmd := exec.Command("git", "diff", "--name-only", baseRef, headRef)
output, err := cmd.Output()
if err != nil {
return nil, fmt.Errorf("failed to get diff between %s and %s: %w", baseRef, headRef, err)
}

lines := strings.Split(string(output), "\n")

// Drop the last line (always empty)
if len(lines) > 0 {
lines = lines[:len(lines)-1]
}

return lines, nil
}
Loading