Skip to content

Commit 1ed686d

Browse files
committed
Fix travis
2 parents ea06454 + 9d5398b commit 1ed686d

File tree

6 files changed

+54
-50
lines changed

6 files changed

+54
-50
lines changed

.travis.yml

+26-45
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,32 @@
1+
sudo: required
2+
dist: trusty
13
language: php
2-
34
php:
4-
- 7.1
5-
- 7.2
6-
7-
env:
8-
global:
9-
- DRIVER_VERSION="stable"
10-
- ADAPTER_VERSION="^1.0.0"
11-
12-
sudo: true
5+
- "7.2"
6+
- "7.1"
137

148
services:
15-
- mongodb
16-
- mysql
17-
18-
matrix:
19-
fast_finish: true
20-
include:
21-
- php: 7.1
22-
addons:
23-
apt:
24-
sources:
25-
- sourceline: "deb [arch=amd64] https://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.4 multiverse"
26-
key_url: "https://www.mongodb.org/static/pgp/server-3.4.asc"
27-
- "mongodb-upstart"
28-
packages: ['mongodb-org-server']
29-
- php: 7.2
30-
addons:
31-
apt:
32-
sources:
33-
- sourceline: "deb [arch=amd64] https://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.4 multiverse"
34-
key_url: "https://www.mongodb.org/static/pgp/server-3.4.asc"
35-
- "mongodb-upstart"
36-
packages: ['mongodb-org-server']
37-
38-
before_script:
39-
- if [[ ${TRAVIS_PHP_VERSION:0:2} == "7." ]]; then pecl install -f mongodb-${DRIVER_VERSION}; fi
40-
- if [[ ${TRAVIS_PHP_VERSION:0:2} == "7." ]]; then composer config "platform.ext-mongo" "1.6.16" && composer require "alcaeus/mongo-php-adapter=${ADAPTER_VERSION}"; fi
41-
- mysql -e 'create database unittest;'
42-
- service mongod start
43-
- travis_retry composer self-update
44-
- travis_retry composer install --no-interaction
9+
- docker
10+
11+
install:
12+
# Update docker-engine using Ubuntu 'trusty' apt repo
13+
- >
14+
curl -sSL "https://get.docker.com/gpg" |
15+
sudo -E apt-key add -
16+
- >
17+
echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" |
18+
sudo tee -a /etc/apt/sources.list
19+
- sudo apt-get update
20+
- >
21+
sudo apt-get -o Dpkg::Options::="--force-confdef" \
22+
-o Dpkg::Options::="--force-confold" --assume-yes install docker-engine --allow-unauthenticated
23+
- docker version
24+
25+
# Update docker-compose via pip
26+
- sudo pip install docker-compose
27+
- docker-compose version
28+
- docker-compose up --build -d
29+
- docker ps -a
4530

4631
script:
47-
- mkdir -p build/logs
48-
- vendor/bin/phpunit --coverage-clover build/logs/clover.xml
49-
50-
after_success:
51-
- sh -c 'php vendor/bin/coveralls -v'
32+
- docker-compose up --exit-code-from php

docker-compose.yml

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ version: '3'
33
services:
44

55
php:
6+
container_name: php
67
build:
78
context: .
89
dockerfile: docker/Dockerfile
@@ -15,6 +16,7 @@ services:
1516
- mongodb
1617

1718
mysql:
19+
container_name: mysql
1820
image: mysql
1921
environment:
2022
MYSQL_ROOT_PASSWORD:
@@ -24,6 +26,7 @@ services:
2426
driver: none
2527

2628
mongodb:
29+
container_name: mongodb
2730
image: mongo
2831
logging:
2932
driver: none

docker/Dockerfile

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
FROM php:7.1-cli
22

3+
RUN pecl install xdebug
4+
35
RUN apt-get update && \
4-
apt-get install -y autoconf pkg-config libssl-dev && \
5-
pecl install mongodb && docker-php-ext-enable mongodb && \
6-
docker-php-ext-install -j$(nproc) pdo pdo_mysql
6+
apt-get install -y autoconf pkg-config libssl-dev git && \
7+
pecl install mongodb git zlib1g-dev && docker-php-ext-enable mongodb && \
8+
docker-php-ext-install -j$(nproc) pdo pdo_mysql zip && docker-php-ext-enable xdebug
9+
10+
RUN curl -sS https://getcomposer.org/installer | php \
11+
&& mv composer.phar /usr/local/bin/ \
12+
&& ln -s /usr/local/bin/composer.phar /usr/local/bin/composer
13+
14+
ENV PATH="~/.composer/vendor/bin:./vendor/bin:${PATH}"

docker/entrypoint.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env bash
22

3-
sleep 3 && php ./vendor/bin/phpunit
3+
sleep 3 && composer install --prefer-source --no-interaction && php ./vendor/bin/phpunit

src/Jenssegers/Mongodb/Queue/MongoQueue.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ protected function releaseJobsThatHaveBeenReservedTooLong($queue)
117117
})->get();
118118

119119
foreach ($reserved as $job) {
120-
$attempts = $job['attempts'];
120+
$attempts = $job['attempts'] + 1;
121121
$this->releaseJob($job['_id'], $attempts);
122122
}
123123
}

src/Jenssegers/Mongodb/Schema/Builder.php

+12
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,18 @@ public function create($collection, Closure $callback = null)
9696
}
9797
}
9898

99+
/**
100+
* @inheritdoc
101+
*/
102+
public function dropIfExists($collection)
103+
{
104+
if ($this->hasCollection($collection)) {
105+
return $this->drop($collection);
106+
}
107+
108+
return false;
109+
}
110+
99111
/**
100112
* @inheritdoc
101113
*/

0 commit comments

Comments
 (0)