Skip to content
This repository was archived by the owner on Oct 4, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .ci/jenkins/build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
setx PATH "%PATH%;%USERPROFILE%\.cargo\bin"
set PATH="%PATH%;%USERPROFILE%\.cargo\bin"
%USERPROFILE%\.cargo\bin\cargo build
6 changes: 6 additions & 0 deletions .ci/jenkins/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -e
set -x

source $HOME/.cargo/env
cargo $@ build
7 changes: 7 additions & 0 deletions .ci/jenkins/install_rust.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
if (Test-Path -Path C:\Users\jenkins\.cargo\bin\rustup.exe) {
exit
}

$client = new-object System.Net.WebClient
$client.DownloadFile('https://win.rustup.rs', "$pwd\rustup-init.exe")
.\rustup-init.exe -y
24 changes: 24 additions & 0 deletions .ci/jenkins/install_rust.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

# Fail fast if any commands exists with error
set -e

# Print all executed commands
set -x

# Download rustup script and execute it
curl https://sh.rustup.rs -sSf > ./rustup.sh
chmod +x ./rustup.sh
./rustup.sh -y

# Load new environment
source $HOME/.cargo/env

# Install nightly and beta toolchains, but set stable as a default
rustup install nightly
rustup install beta
rustup default stable

# Install aux components, clippy for linter, rustfmt for formatting
rustup component add clippy
rustup component add rustfmt
3 changes: 3 additions & 0 deletions .ci/jenkins/test.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
setx PATH "%PATH%;%USERPROFILE%\.cargo\bin"
set PATH="%PATH%;%USERPROFILE%\.cargo\bin"
%USERPROFILE%\.cargo\bin\cargo test --all
6 changes: 6 additions & 0 deletions .ci/jenkins/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -e
set -x

source $HOME/.cargo/env
cargo $@ test --all
145 changes: 145 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
pipeline {
agent none
stages {
stage('Install Rust') {
parallel {
stage('macos') {
agent { label 'macos' }
steps {
sh './.ci/jenkins/install_rust.sh'
}
}
stage('linux') {
agent { label 'linux' }
steps {
sh './.ci/jenkins/install_rust.sh'
}
}
stage('windows') {
agent { label 'windows' }
steps {
powershell '& ./.ci/jenkins/install_rust.ps1'
}
}
}
}
stage('Build') {
parallel {
stage('macos') {
agent {
label 'macos'
}
stages {
stage('stable') {
steps {
sh './.ci/jenkins/build.sh'
}
}
stage('beta') {
steps {
sh './.ci/jenkins/build.sh +beta'
}
}
stage('nightly') {
steps {
sh './.ci/jenkins/build.sh +nightly'
}
}
}
}
stage('linux') {
agent {
label 'linux'
}
stages {
stage('stable') {
steps {
sh './.ci/jenkins/build.sh'
}
}
stage('beta') {
steps {
sh './.ci/jenkins/build.sh +beta'
}
}
stage('nightly') {
steps {
sh './.ci/jenkins/build.sh +nightly'
}
}
}
}
stage('windows') {
agent {
label 'windows'
}
stages {
stage('stable') {
steps {
bat 'call ./.ci/jenkins/build.bat'
}
}
}
}
}
}
stage('Test') {
parallel {
stage('macos') {
agent {
label 'macos'
}
steps {
sh './.ci/jenkins/test.sh'
}
}
stage('linux') {
agent {
label 'linux'
}
steps {
sh './.ci/jenkins/test.sh'
}
}
stage('windows') {
agent {
label 'windows'
}
steps {
bat 'call ./.ci/jenkins/test.bat'
}
}
}
}
stage('Lint') {
agent { node { label 'macos' } }
steps {
sh 'cargo check 2>&1 | tee rustc.build_log'
sh 'cargo clean'
sh 'cargo clippy 2>&1 | tee clippy.build_log'
sh 'if grep -q "^error" clippy.build_log; then echo "clippy found a severe error"; exit 1; fi'
}
post {
always {
script {
recordIssues enabledForFailure: true,
qualityGates: [[threshold: 10, type: 'TOTAL', unstable: true]],
healthy: 5, unhealthy: 20, minimumSeverity: 'HIGH',
tools: [
groovyScript(parserId: 'clippy-warnings', pattern: "clippy.build_log", reportEncoding:'UTF-8'),
groovyScript(parserId: 'rustc-warnings', pattern: "rustc.build_log", reportEncoding:'UTF-8')
]
}
}
}
}
/* stage('Rustfmt') {
agent {
label 'macos'
}
steps {
sh 'cargo fmt -- --check'
}
} */
}
}