Skip to content

Commit 80e9b4e

Browse files
committed
Set up Packer and Travis build.
1 parent f573423 commit 80e9b4e

File tree

3 files changed

+116
-0
lines changed

3 files changed

+116
-0
lines changed

.travis.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#
2+
# There's no way to use VirtualBox inside Travis-CI.
3+
# This file was an attempt in case Travis-CI did,
4+
# and it will be modified accordingly if a working way is found.
5+
# In the meantime, Travis-CI is disabled, and this file stands as more of a "how to"
6+
# for contributors wanting to make a testing environment.
7+
#
8+
language: php
9+
php:
10+
- 5.3.3
11+
- 5.3
12+
- 5.4.0
13+
- 5.4
14+
- 5.5.0
15+
- 5.5
16+
- 5.6.0
17+
# There are some known issues with streaming in the latest 5.6 versions.
18+
#- 5.6
19+
env:
20+
- ROS_VERSION=6.29.1 ROS_HASH=b8f3c93d9f139ee0deba74088c3ceab9
21+
addons:
22+
hosts:
23+
- 192.168.56.101 ros.example.com
24+
- 127.0.0.1 invalid.ros.example.com
25+
- 192.168.200.1 silent.ros.example.com
26+
before_install:
27+
- sudo apt-get update
28+
- sudo apt-get install unzip
29+
- sudo apt-get install gdebi-core
30+
- wget -O ~/vbox.deb http://download.virtualbox.org/virtualbox/4.3.28/virtualbox-4.3_4.3.28-100309~Ubuntu~precise_i386.deb
31+
- wget -O ~/packer.zip https://dl.bintray.com/mitchellh/packer/packer_0.7.5_linux_amd64.zip
32+
install:
33+
# Install Packer
34+
- unzip ~/packer.zip -d ~/packer
35+
- export PATH=$PATH:~/packer
36+
# Install Apache
37+
- sudo apt-get install apache2
38+
# Install VirtualBox
39+
- sudo gdebi ~/vbox.deb
40+
before_script:
41+
# Setup VM
42+
- cd tests/vm
43+
- packer build -var "v=${ROS_VERSION}" -var "h=${ROS_HASH}" RouterOS.packer.json
44+
- VBoxManage register output-virtualbox-iso/RouterOS-${ROS_VERSION}.ova
45+
- cd ../..
46+
# Setup PHP dependencies
47+
- composer self-update
48+
- composer require pear2/net_transmitter:dev-develop
49+
- composer install
50+
# Configure Apache
51+
- echo "Listen 8728,8729" >> /etc/apache2/ports.conf
52+
script:
53+
- sudo service apache2 restart
54+
- VBoxManage startvm --type=headless "RouterOS-${ROS_VERSION}" &
55+
- sleep 15
56+
- cd tests
57+
- ../vendor/bin/phpunit

tests/vm/RouterOS.packer.json

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"variables": {
3+
"v": null,
4+
"h": null
5+
},
6+
"builders": [
7+
{
8+
"type": "virtualbox-iso",
9+
"headless": true,
10+
"vm_name": "RouterOS-{{user `v`}}",
11+
"guest_os_type": "Other",
12+
"disk_size": "1000",
13+
"vboxmanage": [
14+
["modifyvm", "{{.Name}}", "--memory", "128"],
15+
["modifyvm", "{{.Name}}", "--acpi", "on"],
16+
["modifyvm", "{{.Name}}", "--ioapic", "on"],
17+
["modifyvm", "{{.Name}}", "--hpet", "on"],
18+
["modifyvm", "{{.Name}}", "--rtcuseutc", "on"],
19+
["modifyvm", "{{.Name}}", "--pae", "on"],
20+
["modifyvm", "{{.Name}}", "--usb", "on"],
21+
["modifyvm", "{{.Name}}", "--usbehci", "off"],
22+
["modifyvm", "{{.Name}}", "--uart1", "0x3F8", "4"],
23+
24+
["modifyvm", "{{.Name}}", "--nic2", "nat"],
25+
["modifyvm", "{{.Name}}", "--cableconnected2", "on"],
26+
["modifyvm", "{{.Name}}", "--nic3", "null"],
27+
["modifyvm", "{{.Name}}", "--cableconnected3", "off"]
28+
],
29+
"iso_url": "http://download2.mikrotik.com/routeros/{{user `v`}}/mikrotik-{{user `v`}}.iso",
30+
"iso_checksum_type": "md5",
31+
"iso_checksum": "{{user `h`}}",
32+
"http_directory": ".",
33+
"boot_command": [
34+
"ainy<wait10><enter>",
35+
"<wait10><wait10><wait10><wait10>",
36+
"admin<enter><wait>",
37+
"<enter><wait>",
38+
"<enter><wait>",
39+
"/ip dhcp-client add disabled=no interface=ether1<enter>",
40+
"<wait5>",
41+
42+
"/tool fetch url=\"http://{{ .HTTPIP }}:{{ .HTTPPort }}/RouterOS_SETTINGS.rsc\" keep-result=yes dst-path=\"RouterOS_SETTINGS.rsc\"<enter>",
43+
"<wait5>",
44+
"/import R<tab><enter>",
45+
"<wait5>"
46+
],
47+
"guest_additions_mode": "disable",
48+
"ssh_username": "admin",
49+
"ssh_password": "",
50+
"ssh_wait_timeout": "80s",
51+
"vboxmanage_post": [
52+
["modifyvm", "{{.Name}}", "--nic1", "hostonly"],
53+
["modifyvm", "{{.Name}}", "--hostonlyadapter1", "VirtualBox Host-Only Ethernet Adapter"],
54+
["modifyvm", "{{.Name}}", "--cableconnected1", "on"]
55+
],
56+
"format": "ova"
57+
}
58+
]
59+
}
File renamed without changes.

0 commit comments

Comments
 (0)