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
44inputs :
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
3622runs :
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')
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"
0 commit comments