-
Notifications
You must be signed in to change notification settings - Fork 770
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding vagrant setup for ycmd development
- Loading branch information
Showing
5 changed files
with
181 additions
and
0 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
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,20 @@ | ||
# Setting up for ycmd development | ||
|
||
1. Install [Vagrant][]. | ||
2. `cd` into the folder where you checked out ycmd. | ||
3. `$ vagrant up && vagrant ssh`. This will take a while because the VM is being | ||
built and set up. Only needs to happen once though. | ||
4. You are now in the VM. Run the tests with `$ ./run_tests.sh`. | ||
5. Hack away. When done, exit the ssh connection with `exit`. | ||
6. `$ vagrant suspend` so that you can quickly get back to hacking later. | ||
7. Later on: `$ vagrant resume && vagrant ssh`. This will be _much_ faster. | ||
|
||
That's it! | ||
|
||
You can switch between Python versions with `pyenv global 2.6.6` and `pyenv | ||
global 3.3.0`. | ||
|
||
If you ever feel like you've screwed up the VM, just kill it with | ||
`vagrant destroy` and then run `vagrant up` again to get to a clean state. | ||
|
||
[vagrant]: https://www.vagrantup.com/ |
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,20 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
Vagrant.configure(2) do |config| | ||
# TODO: update to xenial64 when that comes out | ||
config.vm.box = "ubuntu/trusty64" | ||
|
||
# On startup, run our bootstrap script to setup the VM | ||
config.vm.provision :shell, :path => "vagrant_bootstrap.sh" | ||
|
||
config.vm.provider "virtualbox" do |v| | ||
# MAGIC for faster guest networking | ||
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] | ||
v.customize ["modifyvm", :id, "--natdnsproxy1", "on"] | ||
v.customize ["modifyvm", :id, "--nictype1", "virtio"] | ||
|
||
v.memory = 2048 | ||
v.cpus = 2 | ||
end | ||
end |
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,130 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Don't forget, this file needs to be idempotent, i.e. running it multiple times | ||
# in a row leaves the system in the same state as if it were run only once. | ||
|
||
####################### | ||
# ENV VAR SETUP | ||
####################### | ||
|
||
# Makes apt-get STFU about pointless nonsense | ||
export DEBIAN_FRONTEND=noninteractive | ||
|
||
# For pyenv Python building | ||
export CFLAGS='-O2' | ||
|
||
|
||
####################### | ||
# APT-GET INSTALL | ||
####################### | ||
|
||
apt-get update | ||
apt-get -yqq dist-upgrade | ||
apt-get install -yqq python-dev | ||
apt-get install -yqq python-setuptools | ||
apt-get install -yqq python3 | ||
apt-get install -yqq python3-dev | ||
apt-get install -yqq python3-setuptools | ||
apt-get install -yqq build-essential | ||
apt-get install -yqq cmake | ||
apt-get install -yqq git | ||
apt-get install -yqq golang | ||
apt-get install -yqq mono-complete | ||
|
||
# These two are for pyopenssl | ||
apt-get install -yqq libffi-dev | ||
apt-get install -yqq libssl-dev | ||
|
||
# These are Python build deps (though it depends on Python version). We need | ||
# them because pyenv builds Python. | ||
apt-get install -yqq libssl-dev | ||
apt-get install -yqq zlib1g-dev | ||
apt-get install -yqq libbz2-dev | ||
apt-get install -yqq libreadline-dev | ||
apt-get install -yqq libsqlite3-dev | ||
apt-get install -yqq wget | ||
apt-get install -yqq curl | ||
apt-get install -yqq llvm | ||
apt-get install -yqq libncurses5-dev | ||
apt-get install -yqq libncursesw5-dev | ||
|
||
|
||
####################### | ||
# PIP SETUP | ||
####################### | ||
|
||
curl -sOL https://bootstrap.pypa.io/get-pip.py | ||
python get-pip.py | ||
|
||
|
||
####################### | ||
# PYTHON LIBS | ||
####################### | ||
|
||
# This is needed to prevent InsecurePlatformWarning from showing up AFTER this | ||
# stuff is installed. | ||
pip install --upgrade pyopenssl ndg-httpsclient pyasn1 | ||
pip install -r /vagrant/test_requirements.txt | ||
pip install coveralls | ||
|
||
|
||
####################### | ||
# NODEJS SETUP & LIBS | ||
####################### | ||
|
||
apt-get install -yqq nodejs | ||
|
||
# Needed so that the node binary is named 'node' and not 'nodejs'; necessary | ||
# because of scripts that call 'node'. | ||
apt-get install -yqq nodejs-legacy | ||
apt-get install -yqq npm | ||
|
||
npm install -g typescript | ||
|
||
|
||
####################### | ||
# RUST SETUP | ||
####################### | ||
|
||
# multirust installation | ||
echo "Installing multirust" | ||
curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh \ | ||
| sh -s -- --yes >/dev/null 2>&1 | ||
|
||
# Needs to run as vagrant user otherwise it only sets up a Rust toolchain for | ||
# root, which doesn't do us any good. | ||
su - vagrant -c "multirust default stable 2>/dev/null" | ||
|
||
|
||
####################### | ||
# PYENV SETUP | ||
####################### | ||
|
||
git clone https://github.com/yyuu/pyenv.git /home/vagrant/.pyenv | ||
chown -R vagrant:vagrant /home/vagrant/.pyenv | ||
|
||
# Sourcing .profile to determine has provisioning already been done. If it has, | ||
# then we don't re-add setup code. | ||
source /home/vagrant/.profile | ||
if [ -z "$PROVISIONING_DONE" ]; then | ||
echo 'export PROVISIONING_DONE=true' >> /home/vagrant/.profile | ||
echo 'export PYENV_ROOT="/home/vagrant/.pyenv"' >> /home/vagrant/.profile | ||
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> /home/vagrant/.profile | ||
echo 'eval "$(pyenv init -)"' >> /home/vagrant/.profile | ||
echo 'cd /vagrant' >> /home/vagrant/.profile | ||
|
||
# In case we just created the file. | ||
chown vagrant:vagrant /home/vagrant/.profile | ||
|
||
# We need the newly-added commands from .profile in the current shell to run | ||
# pyenv. | ||
source /home/vagrant/.profile | ||
|
||
pyenv install 2.6.6 | ||
pyenv install 3.3.0 | ||
|
||
# Avoid relying on the system python at all. Devs using some other | ||
# python is perfectly fine, but let's use a supported version by default. | ||
echo 'pyenv global 2.6.6' >> /home/vagrant/.profile | ||
fi | ||
|