forked from amethyst/amethyst
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
151 lines (147 loc) · 5.52 KB
/
Jenkinsfile
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
pipeline {
agent none
stages {
stage("Pull new images") {
agent {
label 'docker'
}
steps {
sh 'docker pull amethystrs/builder-linux:stable'
sh 'docker pull amethystrs/builder-linux:nightly'
}
}
stage('Cargo Fmt') {
environment {
RUSTFLAGS = "-D warnings"
}
agent {
docker {
image 'amethystrs/builder-linux:stable'
label 'docker'
}
}
steps {
echo 'Checking formatting...'
sh 'cargo fmt -- --check'
}
}
stage('Cargo Check') {
parallel {
stage("stable") {
environment {
RUSTFLAGS = "-D warnings"
}
agent {
docker {
image 'amethystrs/builder-linux:stable'
label 'docker'
}
}
steps {
sh 'cargo update'
// Perform actual check
sh 'cargo check --all --all-targets --features "vulkan sdl_controller json saveload tiles"'
echo 'Running Cargo clippy...'
sh 'cargo clippy --all --all-targets --features "vulkan sdl_controller json saveload tiles"'
}
}
stage("nightly") {
environment {
RUSTFLAGS = "-D warnings"
}
agent {
docker {
image 'amethystrs/builder-linux:nightly'
label 'docker'
}
}
steps {
sh 'cargo update'
// Perform actual check
echo 'Running Cargo check...'
sh 'cargo check --all --all-targets --features "nightly vulkan sdl_controller json saveload tiles"'
}
}
}
}
// Separate stage for coverage to prevent race condition with the linux test stage (repo lock contention).
stage('Coverage') {
agent {
docker {
image 'amethystrs/builder-linux:stable'
args '--privileged'
label 'docker'
}
}
steps {
withCredentials([string(credentialsId: 'codecov_token', variable: 'CODECOV_TOKEN')]) {
echo 'Calculating code coverage...'
sh './scripts/coverage.sh'
echo "Uploading coverage..."
sh "curl -s https://codecov.io/bash | bash -s ./target/coverage/merged -t $CODECOV_TOKEN"
echo "Uploaded code coverage!"
}
}
}
stage('Run Tests') {
parallel {
stage("Test on Windows") {
environment {
CARGO_HOME = 'C:\\Users\\root\\.cargo'
RUSTUP_HOME = 'C:\\Users\\root\\.rustup'
}
agent {
label 'windows'
}
steps {
bat 'C:\\Users\\root\\.cargo\\bin\\cargo update'
echo 'Beginning tests...'
bat 'C:\\Users\\root\\.cargo\\bin\\cargo test --all --features "vulkan json saveload tiles"'
echo 'Tests done!'
}
}
stage("Test on Linux") {
agent {
docker {
image 'amethystrs/builder-linux:stable'
label 'docker'
}
}
steps {
echo 'Beginning tests...'
// Clean amethyst build artifacts so `mdbook test` does not fail on multiple
// built libraries found.
sh './scripts/book_library_clean.sh'
sh 'cargo test --all --features "vulkan sdl_controller json saveload"'
sh 'mdbook test -L ./target/debug/deps book'
echo 'Tests done!'
}
}
// macOS is commented out due to needing to upgrade the OS, but MacStadium did not do the original install with APFS so we cannot upgrade easily
// stage("Test on macOS") {
// environment {
// CARGO_HOME = '/Users/jenkins/.cargo'
// RUSTUP_HOME = '/Users/jenkins/.rustup'
// }
// agent {
// label 'mac'
// }
// steps {
// echo 'Beginning tests...'
// sh '/Users/jenkins/.cargo/bin/cargo test --all --features "metal"'
// echo 'Tests done!'
// }
// }
}
}
}
post {
always {
node('') {
echo 'Cleaning up workspace'
deleteDir()
echo 'Workspace cleaned!'
}
}
}
}