diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..c944ffa --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,32 @@ +pipeline { + agent any + + environment { + APP_SESSION_SECRET = '' + DB_NAME = 'url_shortener.db' + } + stages { + stage('Init') { + steps { + sh 'rbenv local 3.2.2' + script { + env.APP_SESSION_SECRET = sh(script: 'ruby secret.rb', returnStdout: true) + } + sh 'echo "ENV[\\\"APP_SESSION_SECRET\\\"] ||= $(ruby secret.rb)" > .env.rb' + sh 'echo "ENV[\\\"DB_NAME\\\"] ||= \\\"${DB_NAME}\\\"" >> .env.rb' + sh 'cat .env.rb' + } + } + stage('Build dependencies') { + steps { + sh 'bundle install' + sh 'sequel -m db/migrations sqlite://db/${DB_NAME}' + } + } + stage('Run tests') { + steps { + sh 'cucumber' + } + } + } +} diff --git a/README.md b/README.md index 7958b5a..8116855 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,8 @@ Roda, Falcon, Sequel, and SQLite the point of this project is to quickly build something and work on continuous deployment while making small refinements to the functional pieces. -the only outside piece of software that this project relies on is sqlite3. +the outside pieces of software that this project relies on are sqlite3 and pkgconf. + first you have to install the dependencies: diff --git a/secret.rb b/secret.rb new file mode 100644 index 0000000..2672149 --- /dev/null +++ b/secret.rb @@ -0,0 +1,2 @@ +require 'securerandom' +puts SecureRandom.base64(64).inspect()