Skip to content

Instantly share code, notes, and snippets.

@pjvds
Last active January 11, 2019 11:41
Show Gist options
  • Save pjvds/6008266 to your computer and use it in GitHub Desktop.
Save pjvds/6008266 to your computer and use it in GitHub Desktop.
A wercker.yml file that enables an virtual display at the beginning of the build. This should solve the following errors: * cannot connect to X server
box: wercker/ubuntu12.04-ruby1.9.3
services:
- wercker/postgresql
build:
# The steps that will be executed on build
steps:
- script:
name: Enable virtual display
code: |-
# Start xvfb which gives the context an virtual display
# which is required for tests that require an GUI
export DISPLAY=:99.0
start-stop-daemon --start --quiet --pidfile /tmp/xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1024x768x24 -ac +extension GLX +render -noreset
# Give xvfb time to start. 3 seconds is the default for all xvfb-run commands.
sleep 3
# Install (apt-get) packages
- install-packages:
packages: libqtwebkit-dev
# A step that executes `bundle install` command
- bundle-install
# A step that prepares the database.yml with settings from the database you defined in services
- rails-database-yml:
service: postgresql
# A custom script step, name value is used in the UI
# and the code value contains the command that get executed
- script:
name: echo ruby information
code: |
echo "ruby version $(ruby --version) running"
echo "from location $(which ruby)"
echo -p "gem list: $(gem list)"
#migrations
- script:
name: rake
code: bundle exec rake db:migrate RAILS_ENV=test
# Run forest Run
- script:
name: rspec
code: bundle exec rspec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment