Skip to content

Migrate to GitHub Actions - #1017

Merged
SuperQ merged 1 commit into
mainfrom
superq/ci
Apr 13, 2026
Merged

Migrate to GitHub Actions#1017
SuperQ merged 1 commit into
mainfrom
superq/ci

Conversation

@SuperQ

@SuperQ SuperQ commented Apr 8, 2026

Copy link
Copy Markdown
Member

Migrate CI to GitHub Actions.

  • Enable dependabot for GitHub Actions.

@SuperQ
SuperQ requested a review from roidelapluie April 8, 2026 15:25
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
publish_main:
name: Publish main branch artifacts
runs-on: ubuntu-latest
needs: [test_go, build]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

also intergration, mixin ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Integration yes, but we don't publish the mixins.

@roidelapluie

Copy link
Copy Markdown
Member

make test runs go test -race ./..., which calls TestExporter using dsn = "root@/mysql" - a unix socket connection

we should support a custom DSN -- changes are needed in tests. I would also run integration tests with -v. We could also have health checks in the service section.

Comment thread .github/workflows/ci.yml
image: ${{ matrix.mysql_image }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
MYSQL_ROOT_HOST: '%'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

options: >-
    --health-cmd="mysqladmin ping"
    --health-interval=10s
    --health-timeout=5s
    --health-retries=10

@SuperQ

SuperQ commented Apr 11, 2026

Copy link
Copy Markdown
Member Author

So, I have a suspicion that the integration test doesn't actually do anything. I have no running mysql locally and nothing fails. :-/

@roidelapluie

Copy link
Copy Markdown
Member

We would need to set a dynamic DSN in the github workflow TEST_MYSQL_DSN: "root:@tcp(mysql:3306)/mysql".

Then change some go code:

diff --git a/collector/exporter_test.go b/collector/exporter_test.go
index 2e6682b..1589fc2 100644
--- a/collector/exporter_test.go
+++ b/collector/exporter_test.go
@@ -15,6 +15,7 @@ package collector
 
 import (
 	"context"
+	"os"
 	"testing"
 
 	"github.com/prometheus/client_golang/prometheus"
@@ -25,6 +26,15 @@ import (
 
 const dsn = "root@/mysql"
 
+// testConnDSN returns the DSN to use for integration tests.
+// It uses TEST_MYSQL_DSN if set, falling back to the default Unix socket DSN.
+func testConnDSN() string {
+	if d := os.Getenv("TEST_MYSQL_DSN"); d != "" {
+		return d
+	}
+	return dsn
+}
+
 func TestExporter(t *testing.T) {
 	if testing.Short() {
 		t.Skip("-short is passed, skipping test")
@@ -32,7 +42,7 @@ func TestExporter(t *testing.T) {
 
 	exporter := New(
 		context.Background(),
-		dsn,
+		testConnDSN(),
 		[]Scraper{
 			ScrapeGlobalStatus{},
 		},

Migrate CI to GitHub Actions.
* Enable dependabot for GitHub Actions.

Signed-off-by: SuperQ <superq@gmail.com>
@SuperQ
SuperQ merged commit 92a0990 into main Apr 13, 2026
18 checks passed
@SuperQ
SuperQ deleted the superq/ci branch April 13, 2026 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants