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

Dynamic CI jobs for examples #2677

Merged
merged 6 commits into from May 16, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-dind.yml
@@ -1,4 +1,4 @@
name: in-container
name: CI-DinD
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're not running "Docker-in-Docker", but mount the socket, hence "in-container" :) Maybe we can use "wormhole" or similar...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point


on:
pull_request: {}
Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/ci-examples.yml
@@ -0,0 +1,73 @@
name: CI-Examples

on:
pull_request: {}
push: { branches: [ master ] }

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

jobs:
find_gradle_jobs:
runs-on: ubuntu-18.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '1.8'
- name: Cache Gradle Home files
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-home-testmatrix-examples-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-home-testmatrix-examples-
${{ runner.os }}-gradle-home-
- id: set-matrix
working-directory: ./examples/
env:
# Since we override the tests executor,
# we should not push empty results to the cache
READ_ONLY_REMOTE_GRADLE_CACHE: true
run: |
TASKS=$(./gradlew --no-daemon --parallel -q testMatrix)
echo $TASKS
echo "::set-output name=matrix::{\"gradle_args\":$TASKS}"
check:
needs: find_gradle_jobs
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.find_gradle_jobs.outputs.matrix) }}
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '1.8'
- name: Cache Gradle Home files
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-home-examples-${{matrix.gradle_args}}_check-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-home-examples-${{matrix.gradle_args}}_check-
${{ runner.os }}-gradle-home-examples-${{matrix.gradle_args}}_check-
${{ runner.os }}-gradle-home-examples-
- name: Clear existing docker image cache
run: docker image prune -af
- name: Build and test Examples with Gradle (${{matrix.gradle_args}})
working-directory: ./examples/
run: |
./gradlew --no-daemon --continue --scan --info ${{matrix.gradle_args}}
- name: Aggregate Examples test reports with ciMate
if: always()
env:
CIMATE_PROJECT_ID: 2348n4vl
CIMATE_CI_KEY: "CI / ${{ runner.os }} / ${{matrix.gradle_args}}"
rnorth marked this conversation as resolved.
Show resolved Hide resolved
run: |
wget -q https://get.cimate.io/release/linux/cimate
chmod +x cimate
./cimate "**/TEST-*.xml"
27 changes: 0 additions & 27 deletions .github/workflows/ci.yml
Expand Up @@ -69,30 +69,3 @@ jobs:
wget -q https://get.cimate.io/release/linux/cimate
chmod +x cimate
./cimate "**/TEST-*.xml"
examples:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '1.8'
- name: Cache Gradle Home files
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-home-examples-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-home-examples-
- name: Build and test Examples with Gradle
working-directory: ./examples/
run: |
./gradlew --no-daemon --scan --info check
- name: Aggregate test reports with ciMate
if: always()
env:
CIMATE_PROJECT_ID: 2348n4vl
CIMATE_CI_KEY: examples
run: |
wget -q https://get.cimate.io/release/linux/cimate
chmod +x cimate
./cimate "**/TEST-*.xml"
5 changes: 5 additions & 0 deletions examples/build.gradle
@@ -1 +1,6 @@
// empty build.gradle for dependabot
apply from: "$rootDir/../gradle/ci-support.gradle"

subprojects {
apply plugin:"java"
}
17 changes: 16 additions & 1 deletion examples/settings.gradle
@@ -1,5 +1,20 @@
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.ch.myniva.gradle:s3-build-cache:0.10.0"
classpath "com.gradle.enterprise:com.gradle.enterprise.gradle.plugin:3.2.1"
}
}

apply from: "$rootDir/../gradle/remote-cache.gradle"

rootProject.name = 'testcontainers-examples'


includeBuild '..'

// explicit include to allow Dependabot to autodiscover subprojects
Expand All @@ -13,4 +28,4 @@ include 'singleton-container'
include 'spring-boot'
include 'cucumber'
include 'spring-boot-kotlin-redis'
include 'spock'
include 'spock'
6 changes: 3 additions & 3 deletions gradle/ci-support.gradle
Expand Up @@ -28,9 +28,9 @@ gradle.taskGraph.whenReady {
subproject.tasks.withType(Test).all {
testExecuter([execute: { spec, processor -> }, stopNow:{}] as org.gradle.api.internal.tasks.testing.TestExecuter)
}
subproject.tasks.findByName("shadowJar").enabled = false
subproject.tasks.findByName("javadoc").enabled = false
subproject.tasks.findByName("delombok").enabled = false
subproject.tasks.findByName("shadowJar")?.enabled = false
subproject.tasks.findByName("javadoc")?.enabled = false
subproject.tasks.findByName("delombok")?.enabled = false
subproject.tasks.findByName("japicmp")?.enabled = false
}
}
Expand Down
34 changes: 34 additions & 0 deletions gradle/remote-cache.gradle
@@ -0,0 +1,34 @@
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.ch.myniva.gradle:s3-build-cache:0.10.0"
classpath "com.gradle.enterprise:com.gradle.enterprise.gradle.plugin:3.2.1"
}
}

apply plugin: 'ch.myniva.s3-build-cache'

ext.isMasterBuild = false ||
(System.getenv("GITHUB_REF") == "refs/heads/master") ||
(System.getenv("BUILD_SOURCEBRANCHNAME") == "master")

buildCache {
local {
enabled = !isMasterBuild
}

remote(ch.myniva.gradle.caching.s3.AwsS3BuildCache) {
endpoint = 'fra1.digitaloceanspaces.com'
region = 'fra1'
bucket = 'testcontainers'
path = 'cache'
push = isMasterBuild && !System.getenv("READ_ONLY_REMOTE_GRADLE_CACHE")
headers = [
'x-amz-acl': 'public-read'
]
}
}
23 changes: 1 addition & 22 deletions settings.gradle
Expand Up @@ -10,30 +10,9 @@ buildscript {
}
}

apply plugin: 'ch.myniva.s3-build-cache'
apply from: "$rootDir/gradle/remote-cache.gradle"
apply plugin: 'com.gradle.enterprise'

ext.isMasterBuild = false ||
(System.getenv("GITHUB_REF") == "refs/heads/master") ||
(System.getenv("BUILD_SOURCEBRANCHNAME") == "master")

buildCache {
local {
enabled = !isMasterBuild
}

remote(ch.myniva.gradle.caching.s3.AwsS3BuildCache) {
endpoint = 'fra1.digitaloceanspaces.com'
region = 'fra1'
bucket = 'testcontainers'
path = 'cache'
push = isMasterBuild && !System.getenv("READ_ONLY_REMOTE_GRADLE_CACHE")
headers = [
'x-amz-acl': 'public-read'
]
}
}

rootProject.name = 'testcontainers-java'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be sure - you just moved these lines without changing them, right? Or was it done by accident and we should probably revert it? :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved deliberately; I'm not sure why but it feels right to have these elements near the top of the file, and leave the cache/buildscan related parts at the bottom.


include "bom"
Expand Down