Add ci builds
Some checks failed
moparisthebest/saturn-patch/pipeline/head There was a failure building this commit

This commit is contained in:
Travis Burtrum 2021-02-17 01:16:19 -05:00
parent 19e420221e
commit 79895059a1
2 changed files with 68 additions and 0 deletions

42
.ci/Jenkinsfile vendored Normal file
View File

@ -0,0 +1,42 @@
properties(
[
disableConcurrentBuilds()
]
)
node('linux && docker') {
try {
stage('Checkout') {
//branch name from Jenkins environment variables
echo "My branch is: ${env.BRANCH_NAME}"
// this doesn't grab tags pointing to this branch
//checkout scm
// this hack does... https://issues.jenkins.io/browse/JENKINS-45164
checkout([
$class: 'GitSCM',
branches: [[name: 'refs/heads/'+env.BRANCH_NAME]],
extensions: [[$class: 'CloneOption', noTags: false, shallow: false, depth: 0, reference: '']],
userRemoteConfigs: scm.userRemoteConfigs,
])
sh '''
set -euxo pipefail
git checkout "$BRANCH_NAME" --
git reset --hard "origin/$BRANCH_NAME"
'''
}
stage('Build + Deploy') {
sh 'curl --compressed -sL https://code.moparisthebest.com/moparisthebest/self-ci/raw/branch/master/build-ci.sh | bash'
}
currentBuild.result = 'SUCCESS'
} catch (Exception err) {
currentBuild.result = 'FAILURE'
} finally {
stage('Email') {
step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'admin.jenkins@moparisthebest.com', sendToIndividuals: true])
}
deleteDir()
}
}

26
.ci/build.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
set -exo pipefail
echo "starting build for TARGET $TARGET"
export CRATE_NAME=saturn-patch
# cross doesn't actually support stdin/stdout pipes for some reason, skip it for now
DISABLE_TESTS=1
SUFFIX=""
echo "$TARGET" | grep -E '^x86_64-pc-windows-gnu$' >/dev/null && SUFFIX=".exe"
cross rustc --bin saturn-patch --target $TARGET --release
# to check how they are built
file "target/$TARGET/release/saturn-patch$SUFFIX"
# if this commit has a tag, upload artifact to release
strip "target/$TARGET/release/saturn-patch$SUFFIX" || true # if strip fails, it's fine
mkdir -p release
mv "target/$TARGET/release/saturn-patch$SUFFIX" "release/saturn-patch-$TARGET$SUFFIX"
echo 'build success!'
exit 0