Skip to content

Commit a79be5b

Browse files
committed
actions in theory I guess
1 parent a8a4922 commit a79be5b

7 files changed

Lines changed: 220 additions & 89 deletions

File tree

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: 'Setup clients environment'
2+
description: 'Installs the language toolchains needed to run client integration tests'
3+
4+
inputs:
5+
clients:
6+
description: 'Comma-separated list of clients to test (e.g., java,typescript,python) or "all" for all clients'
7+
required: true
8+
9+
runs:
10+
using: composite
11+
steps:
12+
# --- typescript ---
13+
- name: Setup node
14+
if: inputs.clients == 'all' || contains(inputs.clients, 'typescript')
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: 'lts/*'
18+
cache: 'npm'
19+
20+
- name: Verify node
21+
if: inputs.clients == 'all' || contains(inputs.clients, 'typescript')
22+
shell: bash
23+
run: |
24+
set -x
25+
node --version
26+
npm --version
27+
28+
# --- python ---
29+
- name: Setup uv
30+
if: inputs.clients == 'all' || contains(inputs.clients, 'python')
31+
uses: astral-sh/setup-uv@v6
32+
33+
- name: Verify uv
34+
if: inputs.clients == 'all' || contains(inputs.clients, 'python')
35+
shell: bash
36+
run: |
37+
set -x
38+
uv --version
39+
40+
# --- go ---
41+
- name: Setup go
42+
if: inputs.clients == 'all' || contains(inputs.clients, 'go')
43+
uses: actions/setup-go@v5
44+
with:
45+
go-version: 'stable'
46+
47+
- name: Verify go
48+
if: inputs.clients == 'all' || contains(inputs.clients, 'go')
49+
shell: bash
50+
run: |
51+
set -x
52+
go version
53+
54+
# --- dotnet ---
55+
- name: Setup dotnet
56+
if: inputs.clients == 'all' || contains(inputs.clients, 'csharp')
57+
uses: actions/setup-dotnet@v5
58+
with:
59+
dotnet-version: '8.0.x'
60+
61+
- name: Verify dotnet
62+
if: inputs.clients == 'all' || contains(inputs.clients, 'csharp')
63+
shell: bash
64+
run: |
65+
set -x
66+
dotnet --list-sdks

.github/actions/use-dh/action.yml renamed to .github/actions/_setup-docs-env/action.yml

Lines changed: 9 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
name: 'setup-dh'
2-
description: 'Builds the `dh` cli + installs any required dependencies'
1+
name: 'Setup docs environment'
2+
description: 'Clones the docs repo and installs the language toolchains needed to run docs examples'
33

44
inputs:
55
docs-repo:
@@ -18,20 +18,6 @@ inputs:
1818
description: 'Install jq'
1919
required: false
2020
default: 'false'
21-
args:
22-
description: 'Args to pass to dh'
23-
required: true
24-
allow-failures:
25-
description: 'Whether to allow test failures without failing the entire workflow'
26-
default: 'false'
27-
28-
outputs:
29-
dh-cli-path:
30-
description: 'Path to the built dh jar file'
31-
value: ${{ steps.build-cli.outputs.dh-cli-path }}
32-
failed_tests:
33-
description: 'Whether any tests failed'
34-
value: ${{ steps.run-tests.outputs.failed_tests }}
3521

3622
runs:
3723
using: composite
@@ -44,25 +30,25 @@ runs:
4430
BRANCH="main"
4531
4632
REPO_INPUT="${{ inputs.docs-repo }}"
47-
33+
4834
if [[ -n "$REPO_INPUT" ]]; then
4935
if [[ "$REPO_INPUT" == *"@"* ]]; then
5036
LEFT="${REPO_INPUT%%@*}"
5137
RIGHT="${REPO_INPUT#*@}"
52-
38+
5339
[[ -n "$LEFT" ]] && REPO_PATH="$LEFT"
5440
[[ -n "$RIGHT" ]] && BRANCH="$RIGHT"
5541
else
5642
REPO_PATH="$REPO_INPUT"
5743
fi
5844
fi
59-
45+
6046
EXAMPLES_PATH="${{ inputs.examples-path }}"
61-
47+
6248
echo "repo-path=$REPO_PATH" >> $GITHUB_OUTPUT
6349
echo "branch=$BRANCH" >> $GITHUB_OUTPUT
6450
echo "examples-path=$EXAMPLES_PATH" >> $GITHUB_OUTPUT
65-
51+
6652
echo "Repository: '$REPO_PATH'"
6753
echo "Branch: '$BRANCH'"
6854
echo "Examples path: '$EXAMPLES_PATH'"
@@ -83,29 +69,15 @@ runs:
8369
run: |
8470
DOCS_PATH="${{ github.workspace }}/docs-repo"
8571
EXAMPLES_FOLDER="$DOCS_PATH/${{ steps.parse-repo.outputs.examples-path }}"
86-
72+
8773
if [ ! -d "$EXAMPLES_FOLDER" ]; then
8874
echo "ERROR: Examples folder not found: $EXAMPLES_FOLDER"
8975
exit 1
9076
fi
91-
77+
9278
echo "EXAMPLES_FOLDER=$EXAMPLES_FOLDER" >> $GITHUB_ENV
9379
echo "Documentation cloned to: $DOCS_PATH"
9480
95-
# --- java ---
96-
- name: Setup java
97-
uses: actions/setup-java@v4
98-
with:
99-
distribution: 'temurin'
100-
java-version: '25'
101-
cache: 'gradle'
102-
103-
- name: Verify java
104-
shell: bash
105-
run: |
106-
set -x
107-
java --version
108-
10981
# --- typescript ---
11082
- name: Setup node
11183
if: inputs.setup-languages == 'all' || contains(inputs.setup-languages, 'typescript')
@@ -121,7 +93,6 @@ runs:
12193
set -x
12294
node --version
12395
npm --version
124-
npx tsx --version
12596
12697
- name: Setup + verify tsx
12798
if: inputs.setup-languages == 'all' || contains(inputs.setup-languages, 'typescript')
@@ -173,40 +144,3 @@ runs:
173144
set -x
174145
sudo apt-get update && sudo apt-get install -y jq
175146
jq --version
176-
177-
# --- actually use dh ---
178-
- name: Use dh
179-
shell: bash
180-
id: run-tests
181-
run: |
182-
set -x
183-
184-
export SPINNER=false
185-
source astra-client-docs-tests/scripts/dev-alias.sh --no-compgen
186-
187-
set +e
188-
189-
dh ${{ inputs.args }}
190-
exit_code=$?
191-
192-
case $exit_code in
193-
0)
194-
echo "failed_tests=false" >> $GITHUB_OUTPUT
195-
;;
196-
100)
197-
echo "failed_tests=true" >> $GITHUB_OUTPUT
198-
if [[ "${{ inputs.allow-failures }}" == 'false' ]]; then
199-
exit 100
200-
fi
201-
;;
202-
*)
203-
exit $exit_code
204-
;;
205-
esac
206-
207-
- name: Print logs on failure
208-
if: always() && steps.run-tests.outputs.failed_tests == 'true'
209-
shell: bash
210-
run: |
211-
set -x
212-
cat astra-client-docs-tests/.dh_temp/logs/* || echo "No logs found"

‎.github/actions/_use-dh/action.yml‎

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: 'Actually use dh'
2+
description: 'Builds and runs the `dh` cli'
3+
4+
inputs:
5+
args:
6+
description: 'Args to pass to dh'
7+
required: true
8+
allow-failures:
9+
description: 'Whether to allow test failures without failing the entire workflow'
10+
default: 'false'
11+
12+
outputs:
13+
dh-cli-path:
14+
description: 'Path to the built dh jar file'
15+
value: ${{ steps.build-cli.outputs.dh-cli-path }}
16+
failed_tests:
17+
description: 'Whether any tests failed'
18+
value: ${{ steps.run-tests.outputs.failed_tests }}
19+
20+
runs:
21+
using: composite
22+
steps:
23+
# --- java ---
24+
- name: Setup java
25+
uses: actions/setup-java@v4
26+
with:
27+
distribution: 'temurin'
28+
java-version: '25'
29+
cache: 'gradle'
30+
31+
- name: Verify java
32+
shell: bash
33+
run: |
34+
set -x
35+
java --version
36+
37+
# --- actually use dh ---
38+
- name: Use dh
39+
shell: bash
40+
id: run-tests
41+
run: |
42+
set -x
43+
44+
export SPINNER=false
45+
source astra-client-docs-tests/scripts/dev-alias.sh --no-compgen
46+
47+
set +e
48+
49+
dh ${{ inputs.args }}
50+
exit_code=$?
51+
52+
case $exit_code in
53+
0)
54+
echo "failed_tests=false" >> $GITHUB_OUTPUT
55+
;;
56+
100)
57+
echo "failed_tests=true" >> $GITHUB_OUTPUT
58+
if [[ "${{ inputs.allow-failures }}" == 'false' ]]; then
59+
exit 100
60+
fi
61+
;;
62+
*)
63+
exit $exit_code
64+
;;
65+
esac
66+
67+
- name: Print logs on failure
68+
if: always() && steps.run-tests.outputs.failed_tests == 'true'
69+
shell: bash
70+
run: |
71+
set -x
72+
cat astra-client-docs-tests/.dh_temp/logs/* || echo "No logs found"
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
inputs:
2+
clients:
3+
description: 'Comma-separated list of clients to test (e.g., java,typescript,python) or "all" for all clients'
4+
required: true
5+
args:
6+
description: 'Additional arguments to pass to dh'
7+
default: ''
8+
db-token:
9+
description: 'Astra token for authentication'
10+
required: true
11+
db-endpoint:
12+
description: 'API endpoint for testing'
13+
required: true
14+
allow-failures:
15+
description: 'Whether to allow test failures without failing the entire workflow'
16+
default: 'false'
17+
18+
outputs:
19+
failed_tests:
20+
description: 'Whether any tests failed'
21+
value: ${{ steps.run-tests.outputs.failed_tests }}
22+
23+
runs:
24+
using: composite
25+
steps:
26+
- name: Checkout docs testing repository
27+
uses: actions/checkout@v4
28+
with:
29+
repository: 'datastax/astra-client-docs-tests'
30+
path: astra-client-docs-tests
31+
32+
- name: Setup clients env
33+
uses: ./astra-client-docs-tests/.github/actions/_setup-clients-env
34+
with:
35+
clients: ${{ inputs.clients }}
36+
37+
- name: Run client integration tests
38+
id: run-tests
39+
uses: ./astra-client-docs-tests/.github/actions/_use-dh
40+
env:
41+
ASTRA_TOKEN: ${{ inputs.db-token }}
42+
API_ENDPOINT: ${{ inputs.db-endpoint }}
43+
with:
44+
allow-failures: ${{ inputs.allow-failures }}
45+
args: |
46+
clients test ${{ inputs.clients }} ${{ inputs.args }}

‎.github/actions/test-compilation/action.yml‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,21 @@ runs:
3636
ref: '${{ inputs.testing-repo-ref }}'
3737
path: astra-client-docs-tests
3838

39+
- name: Setup docs env
40+
uses: ./astra-client-docs-tests/.github/actions/_setup-docs-env
41+
with:
42+
docs-repo: ${{ inputs.docs-repo }}
43+
docs-repo-token: ${{ inputs.docs-repo-token }}
44+
examples-path: ${{ inputs.examples-path }}
45+
setup-languages: ${{ inputs.clients }}
46+
3947
- name: Run client compilation tests
4048
id: run-tests
41-
uses: ./astra-client-docs-tests/.github/actions/use-dh
49+
uses: ./astra-client-docs-tests/.github/actions/_use-dh
4250
env:
4351
ASTRA_TOKEN: 'dummy-token'
4452
API_ENDPOINT: 'dummy-endpoint'
4553
with:
46-
docs-repo: ${{ inputs.docs-repo }}
47-
docs-repo-token: ${{ inputs.docs-repo-token }}
48-
examples-path: ${{ inputs.examples-path }}
4954
allow-failures: ${{ inputs.allow-failures }}
50-
setup-languages: ${{ inputs.clients }}
5155
args: |
5256
docs test -m compile_only ${{ inputs.clients }} ${{ inputs.args }}

‎.github/actions/test-execution/action.yml‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,22 @@ runs:
3838
repository: 'datastax/astra-client-docs-tests'
3939
path: astra-client-docs-tests
4040

41-
- name: Run client compilation tests
42-
id: run-tests
43-
uses: ./astra-client-docs-tests/.github/actions/use-dh
44-
env:
45-
ASTRA_TOKEN: ${{ inputs.token }}
46-
API_ENDPOINT: ${{ inputs.api-endpoint }}
41+
- name: Setup docs env
42+
uses: ./astra-client-docs-tests/.github/actions/_setup-docs-env
4743
with:
4844
docs-repo: ${{ inputs.docs-repo }}
4945
docs-repo-token: ${{ inputs.docs-repo-token }}
5046
examples-path: ${{ inputs.examples-path }}
51-
allow-failures: ${{ inputs.allow-failures }}
5247
setup-languages: ${{ inputs.clients }},typescript # always need typescript for execution tests
5348
setup-jq: true
49+
50+
- name: Run client compilation tests
51+
id: run-tests
52+
uses: ./astra-client-docs-tests/.github/actions/_use-dh
53+
env:
54+
ASTRA_TOKEN: ${{ inputs.db-token }}
55+
API_ENDPOINT: ${{ inputs.db-endpoint }}
56+
with:
57+
allow-failures: ${{ inputs.allow-failures }}
5458
args: |
5559
docs test ${{ inputs.clients }} ${{ inputs.args }}

0 commit comments

Comments
 (0)