Skip to content
This repository was archived by the owner on Dec 9, 2019. It is now read-only.

Commit 012d9aa

Browse files
committed
Merge branch 'TheNodi-vagrant_testing'
[skip ci] merge vagrant testing
2 parents 7ae6a45 + 1bed7ec commit 012d9aa

24 files changed

+678
-5
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,4 @@ script:
111111
- if [[ -n $distro ]]; then docker exec -it $CONTAINER_ID /prepare.sh; fi
112112

113113
# Run functional tests
114-
- if [[ -n $distro ]]; then docker exec -it -u valet $CONTAINER_ID /workspace/tests/Acceptance/docker.sh; fi
114+
- if [[ -n $distro ]]; then docker exec -it -u valet $CONTAINER_ID /workspace/tests/Acceptance/docker.sh; fi

develop

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
#!/bin/bash
2+
3+
VAGRANT_FOLDER="./tests/Acceptance/Vagrant"
4+
5+
if [ $# -gt 0 ]; then
6+
7+
# Spin up given development environment
8+
if [ "$1" == "up" ]; then
9+
cd "$VAGRANT_FOLDER/$2" && \
10+
shift 2 && \
11+
VALET_ENVIRONMENT=development vagrant up "$@"
12+
13+
# SSH into the given development environment
14+
elif [ "$1" == "ssh" ]; then
15+
cd "$VAGRANT_FOLDER/$2" && \
16+
shift 2 && \
17+
vagrant ssh "$@"
18+
19+
# Switch off given development environment
20+
elif [ "$1" == "down" ]; then
21+
cd "$VAGRANT_FOLDER/$2" && \
22+
shift 2 && \
23+
vagrant halt "$@"
24+
25+
# Destroy given development environment
26+
elif [ "$1" == "destroy" ]; then
27+
cd "$VAGRANT_FOLDER/$2" && \
28+
shift 2 && \
29+
vagrant destroy "$@"
30+
31+
# Destroy all development environments
32+
elif [ "$1" == "destroy-all" ]; then
33+
for DIRECTORY in `find $VAGRANT_FOLDER -maxdepth 1 -type d`; do
34+
if [[ "$DIRECTORY" != $VAGRANT_FOLDER ]]; then
35+
./develop destroy ${DIRECTORY##*/} -f
36+
fi
37+
done
38+
39+
# Run Acceptance tests against given environment
40+
elif [ "$1" == "test" ]; then
41+
./develop up $2 && \
42+
./develop ssh $2 --command "bash ~/cpriego-valet-linux/tests/Acceptance/vagrant.sh"
43+
44+
# Run Acceptance tests against ALL environments
45+
elif [ "$1" == "test-all" ]; then
46+
for DIRECTORY in `find $VAGRANT_FOLDER -maxdepth 1 -type d`; do
47+
if [[ "$DIRECTORY" != $VAGRANT_FOLDER ]]; then
48+
echo -e "\033[44m ${DIRECTORY##*/} \033[0m"
49+
50+
./develop test ${DIRECTORY##*/} && \
51+
./develop down ${DIRECTORY##*/}
52+
fi
53+
done
54+
55+
# Run Acceptance tests against ALL environments in parallel
56+
elif [ "$1" == "test-all-parallel" ]; then
57+
for DIRECTORY in `find $VAGRANT_FOLDER -maxdepth 1 -type d`; do
58+
if [[ "$DIRECTORY" != $VAGRANT_FOLDER ]]; then
59+
gnome-terminal --tab \
60+
--command="bash -c \"./develop test ${DIRECTORY##*/} && ./develop down ${DIRECTORY##*/}; read\""
61+
fi
62+
done
63+
64+
fi
65+
66+
else
67+
# Display usage
68+
echo -e "Usage: ./develop [action] [arguments]\n"
69+
echo -e "Available actions:"
70+
71+
# ./develop up {OS_NAME}
72+
echo -e "\tup {OS_NAME}"
73+
echo -e "\t\tSpin up a development environment using vagrant and SSH into it."
74+
echo -e -n "\t\tAvailable OSes: "
75+
for DIRECTORY in `find $VAGRANT_FOLDER -maxdepth 1 -type d`; do
76+
if [[ "$DIRECTORY" != $VAGRANT_FOLDER ]]; then
77+
echo -e -n "${DIRECTORY##*/} "
78+
fi
79+
done
80+
echo
81+
82+
# ./develop ssh {OS_NAME}
83+
echo -e "\tssh {OS_NAME}"
84+
echo -e "\t\tSSH into the given development environment."
85+
86+
# ./develop down {OS_NAME}
87+
echo -e "\tdown {OS_NAME}"
88+
echo -e "\t\tSwitch off given development environment. This does NOT destroy the box."
89+
90+
# ./develop destroy {OS_NAME}
91+
echo -e "\tdestroy {OS_NAME}"
92+
echo -e "\t\tDestroy given development environment."
93+
94+
# ./develop destroy-all
95+
echo -e "\tdestroy-all"
96+
echo -e "\t\tDestroy all development environments."
97+
98+
# ./develop test {OS_NAME}
99+
echo -e "\ttest {OS_NAME}"
100+
echo -e "\t\tRun Acceptance tests against a given OS."
101+
102+
# ./develop test-all
103+
echo -e "\ttest-all"
104+
echo -e "\t\tRun Acceptance tests against ALL OSes."
105+
106+
# ./develop test-all-parallel
107+
echo -e "\ttest-all-parallel"
108+
echo -e "\t\tRun Acceptance tests against ALL OSes in parellel. Requires gnome-terminal."
109+
110+
fi

phpunit.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<groups>
1717
<exclude>
1818
<group>functional</group>
19+
<group>acceptance</group>
1920
</exclude>
2021
</groups>
2122
<php>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*/.vagrant
2+
*.log
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Vagrant.configure("2") do |config|
2+
config.vm.box = "centos/7"
3+
4+
config.vm.synced_folder "../../../../", "/home/vagrant/cpriego-valet-linux", type: "rsync"
5+
6+
config.vm.provision "shell" do |s|
7+
s.path = "provision.sh"
8+
s.privileged = false
9+
s.env = {
10+
VALET_ENVIRONMENT: ENV['VALET_ENVIRONMENT'] || "testing"
11+
}
12+
end
13+
end
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Enable remirepo
5+
sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
6+
sudo yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
7+
sudo yum -y install yum-utils
8+
sudo yum-config-manager --enable remi-php56
9+
10+
# Install OS Requirements
11+
sudo yum install -y nss-tools jq xsel
12+
13+
# Install Nginx & PHP
14+
sudo yum install -y nginx curl zip unzip git \
15+
php-fpm php-cli php-mcrypt php-mbstring php-xml php-curl php-posix
16+
17+
# Install Composer
18+
php -r "readfile('http://getcomposer.org/installer');" | sudo php -- --install-dir=/usr/bin/ --filename=composer
19+
20+
# Remove .composer directory created during installation
21+
sudo rm -rf ~/.composer
22+
23+
# Configure Composer
24+
mkdir -p ~/.config/composer
25+
if [ "$VALET_ENVIRONMENT" == "testing" ]
26+
then
27+
# If we are testing, we mirror the repository
28+
# so the shared folder stays untouched
29+
echo '{
30+
"minimum-stability": "dev",
31+
"repositories": [
32+
{
33+
"type": "path",
34+
"url": "/home/vagrant/cpriego-valet-linux",
35+
"options": {
36+
"symlink": false
37+
}
38+
}
39+
]
40+
}' >> ~/.config/composer/composer.json
41+
else
42+
# If we are developing, we sync the repository with the shared folder
43+
echo '{
44+
"minimum-stability": "dev",
45+
"repositories": [
46+
{
47+
"type": "path",
48+
"url": "/home/vagrant/cpriego-valet-linux"
49+
}
50+
]
51+
}' >> ~/.config/composer/composer.json
52+
fi
53+
54+
# Require Valet
55+
composer global require "cpriego/valet-linux @dev" --no-interaction --no-ansi
56+
57+
# Add Composer bin to PATH
58+
echo "PATH=\"\$HOME/.config/composer/vendor/bin:\$PATH\"" >> ~/.bashrc
59+
source ~/.bashrc
60+
61+
# Disable SELinux
62+
sudo setenforce 0
63+
sudo sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Vagrant.configure("2") do |config|
2+
config.vm.box = "bento/fedora-25"
3+
4+
config.vm.synced_folder "../../../../", "/home/vagrant/cpriego-valet-linux"
5+
6+
config.vm.provision "shell" do |s|
7+
s.path = "provision.sh"
8+
s.privileged = false
9+
s.env = {
10+
VALET_ENVIRONMENT: ENV['VALET_ENVIRONMENT'] || "testing"
11+
}
12+
end
13+
end
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Install OS Requirements
5+
sudo dnf install -y nss-tools jq xsel
6+
7+
# Install Nginx & PHP
8+
sudo dnf install -y nginx curl zip unzip git \
9+
php-fpm php-cli php-mcrypt php-mbstring php-xml php-curl php-posix
10+
11+
# Install Composer
12+
php -r "readfile('http://getcomposer.org/installer');" | sudo php -- --install-dir=/usr/bin/ --filename=composer
13+
14+
# Remove .composer directory created during installation
15+
sudo rm -rf ~/.composer
16+
17+
# Configure Composer
18+
mkdir -p ~/.config/composer
19+
if [ "$VALET_ENVIRONMENT" == "testing" ]
20+
then
21+
# If we are testing, we mirror the repository
22+
# so the shared folder stays untouched
23+
echo '{
24+
"minimum-stability": "dev",
25+
"repositories": [
26+
{
27+
"type": "path",
28+
"url": "/home/vagrant/cpriego-valet-linux",
29+
"options": {
30+
"symlink": false
31+
}
32+
}
33+
]
34+
}' >> ~/.config/composer/composer.json
35+
else
36+
# If we are developing, we sync the repository with the shared folder
37+
echo '{
38+
"minimum-stability": "dev",
39+
"repositories": [
40+
{
41+
"type": "path",
42+
"url": "/home/vagrant/cpriego-valet-linux"
43+
}
44+
]
45+
}' >> ~/.config/composer/composer.json
46+
fi
47+
48+
# Require Valet
49+
composer global require "cpriego/valet-linux @dev" --no-interaction --no-ansi
50+
51+
# Add Composer bin to PATH
52+
echo "PATH=\"\$HOME/.config/composer/vendor/bin:\$PATH\"" >> ~/.profile
53+
source ~/.profile
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Vagrant.configure("2") do |config|
2+
config.vm.box = "bento/fedora-26"
3+
4+
config.vm.synced_folder "../../../../", "/home/vagrant/cpriego-valet-linux"
5+
6+
config.vm.provision "shell" do |s|
7+
s.path = "provision.sh"
8+
s.privileged = false
9+
s.env = {
10+
VALET_ENVIRONMENT: ENV['VALET_ENVIRONMENT'] || "testing"
11+
}
12+
end
13+
end
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Install OS Requirements
5+
sudo dnf install -y nss-tools jq xsel
6+
7+
# Install Nginx & PHP
8+
sudo dnf install -y nginx curl zip unzip git \
9+
php-fpm php-cli php-mcrypt php-mbstring php-xml php-curl php-posix
10+
11+
# Install Composer
12+
php -r "readfile('http://getcomposer.org/installer');" | sudo php -- --install-dir=/usr/bin/ --filename=composer
13+
14+
# Remove .composer directory created during installation
15+
sudo rm -rf ~/.composer
16+
17+
# Configure Composer
18+
mkdir -p ~/.config/composer
19+
if [ "$VALET_ENVIRONMENT" == "testing" ]
20+
then
21+
# If we are testing, we mirror the repository
22+
# so the shared folder stays untouched
23+
echo '{
24+
"minimum-stability": "dev",
25+
"repositories": [
26+
{
27+
"type": "path",
28+
"url": "/home/vagrant/cpriego-valet-linux",
29+
"options": {
30+
"symlink": false
31+
}
32+
}
33+
]
34+
}' >> ~/.config/composer/composer.json
35+
else
36+
# If we are developing, we sync the repository with the shared folder
37+
echo '{
38+
"minimum-stability": "dev",
39+
"repositories": [
40+
{
41+
"type": "path",
42+
"url": "/home/vagrant/cpriego-valet-linux"
43+
}
44+
]
45+
}' >> ~/.config/composer/composer.json
46+
fi
47+
48+
# Require Valet
49+
composer global require "cpriego/valet-linux @dev" --no-interaction --no-ansi
50+
51+
# Add Composer bin to PATH
52+
echo "PATH=\"\$HOME/.config/composer/vendor/bin:\$PATH\"" >> ~/.profile
53+
source ~/.profile

0 commit comments

Comments
 (0)