Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excavator: Render CircleCI file using template specified in .circleci/template.sh #1384

Merged
merged 4 commits into from
Jun 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
version: 2.1
jobs:
compile:
docker: [{ image: 'circleci/openjdk:8u222-stretch-node' }]
docker: [{ image: 'circleci/openjdk:11-node' }]
resource_class: large
environment:
CIRCLE_TEST_REPORTS: /home/circleci/junit
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
paths: [ project, .gradle/init.gradle ]

check:
docker: [{ image: 'circleci/openjdk:8u222-stretch-node' }]
docker: [{ image: 'circleci/openjdk:11-node' }]
environment:
CIRCLE_TEST_REPORTS: /home/circleci/junit
CIRCLE_ARTIFACTS: /home/circleci/artifacts
Expand All @@ -75,7 +75,7 @@ jobs:
- store_artifacts: { path: ~/artifacts }

unit-test:
docker: [{ image: 'circleci/openjdk:8u222-stretch-node' }]
docker: [{ image: 'circleci/openjdk:11-node' }]
resource_class: large
environment:
CIRCLE_TEST_REPORTS: /home/circleci/junit
Expand All @@ -96,21 +96,29 @@ jobs:
- store_test_results: { path: ~/junit }
- store_artifacts: { path: ~/artifacts }

unit-test-11:

unit-test-14:
docker: [{ image: 'circleci/openjdk:11-node' }]
resource_class: large
environment:
CIRCLE_TEST_REPORTS: /home/circleci/junit
CIRCLE_ARTIFACTS: /home/circleci/artifacts
GRADLE_OPTS: -Dorg.gradle.jvmargs='-XX:MaxMetaspaceSize=256m' -Dorg.gradle.workers.max=4
_JAVA_OPTIONS: -XX:ActiveProcessorCount=4 -Xmx1177m -XX:MaxMetaspaceSize=512m -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts
JAVA_HOME: /opt/java14
steps:
- checkout
- run:
name: Install Java
command: |
sudo mkdir -p /opt/java && cd /opt/java && sudo chown -R circleci:circleci .
curl https://cdn.azul.com/zulu/bin/zulu14.28.21-ca-jdk14.0.1-linux_x64.tar.gz | tar -xzf - -C /opt/java
sudo ln -s /opt/java/zulu*/ /opt/java14
- restore_cache: { key: 'gradle-wrapper-v2-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
- restore_cache: { key: 'unit-test-11-gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
- restore_cache: { key: 'unit-test-14-gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
- run: ./gradlew --parallel --stacktrace --continue test -Pcom.palantir.baseline-error-prone.disable
- save_cache:
key: 'unit-test-11-gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}'
key: 'unit-test-14-gradle-cache-v2-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}'
paths: [ ~/.gradle/caches ]
- run:
command: mkdir -p ~/junit && find . -type f -regex ".*/build/.*TEST.*xml" -exec cp --parents {} ~/junit/ \;
Expand All @@ -119,7 +127,7 @@ jobs:
- store_artifacts: { path: ~/artifacts }

trial-publish:
docker: [{ image: 'circleci/openjdk:8u222-stretch-node' }]
docker: [{ image: 'circleci/openjdk:11-node' }]
environment:
CIRCLE_TEST_REPORTS: /home/circleci/junit
CIRCLE_ARTIFACTS: /home/circleci/artifacts
Expand All @@ -137,7 +145,7 @@ jobs:
- store_artifacts: { path: ~/artifacts }

publish:
docker: [{ image: 'circleci/openjdk:8u222-stretch-node' }]
docker: [{ image: 'circleci/openjdk:11-node' }]
environment:
CIRCLE_TEST_REPORTS: /home/circleci/junit
CIRCLE_ARTIFACTS: /home/circleci/artifacts
Expand Down Expand Up @@ -173,7 +181,7 @@ workflows:
requires: [ compile ]
filters: { tags: { only: /.*/ } }

- unit-test-11:
- unit-test-14:
filters: { tags: { only: /.*/ } }

- check:
Expand All @@ -188,5 +196,5 @@ workflows:
filters: { branches: { ignore: develop } }

- publish:
requires: [ unit-test, unit-test-11, check, trial-publish ]
requires: [ unit-test, unit-test-14, check, trial-publish ]
filters: { tags: { only: /.*/ }, branches: { only: develop } }
1 change: 1 addition & 0 deletions .circleci/template.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/usr/bin/env bash
export CIRCLECI_TEMPLATE=java-library-oss
export ONLY_11=true
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ package com.palantir.baseline
import java.time.LocalDate
import org.apache.commons.io.FileUtils
import org.gradle.testkit.runner.TaskOutcome
import spock.lang.IgnoreIf
import spock.lang.Unroll

@Unroll
@IgnoreIf({ Integer.parseInt(jvm.javaSpecificationVersion) >= 14 })
class BaselineFormatCopyrightIntegrationTest extends AbstractPluginTest {

def setup() {
Expand Down Expand Up @@ -125,7 +127,7 @@ class BaselineFormatCopyrightIntegrationTest extends AbstractPluginTest {
with('format').build()

then:
javaFile.text.startsWith(expected)
javaFile.text.contains(expected)

where:
copyrightType | input | expected | lang
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.palantir.baseline


import spock.lang.IgnoreIf
import spock.lang.Unroll

class BaselineIntegrationTest extends AbstractPluginTest {
Expand All @@ -34,6 +34,7 @@ class BaselineIntegrationTest extends AbstractPluginTest {
}

@Unroll("Can apply on #gradleVersion")
@IgnoreIf({ Integer.parseInt(jvm.javaSpecificationVersion) >= 14 })
def canApplyOnGradle() {
buildFile << standardBuildFile()
multiProject.addSubproject("java-project", "apply plugin: 'java'")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ package com.palantir.baseline

import nebula.test.IntegrationSpec
import nebula.test.functional.ExecutionResult
import spock.lang.IgnoreIf
import spock.lang.Unroll

@Unroll
@IgnoreIf({ Integer.parseInt(jvm.javaSpecificationVersion) >= 14 })
class JunitReportsPluginSpec extends IntegrationSpec {
private static final List<String> GRADLE_TEST_VERSIONS = ['5.6.4', '6.1']

Expand Down