Skip to content

Test

Test #818

Workflow file for this run

# SPDX-License-Identifier: Apache-2.0
# Copyright 2022 Atlan Pte. Ltd.
name: "Test"
on:
schedule:
- cron: "0 4 * * *"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
name: "Build"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Compile
uses: burrunan/gradle-cache-action@v1
with:
arguments: assemble shadowJar test
# - name: Upload build artifacts
# uses: actions/upload-artifact@v4
# with:
# name: build-artifacts
# path: |
# integration-tests/build/classes/java/test/com/atlan/java/sdk/*.class
# samples/packages/**/build/classes/kotlin/test/**/*.class
list-integration-tests:
runs-on: ubuntu-latest
outputs:
tests: ${{ steps.test-files.outputs.tests }}
steps:
- uses: actions/checkout@v4
- name: List integration tests
id: test-files
run: |
tests=$(ls integration-tests/src/test/java/com/atlan/java/sdk/*Test.java | sed -E 's|.*/src/test/java/com/atlan/java/sdk/||; s|/|.|g; s|\.java$||' | tr '\n' ' ')
json_tests=$(echo "$tests[@]}" | jq -R -c 'split(" ")[:-1]')
echo "tests=$json_tests" >> $GITHUB_OUTPUT
integration-test:
needs:
- build
- list-integration-tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
tests: ${{fromJson(needs.list-integration-tests.outputs.tests)}}
concurrency:
group: ${{ matrix.tests }}
name: "Integration"
steps:
- uses: actions/checkout@v4
# - name: Download artifacts
# uses: actions/download-artifact@v4
# with:
# name: build-artifacts
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Integration tests
uses: burrunan/gradle-cache-action@v1
env:
ATLAN_BASE_URL: ${{ secrets.ATLAN_BASE_URL }}
ATLAN_API_KEY: ${{ secrets.ATLAN_API_KEY }}
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
with:
arguments: -PintegrationTests integration-tests:test --tests "com.atlan.java.sdk.${{ matrix.tests }}"
- if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.tests }}
path: integration-tests/${{ matrix.tests }}.log
list-packages:
runs-on: ubuntu-latest
outputs:
tests: ${{ steps.test-directories.outputs.tests }}
steps:
- uses: actions/checkout@v4
- name: List package tests
id: test-directories
run: |
pkgs=$(find samples/packages -type d -mindepth 1 -maxdepth 1 | sed -E 's|samples/packages/||' | grep -v 'build' | tr '\n' ' ')
json_pkgs=$(echo "${pkgs[@]}" | jq -R -c 'split(" ")[:-1]')
echo "tests=$json_pkgs" >> $GITHUB_OUTPUT
package-test:
needs:
- build
- list-packages
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
tests: ${{fromJson(needs.list-packages.outputs.tests)}}
concurrency:
group: ${{ matrix.tests }}
name: "Packages"
steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@main
- uses: actions/checkout@v4
# - name: Download artifacts
# uses: actions/download-artifact@v4
# with:
# name: build-artifacts
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Package tests
env:
ATLAN_BASE_URL: ${{ secrets.ATLAN_BASE_URL }}
ATLAN_API_KEY: ${{ secrets.ATLAN_API_KEY }}
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
JAVA_TOOL_OPTIONS: "-Djava.io.tmpdir=/home/runner"
uses: burrunan/gradle-cache-action@v1
with:
arguments: |
-PpackageTests
:samples:packages:${{ matrix.tests }}:test
- if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.tests }}
path: samples/packages/${{ matrix.tests }}/**/debug.log