From 5c2aa52babff6063c7fd9b8a92182da2dbf1cf97 Mon Sep 17 00:00:00 2001
From: "Giau. Tran Minh" <hello@giautm.dev>
Date: Fri, 2 Feb 2024 00:43:35 +0700
Subject: [PATCH 1/2] crdb: add latest version in test

---
 .github/workflows/cd-docker-push-cockroach_oss.yaml | 2 +-
 .github/workflows/ci-dialect_oss.yaml               | 2 +-
 internal/ci/jobs_oss.go                             | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/cd-docker-push-cockroach_oss.yaml b/.github/workflows/cd-docker-push-cockroach_oss.yaml
index b3460533bb7..93b32835aae 100644
--- a/.github/workflows/cd-docker-push-cockroach_oss.yaml
+++ b/.github/workflows/cd-docker-push-cockroach_oss.yaml
@@ -6,7 +6,7 @@ on:
       - master
 
 env:
-  CRDB_VERSIONS: v21.2.11 v22.1.0
+  CRDB_VERSIONS: v21.2.11 v22.1.0 v23.1.14
 
 jobs:
   build-services:
diff --git a/.github/workflows/ci-dialect_oss.yaml b/.github/workflows/ci-dialect_oss.yaml
index 588859d7d63..2fd6f2bc06c 100644
--- a/.github/workflows/ci-dialect_oss.yaml
+++ b/.github/workflows/ci-dialect_oss.yaml
@@ -420,7 +420,7 @@ jobs:
     runs-on: ubuntu-latest
     services:
       cockroach:
-        image: ghcr.io/ariga/cockroachdb-single-node:v21.2.11
+        image: ghcr.io/ariga/cockroachdb-single-node:v23.1.14
         
         ports:
           - 26257:26257
diff --git a/internal/ci/jobs_oss.go b/internal/ci/jobs_oss.go
index b9e68c99767..785656012d1 100644
--- a/internal/ci/jobs_oss.go
+++ b/internal/ci/jobs_oss.go
@@ -25,7 +25,7 @@ func init() {
 		},
 		Job{
 			Version: "cockroach",
-			Image:   "ghcr.io/ariga/cockroachdb-single-node:v21.2.11",
+			Image:   "ghcr.io/ariga/cockroachdb-single-node:v23.1.14",
 			Regex:   "Cockroach",
 			Ports:   []string{"26257:26257"},
 		},

From 763bef4745e69a84cf41493df0f7d61d4cb6495b Mon Sep 17 00:00:00 2001
From: "Giau. Tran Minh" <hello@giautm.dev>
Date: Fri, 2 Feb 2024 00:54:58 +0700
Subject: [PATCH 2/2] chore: test more versions

---
 .../cd-docker-push-cockroach_oss.yaml         |  2 +-
 .github/workflows/ci-dialect_oss.yaml         | 48 +++++++++++++++++--
 internal/ci/jobs_oss.go                       | 16 ++++++-
 internal/integration/cockroach_test.go        |  4 +-
 4 files changed, 61 insertions(+), 9 deletions(-)

diff --git a/.github/workflows/cd-docker-push-cockroach_oss.yaml b/.github/workflows/cd-docker-push-cockroach_oss.yaml
index 93b32835aae..c88ba36a116 100644
--- a/.github/workflows/cd-docker-push-cockroach_oss.yaml
+++ b/.github/workflows/cd-docker-push-cockroach_oss.yaml
@@ -4,7 +4,7 @@ on:
   push:
     branches:
       - master
-
+  workflow_dispatch:
 env:
   CRDB_VERSIONS: v21.2.11 v22.1.0 v23.1.14
 
diff --git a/.github/workflows/ci-dialect_oss.yaml b/.github/workflows/ci-dialect_oss.yaml
index 2fd6f2bc06c..ee0e656e107 100644
--- a/.github/workflows/ci-dialect_oss.yaml
+++ b/.github/workflows/ci-dialect_oss.yaml
@@ -416,11 +416,11 @@ jobs:
         run: go test -race -count=2 -v -run="TiDB" -version="tidb6" -timeout 15m ./...
         
 
-  integration-cockroach:
+  integration-cockroach-21:
     runs-on: ubuntu-latest
     services:
-      cockroach:
-        image: ghcr.io/ariga/cockroachdb-single-node:v23.1.14
+      cockroach-21:
+        image: ghcr.io/ariga/cockroachdb-single-node:v21.2.11
         
         ports:
           - 26257:26257
@@ -430,8 +430,46 @@ jobs:
       - uses: actions/setup-go@v4
         with:
           go-version-file: cmd/atlas/go.mod
-      - name: Run integration tests for cockroach
+      - name: Run integration tests for cockroach-21
+        working-directory: internal/integration
+        run: go test -race -count=2 -v -run="Cockroach" -version="cockroach-21" -timeout 15m ./...
+        
+
+  integration-cockroach-22:
+    runs-on: ubuntu-latest
+    services:
+      cockroach-22:
+        image: ghcr.io/ariga/cockroachdb-single-node:v22.1.0
+        
+        ports:
+          - 26258:26257
+        
+    steps:
+      - uses: actions/checkout@v2.3.4
+      - uses: actions/setup-go@v4
+        with:
+          go-version-file: cmd/atlas/go.mod
+      - name: Run integration tests for cockroach-22
+        working-directory: internal/integration
+        run: go test -race -count=2 -v -run="Cockroach" -version="cockroach-22" -timeout 15m ./...
+        
+
+  integration-cockroach-23:
+    runs-on: ubuntu-latest
+    services:
+      cockroach-23:
+        image: ghcr.io/ariga/cockroachdb-single-node:v23.1.14
+        
+        ports:
+          - 26259:26257
+        
+    steps:
+      - uses: actions/checkout@v2.3.4
+      - uses: actions/setup-go@v4
+        with:
+          go-version-file: cmd/atlas/go.mod
+      - name: Run integration tests for cockroach-23
         working-directory: internal/integration
-        run: go test -race -count=2 -v -run="Cockroach" -version="cockroach" -timeout 15m ./...
+        run: go test -race -count=2 -v -run="Cockroach" -version="cockroach-23" -timeout 15m ./...
         
 
diff --git a/internal/ci/jobs_oss.go b/internal/ci/jobs_oss.go
index 785656012d1..3aef1ebd1bb 100644
--- a/internal/ci/jobs_oss.go
+++ b/internal/ci/jobs_oss.go
@@ -24,10 +24,22 @@ func init() {
 			Ports:   []string{"4310:4000"},
 		},
 		Job{
-			Version: "cockroach",
-			Image:   "ghcr.io/ariga/cockroachdb-single-node:v23.1.14",
+			Version: "cockroach-21",
+			Image:   "ghcr.io/ariga/cockroachdb-single-node:v21.2.11",
 			Regex:   "Cockroach",
 			Ports:   []string{"26257:26257"},
 		},
+		Job{
+			Version: "cockroach-22",
+			Image:   "ghcr.io/ariga/cockroachdb-single-node:v22.1.0",
+			Regex:   "Cockroach",
+			Ports:   []string{"26258:26257"},
+		},
+		Job{
+			Version: "cockroach-23",
+			Image:   "ghcr.io/ariga/cockroachdb-single-node:v23.1.14",
+			Regex:   "Cockroach",
+			Ports:   []string{"26259:26257"},
+		},
 	)
 }
diff --git a/internal/integration/cockroach_test.go b/internal/integration/cockroach_test.go
index 3fb0ddd947b..987b53636fd 100644
--- a/internal/integration/cockroach_test.go
+++ b/internal/integration/cockroach_test.go
@@ -32,7 +32,9 @@ type crdbTest struct {
 }
 
 var crdbTests = map[string]*crdbTest{
-	"cockroach": {port: 26257},
+	"cockroach-21": {port: 26257},
+	"cockroach-22": {port: 26258},
+	"cockroach-23": {port: 26259},
 }
 
 func crdbRun(t *testing.T, fn func(*crdbTest)) {