stages:
- test

.check: &check
  stage: test
  image: java:8-jdk-alpine
  script: |
    apk --update add bash libstdc++
    ./gradlew --no-daemon check
  artifacts:
    paths:
    - build/tmp
    expire_in: 1 day
    when: on_failure

check v3.0:
  <<: *check
  variables:
    GRADLE_VERSION_UNDER_TEST: '3.0'
    PERSISTENT_TEST_GRADLE_PROJECT_DIR: 'build/tmp'

check v3.1:
  <<: *check
  variables:
    GRADLE_VERSION_UNDER_TEST: '3.1'
    PERSISTENT_TEST_GRADLE_PROJECT_DIR: 'build/tmp'

check v3.2.1:
  <<: *check
  variables:
    GRADLE_VERSION_UNDER_TEST: '3.2.1'
    PERSISTENT_TEST_GRADLE_PROJECT_DIR: 'build/tmp'

check v3.3:
  <<: *check
  variables:
    GRADLE_VERSION_UNDER_TEST: '3.3'
    PERSISTENT_TEST_GRADLE_PROJECT_DIR: 'build/tmp'

check v3.4.1:
  <<: *check
  variables:
    GRADLE_VERSION_UNDER_TEST: '3.4.1'
    PERSISTENT_TEST_GRADLE_PROJECT_DIR: 'build/tmp'

stages:
- test

.check: &check
  stage: test
  image: java:8-jdk-alpine
  script: |
    apk --update add bash libstdc++
    ./gradlew --no-daemon check
  artifacts:
    name: '${CI_PROJECT_NAME}_${CI_BUILD_ID}'
    paths:
    - build/tmp
    expire_in: 1 day
    when: on_failure

check v3.0:
  <<: *check
  variables:
    GRADLE_VERSION_UNDER_TEST: '3.0'
    PERSISTENT_TEST_GRADLE_PROJECT_DIR: 'build/tmp'

check v3.1:
  <<: *check
  variables:
    GRADLE_VERSION_UNDER_TEST: '3.1'
    PERSISTENT_TEST_GRADLE_PROJECT_DIR: 'build/tmp'

check v3.2.1:
  <<: *check
  variables:
    GRADLE_VERSION_UNDER_TEST: '3.2.1'
    PERSISTENT_TEST_GRADLE_PROJECT_DIR: 'build/tmp'

check v3.3:
  <<: *check
  variables:
    GRADLE_VERSION_UNDER_TEST: '3.3'
    PERSISTENT_TEST_GRADLE_PROJECT_DIR: 'build/tmp'

check v3.4.1:
  <<: *check
  variables:
    GRADLE_VERSION_UNDER_TEST: '3.4.1'
    PERSISTENT_TEST_GRADLE_PROJECT_DIR: 'build/tmp'

Include project name and build number in artifact name
Include project name and build number in artifact name

Default artifacts' file name is `artifacts.zip` which makes it hard to
track when more than one such file is downloaded. Having build number
it's possible to track exact build and match content with script output.