Java testing guide #655
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test build | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test-build: | |
name: Test build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Run vale spell and style check | |
continue-on-error: true | |
uses: errata-ai/vale-action@reviewdog | |
with: | |
files: docs | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: yarn | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Test build website | |
run: yarn build | |
# Test TypeScript code snippets | |
- name: Compile TypeScript code snippets | |
run: npm install --prefix code_snippets/ts && npm run build --prefix code_snippets/ts | |
- name: Check if TypeScript code snippets build is successful | |
run: | | |
if [ -d "code_snippets/ts/dist" ]; then | |
echo "TypeScript compilation successful" | |
else | |
echo "TypeScript compilation failed" | |
exit 1 | |
fi | |
# Setup Python | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
# Test if Python code snippets compile | |
- name: Install dependencies and check Python code snippets | |
run: | | |
cd code_snippets/python | |
python3 -m venv .venv | |
source .venv/bin/activate | |
pip install -r requirements.txt | |
pip install mypy | |
python3 -m mypy . | |
deactivate | |
# Setup Java | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: "temurin" | |
java-version: "21" | |
# Check Java code snippets | |
- name: Test Java code snippets | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: check | |
build-root-directory: code_snippets/java | |
# Check Java code snippets | |
- name: Test Kotlin code snippets | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: check | |
build-root-directory: code_snippets/kotlin | |
# Setup Go | |
- uses: actions/setup-go@v5 | |
if: github.event.inputs.sdkGoVersion != '' | |
with: | |
go-version: "1.21" | |
# Check Go code snippets | |
- name: Test Go code snippets | |
working-directory: code_snippets/go | |
run: go test ./... |