Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: update CI to use shared jenkins pipeline
- Loading branch information
1 parent
73253fb
commit 624fa27
Showing
4 changed files
with
59 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,15 @@ | ||
#!/usr/bin/env groovy | ||
|
||
pipeline { | ||
|
||
agent { | ||
label 'golang-alpha' | ||
} | ||
|
||
stages { | ||
stage('Checkout') { | ||
steps { | ||
checkout scm | ||
} | ||
} | ||
|
||
stage('Test') { | ||
environment { | ||
CODECOV_TOKEN = credentials('codecov-token') | ||
} | ||
steps { | ||
container('golang'){ | ||
sh 'CGO_ENABLED=0 go test -coverprofile=coverage.txt -covermode=atomic ./sdk/...' | ||
sh 'curl -s https://codecov.io/bash | bash -s - -t ${CODECOV_TOKEN}' | ||
sh 'rm coverage.txt' | ||
} | ||
} | ||
} | ||
|
||
stage('Lint') { | ||
steps { | ||
container('golang'){ | ||
sh 'golint -set_exit_status ./sdk/... ./examples/...' | ||
} | ||
} | ||
} | ||
|
||
stage('Build') { | ||
steps { | ||
container('golang'){ | ||
// Build the SDK project | ||
sh 'go build -v ./sdk' | ||
|
||
// Build the SDK example plugins | ||
sh 'for d in examples/*/; do cd $d; if [ "$d" != "examples/c_plugin/" ]; then go build -v -o plugin; fi ; cd ../.. ; done' | ||
|
||
// Check that the example plugins dry-run successfully | ||
sh 'for d in examples/*/; do if [ "$d" != "examples/c_plugin/" ]; then cd $d; if [ ! -f "plugin" ]; then echo "plugin binary not found"; fi; if ! ./plugin --dry-run; then exit 1; fi; cd ../.. ; fi ; done' | ||
} | ||
} | ||
} | ||
|
||
stage('Tagged Release') { | ||
when { | ||
buildingTag() | ||
} | ||
environment { | ||
GITHUB_TOKEN = credentials('vio-bot-gh-token') | ||
} | ||
steps { | ||
container('golang') { | ||
withDockerRegistry(registry: [credentialsId: 'vio-docker-hub']) { | ||
sh 'goreleaser release --rm-dist' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
// Include this shared CI repository to load script helpers and libraries. | ||
library identifier: 'vapor@1.0.3', retriever: modernSCM([ | ||
$class: 'GitSCMSource', | ||
remote: 'https://github.com/vapor-ware/ci-shared.git', | ||
credentialsId: 'vio-bot-gh', | ||
]) | ||
|
||
|
||
golangPipeline([ | ||
'image': 'vaporio/emulator-plugin', | ||
'skipSetup': true, | ||
'publishLatest': false, | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env bash | ||
|
||
# | ||
# Build the examples included in the repository. | ||
# | ||
# This script is used by CI as a means to easily test that all the example | ||
# plugins can be successfully built. | ||
# | ||
# This should be run from the project root directory. | ||
# | ||
|
||
for d in examples/*/ ; do \ | ||
echo "\n\033[32m$d\033[0m" ; \ | ||
cd $d ; \ | ||
go build -v -o plugin ; \ | ||
cd ../.. ; \ | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env bash | ||
|
||
# | ||
# Run the example plugins included in the repository. | ||
# | ||
# This script is used by CI as a means to easily test that all the example | ||
# plugins (dry)run as expected. This requires the plugins to be built first. | ||
# | ||
# This should be run from the project root directory. | ||
# | ||
|
||
for d in examples/*/ ; do \ | ||
echo "\n\033[32m$d\033[0m" ; \ | ||
cd $d ; \ | ||
if [ ! -f "plugin" ]; then echo "\033[31mplugin binary not found\033[0m"; fi; \ | ||
if ! ./plugin --dry-run; then exit 1; fi; \ | ||
cd ../.. ; \ | ||
done |