Skip to content

Commit c20d1b0

Browse files
committed
ci: fix Windows test glob + Ubuntu mysql/mariadb apt conflict
Two CI failures from PR #4: - Windows: ./internal/driver/_*/ is a bash glob PowerShell doesn't expand, so go test got a literal path and failed. Name _mysqlcommon by import path instead (portable across shells); mirror in the Makefile. - Ubuntu: mariadb-client Conflicts with mysql-client-core, so they can't co-install. Install mysql-client from Ubuntu and pull mariadb-client from MariaDB's official APT repo, which is built to coexist.
1 parent 8caf1f4 commit c20d1b0

2 files changed

Lines changed: 21 additions & 18 deletions

File tree

.github/workflows/ci.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,11 @@ jobs:
3838
cache: true
3939
- name: go vet
4040
run: go vet ./...
41-
# `./...` skips underscore-prefixed dirs, so name _*-prefixed packages
42-
# explicitly (e.g. internal/driver/_mysqlcommon) to run their unit tests.
41+
# `./...` skips underscore-prefixed dirs, so name the _mysqlcommon package
42+
# explicitly by import path to run its unit tests. Use the import path (not
43+
# a `_*` shell glob) so it works on PowerShell (Windows) as well as bash.
4344
- name: go test
44-
run: go test ./... ./internal/driver/_*/
45+
run: go test ./... github.com/nixrajput/siphon/internal/driver/_mysqlcommon
4546
# Integration tests use testcontainers, which needs a Docker daemon.
4647
# Only ubuntu-latest runners have Docker available by default, so the
4748
# DB client install and integration suite are scoped to Ubuntu.
@@ -51,14 +52,14 @@ jobs:
5152
if: matrix.os == 'ubuntu-latest'
5253
run: |
5354
sudo apt-get update
54-
# postgresql-client -> pg_dump/pg_restore
55-
# mysql-client -> mysqldump/mysql
56-
# mariadb-client -> mariadb-dump/mariadb
57-
# NOTE: mysql-client and mariadb-client can conflict on some Ubuntu
58-
# releases (both provide the mysql* binaries via alternatives). If apt
59-
# reports a conflict in CI, split them or drop mysql-client (mariadb-client
60-
# provides mysql-compatible binaries) as a one-line follow-up.
61-
sudo apt-get install -y postgresql-client mysql-client mariadb-client
55+
# postgresql-client -> pg_dump/pg_restore ; mysql-client -> mysqldump/mysql
56+
sudo apt-get install -y postgresql-client mysql-client
57+
# Ubuntu's mariadb-client Conflicts with mysql-client-core, so it can't
58+
# co-install. Pull mariadb-dump/mariadb from MariaDB's official APT repo
59+
# (the repo's mariadb-client is built to coexist with MySQL's client).
60+
curl -fsSL https://r.mariadb.com/downloads/mariadb_repo_setup | sudo bash
61+
sudo apt-get update
62+
sudo apt-get install -y mariadb-client
6263
- name: Integration tests (Ubuntu only — needs Docker)
6364
if: matrix.os == 'ubuntu-latest'
64-
run: go test -tags=integration ./... ./internal/driver/_*/
65+
run: go test -tags=integration ./... github.com/nixrajput/siphon/internal/driver/_mysqlcommon

Makefile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,19 @@ lint: ## Run golangci-lint
1111

1212
# NOTE: `go test ./...` skips directories whose names start with `_` (Go tool
1313
# convention), so underscore-prefixed packages with real tests (e.g.
14-
# internal/driver/_mysqlcommon) are silently excluded. Name them explicitly via
15-
# the `_*` glob so their unit tests actually run. The glob auto-picks up any
16-
# future _*-prefixed package under internal/driver/.
14+
# internal/driver/_mysqlcommon) are silently excluded. Name them explicitly by
15+
# import path so their unit tests run. Use the import path (not a `_*` shell
16+
# glob) so this is identical to what CI runs and works regardless of shell.
17+
UNDERSCORE_PKGS := github.com/nixrajput/siphon/internal/driver/_mysqlcommon
18+
1719
test: ## Run unit tests
18-
go test ./... ./internal/driver/_*/
20+
go test ./... $(UNDERSCORE_PKGS)
1921

2022
test-verbose: ## Run unit tests verbosely
21-
go test -v ./... ./internal/driver/_*/
23+
go test -v ./... $(UNDERSCORE_PKGS)
2224

2325
test-integration: ## Run integration tests (build tag: integration)
24-
go test -tags=integration ./... ./internal/driver/_*/
26+
go test -tags=integration ./... $(UNDERSCORE_PKGS)
2527

2628
build: ## Build the siphon binary into ./bin
2729
@mkdir -p bin

0 commit comments

Comments
 (0)