aboutsummaryrefslogtreecommitdiffhomepage
path: root/assets/ci-config
blob: 6e94df680cd827106ac3bf55ed68c7f90f935989 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env groovy

/*
 * This Jenkinsfile is intended to run on https://ci.spacecdn.de and may fail anywhere else.
 * It makes assumptions about plugins being installed, labels mapping to nodes that can build what is needed, etc.
 */

def buildTypes = ['linux', 'windows']
def builds = [:]

//if(env.TAG_NAME) {
//	buildTypes.add("debian")
//}

buildTypes.each{
	builds["$it"] = {
		node() {
			skipDefaultCheckout()
			stage('Checkout') {
				checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [[$class: 'CloneOption', noTags: false, reference: '', shallow: false], [$class: 'CleanBeforeCheckout', deleteUntrackedNestedRepositories: true]], userRemoteConfigs: [[credentialsId: 'github_mm_key', url: 'https://github.com/cbdevnet/midimonster.git']]])
			}

			stage("$it Build"){
				sh label: "Build", script: "./assets/ci.sh --target=build-$it --deploy"
			}

			stage('Stash artifacts') {
				stash includes: "deployment/$it/*", name: "$it", allowEmpty: 'false'
			}
		}
	}
}

def deploy = {
	node(){
		skipDefaultCheckout()
		stage('Deploy') {
			buildTypes.each{
				unstash "$it"
			}
			archiveArtifacts artifacts: 'deployment/*/*', onlyIfSuccessful: true, fingerprint: true
		}
	}
}

builds.Test = {
	node() {
		skipDefaultCheckout()
		stage('Checkout') {
			checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [[$class: 'CloneOption', noTags: false, reference: '', shallow: false], [$class: 'CleanBeforeCheckout', deleteUntrackedNestedRepositories: true]], userRemoteConfigs: [[credentialsId: 'github_mm_key', url: 'https://github.com/cbdevnet/midimonster.git']]])
		}
		stage('Test') {
			catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
				sh label: "Check Spelling", script: './assets/ci.sh --target=check-spelling'
			}
			catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
				sh label: "Check Codespelling", script: './assets/ci.sh --target=check-codespelling'
			}
			catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
				sh label: "Analyze Complexity", script: './assets/ci.sh --target=analyze-complexity'
			}
			catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
				sh label: "Analyze Shellscripts", script: './assets/ci.sh --target=analyze-shellscript'
			}
			catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
				sh label: "Code Statistics", script: './assets/ci.sh --target=stats'
			}
		}
	}
}

parallel builds
deploy.call()