# This config was automatically generated from your source code
# Stacks detected: cicd:github-actions:.github/workflows,deps:java:.,deps:python:.,tool:gradle:
version: 2.1
orbs:
  python: circleci/python@2
jobs:
  test-java:
    docker:
      - image: cimg/openjdk:17.0
    steps:
      - checkout
      - run:
          name: Calculate cache key
          command: |-
            find . -name 'pom.xml' -o -name 'gradlew*' -o -name '*.gradle*' | \
                    sort | xargs cat > /tmp/CIRCLECI_CACHE_KEY
      - restore_cache:
          key: cache-{{ checksum "/tmp/CIRCLECI_CACHE_KEY" }}
      - run:
          command: ./gradlew check
      - store_test_results:
          path: build/test-results
      - save_cache:
          key: cache-{{ checksum "/tmp/CIRCLECI_CACHE_KEY" }}
          paths:
            - ~/.gradle/caches
      - store_artifacts:
          path: build/reports
  test-python:
    # Install dependencies and run tests
    docker:
      - image: cimg/python:3.8-node
    steps:
      - checkout
      - python/install-packages
      - run:
          name: Run tests
          command: pytest --junitxml=junit.xml || ((($? == 5)) && echo 'Did not find any tests to run.')
      - store_test_results:
          path: junit.xml
  deploy:
    # This is an example deploy job, not actually used by the workflow
    docker:
      - image: cimg/base:stable
    steps:
      # Replace this with steps to deploy to users
      - run:
          name: deploy
          command: '#e.g. ./deploy.sh'
      - run:
          name: found github actions config
          command: ':'
workflows:
  build-and-test:
    jobs:
      - test-java
      - test-python
    # - deploy:
    #     requires:
    #       - test-java
    #       - test-python
