Skip to content

Commit

Permalink
feature(scripts): add run scripts for windows and linux
Browse files Browse the repository at this point in the history
Add scripts run-windows.cmd and run-linux to repository. The scripts execute cse-server-go and opens the default browser
on localhost:8000. Update Jenkinsfile to copy these scripts into the distribution folder. Fix Jenkinsfile lib path for
linux builds.

Closes #64
  • Loading branch information
Flakstad authored and Flakstad committed Mar 11, 2019
1 parent 1582c23 commit 9165f9a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
16 changes: 11 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pipeline {
CONAN_USER_HOME_SHORT = "${env.CONAN_USER_HOME}"
OSP_CONAN_CREDS = credentials('jenkins-osp-conan-creds')
}

tools {
go 'go-1.11.5'
//'com.cloudbees.jenkins.plugins.customtools.CustomTool' 'mingw-w64' awaiting fix in customToolsPlugin
Expand All @@ -35,7 +35,7 @@ pipeline {
projectName: 'open-simulation-platform/cse-client/master',
filter: 'resources/public/**/*',
target: 'src/cse-server-go')

dir ('src/cse-server-go') {
sh 'conan remote add osp https://osp-conan.azurewebsites.net/artifactory/api/conan/conan-local --force'
sh 'conan user -p $OSP_CONAN_CREDS_PSW -r osp $OSP_CONAN_CREDS_USR'
Expand All @@ -57,6 +57,9 @@ pipeline {
dir ('src/cse-server-go/dist/bin') {
sh 'cp -rf ../../cse-server-go.exe .'
}
dir ('src/cse-server-go/dist') {
sh 'cp -rf ../run-windows.cmd .'
}
}
}
stage ('Zip dist') {
Expand Down Expand Up @@ -107,7 +110,7 @@ pipeline {

environment {
GOCACHE = "/tmp/.gocache"
CGO_LDFLAGS = "-Wl,-rpath,\$ORIGIN/../lib"
CGO_LDFLAGS = "-Wl,-rpath,\$ORIGIN"
CONAN_USER_HOME = '/conan_repo'
CONAN_USER_HOME_SHORT = 'None'
OSP_CONAN_CREDS = credentials('jenkins-osp-conan-creds')
Expand All @@ -120,12 +123,12 @@ pipeline {
projectName: 'open-simulation-platform/cse-client/master',
filter: 'resources/public/**/*',
target: 'src/cse-server-go')

dir ('src/cse-server-go') {
sh 'conan remote add osp https://osp-conan.azurewebsites.net/artifactory/api/conan/conan-local --force'
sh 'conan user -p $OSP_CONAN_CREDS_PSW -r osp $OSP_CONAN_CREDS_USR'
sh 'conan install . -s build_type=Release -s compiler.libcxx=libstdc++11 -u'
sh 'patchelf --set-rpath \'$ORIGIN/../lib\' dist/lib/*'
sh 'patchelf --set-rpath \'$ORIGIN\' dist/lib/*'
}
}
}
Expand All @@ -142,6 +145,9 @@ pipeline {
dir ('src/cse-server-go/dist/bin') {
sh 'cp -rf ../../cse-server-go .'
}
dir ('src/cse-server-go/dist') {
sh 'cp -rf ../run-linux .'
}
}
}
stage ('Zip dist') {
Expand Down
3 changes: 3 additions & 0 deletions run-linux
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
xdg-open http://localhost:8000
./bin/cse-server-go
3 changes: 3 additions & 0 deletions run-windows.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off
start http://localhost:8000
start .\bin\cse-server-go.exe

0 comments on commit 9165f9a

Please sign in to comment.