Skip to content

Commit 9a6f2b0

Browse files
authored
Add workflow for SQL CLI integration tests (#4770)
* Add workflow for SQL CLI integration tests Signed-off-by: Simeon Widdis <sawiddis@amazon.com> * Switch SQL checkout path for CLI Signed-off-by: Simeon Widdis <sawiddis@amazon.com> * Tweak paths and mkdir for remote Signed-off-by: Simeon Widdis <sawiddis@amazon.com> * Fix filename Signed-off-by: Simeon Widdis <sawiddis@amazon.com> * Remove redundant verification Signed-off-by: Simeon Widdis <sawiddis@amazon.com> * Don't pull after clone Signed-off-by: Simeon Widdis <sawiddis@amazon.com> --------- Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
1 parent 5dca84f commit 9a6f2b0

1 file changed

Lines changed: 96 additions & 0 deletions

File tree

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: SQL CLI Integration Test
2+
3+
# This workflow tests sql-cli against the current SQL changes
4+
# to catch breaking changes before they're published
5+
6+
on:
7+
pull_request:
8+
paths:
9+
- '**/*.java'
10+
- '**/*.g4'
11+
- '!sql-jdbc/**'
12+
- '**gradle*'
13+
- '**lombok*'
14+
- 'integ-test/**'
15+
- '**/*.jar'
16+
- '**/*.pom'
17+
- '.github/workflows/sql-cli-integration-test.yml'
18+
push:
19+
branches:
20+
- main
21+
- '[0-9]+.[0-9]+'
22+
- '[0-9]+.x'
23+
paths:
24+
- '**/*.java'
25+
- '**/*.g4'
26+
- '!sql-jdbc/**'
27+
- '**gradle*'
28+
- '**lombok*'
29+
- 'integ-test/**'
30+
- '**/*.jar'
31+
- '**/*.pom'
32+
- '.github/workflows/sql-cli-integration-test.yml'
33+
workflow_dispatch:
34+
35+
jobs:
36+
test-sql-cli-integration:
37+
runs-on: ubuntu-latest
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
java: [21]
42+
43+
steps:
44+
- name: Checkout SQL CLI repository (latest main)
45+
uses: actions/checkout@v4
46+
with:
47+
repository: opensearch-project/sql-cli
48+
path: sql-cli
49+
ref: main
50+
51+
- name: Make a directory for the SQL repo
52+
working-directory: sql-cli
53+
run: mkdir remote
54+
55+
- name: Checkout SQL repository (current changes)
56+
uses: actions/checkout@v4
57+
with:
58+
path: sql-cli/remote/sql
59+
60+
- name: Set up JDK ${{ matrix.java }}
61+
uses: actions/setup-java@v4
62+
with:
63+
distribution: 'temurin'
64+
java-version: ${{ matrix.java }}
65+
66+
- name: Build and publish SQL modules to Maven Local
67+
working-directory: sql-cli/remote/sql
68+
run: |
69+
echo "Building SQL modules from current branch..."
70+
./gradlew publishToMavenLocal -x test -x integTest
71+
echo "SQL modules published to Maven Local"
72+
73+
- name: Run SQL CLI tests with local SQL modules
74+
working-directory: sql-cli
75+
run: |
76+
echo "Running SQL CLI tests against local SQL modules..."
77+
./gradlew test -PuseLocalSql=true -PskipSqlRepoPull=true
78+
79+
- name: Upload SQL CLI test reports
80+
if: always()
81+
uses: actions/upload-artifact@v4
82+
continue-on-error: true
83+
with:
84+
name: sql-cli-test-reports-java-${{ matrix.java }}
85+
path: |
86+
sql-cli/build/reports/**
87+
sql-cli/build/test-results/**
88+
89+
- name: Test Summary
90+
if: always()
91+
run: |
92+
echo "## SQL CLI Integration Test Results" >> $GITHUB_STEP_SUMMARY
93+
echo "" >> $GITHUB_STEP_SUMMARY
94+
echo "Tested SQL CLI against SQL changes from: \`${{ github.ref }}\`" >> $GITHUB_STEP_SUMMARY
95+
echo "SQL CLI version: main branch (latest)" >> $GITHUB_STEP_SUMMARY
96+
echo "Java version: ${{ matrix.java }}" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)