Skip to content

Commit 1a3d9a6

Browse files
authored
Update to 2.9.0 (#3)
* Update phpcs binary to version 2.9.0. * Update PHP base image to version 7.1.5-alpine. * Use TravisCI to build, tests, and publish the docker image.
1 parent 7265431 commit 1a3d9a6

4 files changed

Lines changed: 54 additions & 6 deletions

File tree

.travis.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
sudo: required
2+
dist: trusty
3+
4+
services:
5+
- docker
6+
7+
matrix:
8+
fast_finish: true
9+
include:
10+
- env:
11+
- PHPCS_VERSION=2.9.0
12+
- IS_LATEST=1
13+
14+
before_script:
15+
- docker build --rm --tag herloct/phpcs:$PHPCS_VERSION-$TRAVIS_BRANCH .
16+
- docker run --rm herloct/phpcs:$PHPCS_VERSION-$TRAVIS_BRANCH
17+
18+
script:
19+
- cd tests
20+
- docker run --rm
21+
--volume $(pwd):/project
22+
herloct/phpcs:$PHPCS_VERSION-$TRAVIS_BRANCH --version
23+
- docker run --rm
24+
--volume $(pwd):/project
25+
herloct/phpcs:$PHPCS_VERSION-$TRAVIS_BRANCH --standard=PSR1,PSR2 --report-file=report Sample.php || true
26+
- if [[ ! -f "report" ]]; then exit 1; fi
27+
- cat report
28+
29+
after_success:
30+
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD";
31+
- docker push herloct/phpcs:$PHPCS_VERSION-$TRAVIS_BRANCH;
32+
- if [[ $TRAVIS_TAG ]]; then
33+
docker tag herloct/phpcs:$PHPCS_VERSION-$TRAVIS_BRANCH herloct/phpcs:$PHPCS_VERSION;
34+
docker push herloct/phpcs:$PHPCS_VERSION;
35+
fi
36+
- if [[ $TRAVIS_TAG ]] && [[ $IS_LATEST == 1 ]]; then
37+
docker tag herloct/phpcs:$PHPCS_VERSION herloct/phpcs:latest;
38+
docker push herloct/phpcs:latest;
39+
fi

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
FROM php:7.1.1-alpine
1+
FROM php:7.1.5-alpine
22

33
MAINTAINER herloct <herloct@gmail.com>
44

5-
ENV PHPCS_VERSION=2.8.1
5+
ENV PHPCS_VERSION=2.9.0
66

77
RUN curl -L https://github.com/squizlabs/PHP_CodeSniffer/releases/download/$PHPCS_VERSION/phpcs.phar > /usr/local/bin/phpcs \
88
&& chmod +x /usr/local/bin/phpcs \

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
[![](https://images.microbadger.com/badges/image/herloct/phpcs.svg)](http://microbadger.com/images/herloct/phpcs "Get your own image badge on microbadger.com")
1+
[![license](https://img.shields.io/github/license/herloct/docker-phpcs.svg)]()
2+
[![Build Status](https://travis-ci.org/herloct/docker-phpcs.svg?branch=master)](https://travis-ci.org/herloct/docker-phpcs)
23

34
## Supported tags and respective `Dockerfile` links
45

5-
* [`2.8.1`, `latest`](https://github.com/herloct/docker-phpcs/blob/2.8.1/Dockerfile)
6+
* [`2.9.0`, `latest`](https://github.com/herloct/docker-phpcs/blob/2.9.0/Dockerfile)
7+
* [`2.8.1`](https://github.com/herloct/docker-phpcs/blob/2.8.1/Dockerfile)
68
* [`2.8.0`](https://github.com/herloct/docker-phpcs/blob/2.8.0/Dockerfile)
79
* [`2.7.1`](https://github.com/herloct/docker-phpcs/blob/2.7.1/Dockerfile)
810

@@ -19,7 +21,7 @@ Basic usage.
1921
```sh
2022
docker run --rm \
2123
--volume /local/path:/project \
22-
herloct/phpcs [<options>]
24+
herloct/phpcs[:tag] [<options>]
2325
```
2426

2527
For example, to check `src` directory against the PSR1 and PSR2 coding standard.
@@ -32,4 +34,4 @@ docker run --rm \
3234

3335
## Volumes
3436

35-
* **/project**: Your PHP project directory.
37+
* `/project`: Your PHP project directory.

tests/Sample.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
class Sample {
4+
public function doSomething() {
5+
//
6+
}
7+
}

0 commit comments

Comments
 (0)