Skip to content

Commit 039057e

Browse files
authored
Update the pipeline to release from tag, run benchmarks
* Extract artifact publishing into a separate job that runs on tag push * Run benchmarks conditionally on a parameter (currently, must be invoked via API) * Use a next-generation build image (cimg) See https://app.circleci.com/pipelines/github/open-toast/protokt/415/workflows/6a8996a3-9aa8-4b84-adbf-a8885103ca13/jobs/461 for a sample execution with benchmarks.
1 parent c37626d commit 039057e

File tree

1 file changed

+56
-19
lines changed

1 file changed

+56
-19
lines changed

.circleci/config.yml

Lines changed: 56 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,66 @@
11
version: 2.1
22

3-
jobs:
4-
build:
3+
parameters:
4+
benchmarks:
5+
type: boolean
6+
default: false
7+
8+
executors:
9+
builder:
510
working_directory: ~/code
611
docker:
7-
- image: circleci/openjdk:11.0.3-jdk-stretch
12+
- image: cimg/openjdk:11.0
813
environment:
914
JAVA_OPTS: "-XX:MaxRAMPercentage=50"
1015
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
11-
steps:
12-
- checkout
1316

17+
commands:
18+
read_cache:
19+
steps:
1420
- restore_cache:
1521
key: v1-gradle-wrapper-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
1622
- restore_cache:
1723
key: v1-gradle-cache-{{ checksum "build.gradle.kts" }}
1824

25+
write_cache:
26+
steps:
27+
- save_cache:
28+
paths:
29+
- ~/.gradle/wrapper
30+
key: v1-gradle-wrapper-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
31+
- save_cache:
32+
paths:
33+
- ~/.gradle/caches
34+
key: v1-gradle-cache-{{ checksum "build.gradle.kts" }}
35+
36+
jobs:
37+
build:
38+
executor: builder
39+
steps:
40+
- checkout
41+
- read_cache
42+
1943
- run:
20-
name: build and test
44+
name: Build and test
2145
command: ./gradlew clean check publishToIntegrationRepository --stacktrace
2246

2347
- run:
24-
name: integration tests with kotlin 1.3
48+
name: Integration tests with Kotlin 1.3
2549
command: cd gradle-plugin-integration-test && ./gradlew clean build --stacktrace
2650

2751
- run:
28-
name: integration tests with kotlin 1.4
52+
name: Integration tests with Kotlin 1.4
2953
command: cd gradle-plugin-integration-test && ./gradlew clean build -Dkotlin.version=1.4.10 -Dkotlin.api.version=1.4 --stacktrace
54+
55+
- when:
56+
condition:
57+
equal: [ true, << pipeline.parameters.benchmarks >> ]
58+
steps:
59+
run:
60+
name: Benchmarks
61+
command: ./gradlew benchmarks:run
3062

31-
- save_cache:
32-
paths:
33-
- ~/.gradle/wrapper
34-
key: v1-gradle-wrapper-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
35-
- save_cache:
36-
paths:
37-
- ~/.gradle/caches
38-
key: v1-gradle-cache-{{ checksum "build.gradle.kts" }}
63+
- write_cache
3964

4065
- run:
4166
name: Save test results
@@ -49,13 +74,25 @@ jobs:
4974
- store_artifacts:
5075
path: ~/test-results/junit
5176

77+
78+
release:
79+
executor: builder
80+
steps:
81+
- checkout
82+
- read_cache
5283
- run:
53-
name: Deploy (if release)
54-
command: "if [[ \"$CIRCLE_BRANCH\" == master ]]; then ./gradlew publishToRemote closeAndReleaseRepository publishPlugins -Dorg.gradle.internal.http.socketTimeout=120000 -Dorg.gradle.internal.network.retry.max.attempts=1 -Dorg.gradle.internal.publish.checksums.insecure=true; else echo skipping publishing; fi"
84+
name: Publish release
85+
command: "./gradlew publishToRemote closeAndReleaseRepository publishPlugins -Dorg.gradle.internal.http.socketTimeout=120000 -Dorg.gradle.internal.network.retry.max.attempts=1 -Dorg.gradle.internal.publish.checksums.insecure=true"
5586

5687
workflows:
5788
version: 2.1
5889
build:
5990
jobs:
60-
- build:
91+
- build
92+
- release:
6193
context: OSS
94+
filters:
95+
tags:
96+
only: /^\d+\.\d+\.\d+$/
97+
branches:
98+
ignore: /.*/

0 commit comments

Comments
 (0)