Skip to content

Instantly share code, notes, and snippets.

Avatar
🈷️
https://e.printstacktrace.blog

Szymon Stepniak wololock

🈷️
https://e.printstacktrace.blog
View GitHub Profile
@wololock
wololock / Jenkinsfile.groovy
Last active Jun 24, 2020
Jenkins Pipeline with the parallel stages
View Jenkinsfile.groovy
pipeline {
agent any
stages {
stage("Deploy") {
parallel {
stage("dev") {
when {
beforeAgent true
expression {
@wololock
wololock / Jenkinsfile.groovy
Last active Jun 24, 2020
Jenkins Pipeline with matrix used for parallel deployments
View Jenkinsfile.groovy
pipeline {
agent any
stages {
stage("Deploy") {
matrix {
axes {
axis {
name "DEPLOY_ENVIRONMENT"
values "DEPLOY_DEV", "DEPLOY_STAGING", "DEPLOY_PROD"
View Jenkinsfile
stage("Build") {
steps {
sh "mvn clean install"
}
post {
always {
script {
try {
junit "**/target/surefire-reports/TEST-*.xml,**/target/failsafe-reports/*.xml"
} catch (e) {
View test.groovy
import groovy.transform.Field
@Field
def profiles = [
prod: ["master", /release\/.*/],
dev: ["develop", /PR-.*/]
]
String getProfileForBranchName(String branchName, String defaultProfile = "default") {
return profiles.findResult { profile, candidates -> candidates.any { branchName ==~ it } ? profile : null } ?: defaultProfile
View Jenkinsfile
#!groovy
pipeline {
agent any
stages {
stage("Test") {
when {
changeRequest target: "develop", branch: /^TEST-\d+$/, comparator: 'REGEXP'
}
View ProductSpec.groovy
package com.github.wololock.micronaut.products
import io.micronaut.context.annotation.Property
import io.micronaut.test.annotation.MicronautTest
import spock.lang.Specification
@MicronautTest(environments = ["test"])
class ProductSpec extends Specification {
@Property(name = "items")
@wololock
wololock / console.log
Created Jun 25, 2019
Groovy Trampoline Closure benchmark results (Groovy 3.0.0-beta-1)
View console.log
$ ./gradlew clean jmh --no-daemon
> Task :jmhRunBytecodeGenerator
Processing 0 classes from /home/wololock/workspace/groovy-closure-trampoline-example/build/classes/java/jmh with "reflection" generator
Processing 5 classes from /home/wololock/workspace/groovy-closure-trampoline-example/build/classes/groovy/jmh with "reflection" generator
Writing out Java source to /home/wololock/workspace/groovy-closure-trampoline-example/build/jmh-generated-sources and resources to /home/wololock/workspace/groovy-closure-trampoline-example/build/jmh-generated-resources
# Warmup Iteration 1: UTING [13s]
> Task :jmh
# JMH version: 1.21
# VM version: JDK 1.8.0_201, Java HotSpot(TM) 64-Bit Server VM, 25.201-b09
@wololock
wololock / console.log
Last active Jun 25, 2019
Groovy Trampoline Closure benchmark results (Groovy 2.5.7)
View console.log
$ ./gradlew clean jmh --no-daemon
> Task :jmhRunBytecodeGenerator
Processing 0 classes from /home/wololock/workspace/groovy-closure-trampoline-example/build/classes/java/jmh with "reflection" generator
Processing 5 classes from /home/wololock/workspace/groovy-closure-trampoline-example/build/classes/groovy/jmh with "reflection" generator
Writing out Java source to /home/wololock/workspace/groovy-closure-trampoline-example/build/jmh-generated-sources and resources to /home/wololock/workspace/groovy-closure-trampoline-example/build/jmh-generated-resources
# Warmup Iteration 1: UTING [6s]
> Task :jmh
# JMH version: 1.21
# VM version: JDK 1.8.0_201, Java HotSpot(TM) 64-Bit Server VM, 25.201-b09
View reflect-config.json
[
{
"name":"[Ljava.lang.Object;",
"allDeclaredFields":true,
"allDeclaredMethods":true
},
{
"name":"[Ljava.lang.String;",
"allDeclaredFields":true,
"allDeclaredMethods":true,
View qwe.groovy
def listA = ['ABC', 'DEF', 'GHI', 'JKL', 'MNO', 'PQR']
def listB = [1,2,1,1,1,1]
def pairs = [listA, listB].transpose()
def map = [:]
pairs.each{ map << (it as MapEntry) }
println(map)
You can’t perform that action at this time.