From c23c5668d0644ffe4c74b5c13951f58ea0dcbac7 Mon Sep 17 00:00:00 2001 From: freezy Date: Wed, 5 Sep 2018 10:41:40 +0200 Subject: [PATCH 1/5] Use latest alpine for builder and docker template --- builder/Dockerfile | 2 +- templates/versions/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/builder/Dockerfile b/builder/Dockerfile index 9901d93..cfd716a 100644 --- a/builder/Dockerfile +++ b/builder/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.3 +FROM alpine:3.8 COPY scripts/mkimage-phan.bash / COPY scripts/docker-entrypoint.sh / RUN apk --no-cache add bash diff --git a/templates/versions/Dockerfile b/templates/versions/Dockerfile index 9812793..471344e 100644 --- a/templates/versions/Dockerfile +++ b/templates/versions/Dockerfile @@ -1,3 +1,3 @@ -FROM alpine:3.3 +FROM alpine:3.8 ADD rootfs.tar.gz / ENTRYPOINT ["/sbin/tini", "-g", "--", "/docker-entrypoint.sh"] From 862881216506d27f19e0dc501505f6e0f5621a0c Mon Sep 17 00:00:00 2001 From: freezy Date: Wed, 5 Sep 2018 10:41:53 +0200 Subject: [PATCH 2/5] Build latest stable releases 1.0.0 and 1.0.1 --- .travis.yml | 4 ++++ test/test_cloudflare_phan-1.0.0.bats | 36 ++++++++++++++++++++++++++++ test/test_cloudflare_phan-1.0.1.bats | 36 ++++++++++++++++++++++++++++ versions/1.0.0/Dockerfile | 3 +++ versions/1.0.0/options | 5 ++++ versions/1.0.1/Dockerfile | 3 +++ versions/1.0.1/options | 5 ++++ 7 files changed, 92 insertions(+) create mode 100644 test/test_cloudflare_phan-1.0.0.bats create mode 100644 test/test_cloudflare_phan-1.0.1.bats create mode 100644 versions/1.0.0/Dockerfile create mode 100644 versions/1.0.0/options create mode 100644 versions/1.0.1/Dockerfile create mode 100644 versions/1.0.1/options diff --git a/.travis.yml b/.travis.yml index 83eae7c..18a38f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,8 @@ env: - VERSION=0.9.2 - VERSION=0.9.3 - VERSION=0.9.4 + - VERSION=1.0.0 + - VERSION=1.0.1 - VERSION=edge matrix: exclude: @@ -31,6 +33,8 @@ matrix: - evn: VERSION=0.9.2 TRAVIS_EVENT_TYPE=cron - evn: VERSION=0.9.3 TRAVIS_EVENT_TYPE=cron - evn: VERSION=0.9.4 TRAVIS_EVENT_TYPE=cron + - evn: VERSION=1.0.0 TRAVIS_EVENT_TYPE=cron + - evn: VERSION=1.0.1 TRAVIS_EVENT_TYPE=cron allow_failures: - env: VERSION=edge diff --git a/test/test_cloudflare_phan-1.0.0.bats b/test/test_cloudflare_phan-1.0.0.bats new file mode 100644 index 0000000..19df8f6 --- /dev/null +++ b/test/test_cloudflare_phan-1.0.0.bats @@ -0,0 +1,36 @@ +setup() { + VERSION=1.0.0 + docker history "cloudflare/phan:${VERSION}" >/dev/null 2>&1 +} + +@test "pass arguments to phan" { + run docker run -v $PWD/test/fixtures/pass:/mnt/src "cloudflare/phan:${VERSION}" -h + [ $status -eq 0 ] + [ "${lines[0]}" = "Usage: /opt/phan/phan [options] [files...]" ] +} + +@test "outputs zero lines if source has no issues" { + run docker run -v $PWD/test/fixtures/pass:/mnt/src "cloudflare/phan:${VERSION}" \ + -l . + [ $status -eq 0 ] + [ ${#lines[@]} -eq 0 ] +} + +@test "outputs lines if source has issues" { + run docker run -v $PWD/test/fixtures/fail:/mnt/src "cloudflare/phan:${VERSION}" \ + -l . + + # even if there's failures, phan reports 1 + [ $status -eq 1 ] + + [ ${#lines[@]} -eq 2 ] + [ "${lines[0]}" = "./undefined_class.php:3 PhanUndeclaredClassMethod Call to method __construct from undeclared class \Stub" ] + [ "${lines[1]}" = "./undefined_class.php:4 PhanUndeclaredClassConstant Reference to constant TYPE_STRING from undeclared class \Stub" ] +} + +@test "checkstyle output format is available" { + run docker run -v $PWD/test/fixtures/pass:/mnt/src "cloudflare/phan:${VERSION}" \ + --output-mode checkstyle -l . + [ $status -eq 0 ] + [ ${#lines[@]} -eq 2 ] +} diff --git a/test/test_cloudflare_phan-1.0.1.bats b/test/test_cloudflare_phan-1.0.1.bats new file mode 100644 index 0000000..c914d1c --- /dev/null +++ b/test/test_cloudflare_phan-1.0.1.bats @@ -0,0 +1,36 @@ +setup() { + VERSION=1.0.1 + docker history "cloudflare/phan:${VERSION}" >/dev/null 2>&1 +} + +@test "pass arguments to phan" { + run docker run -v $PWD/test/fixtures/pass:/mnt/src "cloudflare/phan:${VERSION}" -h + [ $status -eq 0 ] + [ "${lines[0]}" = "Usage: /opt/phan/phan [options] [files...]" ] +} + +@test "outputs zero lines if source has no issues" { + run docker run -v $PWD/test/fixtures/pass:/mnt/src "cloudflare/phan:${VERSION}" \ + -l . + [ $status -eq 0 ] + [ ${#lines[@]} -eq 0 ] +} + +@test "outputs lines if source has issues" { + run docker run -v $PWD/test/fixtures/fail:/mnt/src "cloudflare/phan:${VERSION}" \ + -l . + + # even if there's failures, phan reports 1 + [ $status -eq 1 ] + + [ ${#lines[@]} -eq 2 ] + [ "${lines[0]}" = "./undefined_class.php:3 PhanUndeclaredClassMethod Call to method __construct from undeclared class \Stub" ] + [ "${lines[1]}" = "./undefined_class.php:4 PhanUndeclaredClassConstant Reference to constant TYPE_STRING from undeclared class \Stub" ] +} + +@test "checkstyle output format is available" { + run docker run -v $PWD/test/fixtures/pass:/mnt/src "cloudflare/phan:${VERSION}" \ + --output-mode checkstyle -l . + [ $status -eq 0 ] + [ ${#lines[@]} -eq 2 ] +} diff --git a/versions/1.0.0/Dockerfile b/versions/1.0.0/Dockerfile new file mode 100644 index 0000000..471344e --- /dev/null +++ b/versions/1.0.0/Dockerfile @@ -0,0 +1,3 @@ +FROM alpine:3.8 +ADD rootfs.tar.gz / +ENTRYPOINT ["/sbin/tini", "-g", "--", "/docker-entrypoint.sh"] diff --git a/versions/1.0.0/options b/versions/1.0.0/options new file mode 100644 index 0000000..6f5d111 --- /dev/null +++ b/versions/1.0.0/options @@ -0,0 +1,5 @@ +export RELEASE="1.0.0" +export MIRROR="http://mirror.sfo12.us.leaseweb.net/alpine" +export AST="0.1.6" +export BUILD_OPTIONS=(-s -r $RELEASE -m $MIRROR -a $AST) +export TAGS=(cloudflare/phan:1.0.0) diff --git a/versions/1.0.1/Dockerfile b/versions/1.0.1/Dockerfile new file mode 100644 index 0000000..471344e --- /dev/null +++ b/versions/1.0.1/Dockerfile @@ -0,0 +1,3 @@ +FROM alpine:3.8 +ADD rootfs.tar.gz / +ENTRYPOINT ["/sbin/tini", "-g", "--", "/docker-entrypoint.sh"] diff --git a/versions/1.0.1/options b/versions/1.0.1/options new file mode 100644 index 0000000..e1636e6 --- /dev/null +++ b/versions/1.0.1/options @@ -0,0 +1,5 @@ +export RELEASE="1.0.1" +export MIRROR="http://mirror.sfo12.us.leaseweb.net/alpine" +export AST="0.1.6" +export BUILD_OPTIONS=(-s -r $RELEASE -m $MIRROR -a $AST) +export TAGS=(cloudflare/phan:1.0.1) From b12a86a3ef0476d2c497818d4e0d2efb3155674f Mon Sep 17 00:00:00 2001 From: freezy Date: Wed, 12 Sep 2018 12:59:26 +0200 Subject: [PATCH 3/5] Added missing tokenizer extension --- builder/scripts/mkimage-phan.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/scripts/mkimage-phan.bash b/builder/scripts/mkimage-phan.bash index 38967a4..067b4aa 100755 --- a/builder/scripts/mkimage-phan.bash +++ b/builder/scripts/mkimage-phan.bash @@ -39,7 +39,7 @@ build() { # install runtime dependencies into rootfs { - apk --no-cache --root "$rootfs" --keys-dir /etc/apk/keys add --initdb php7 php7-json php7-sqlite3 php7-mbstring php7-pcntl php7-dom tini + apk --no-cache --root "$rootfs" --keys-dir /etc/apk/keys add --initdb php7 php7-json php7-sqlite3 php7-mbstring php7-pcntl php7-dom php7-tokenizer tini cp /docker-entrypoint.sh "$rootfs"/docker-entrypoint.sh } >&2 From c28e6974ef6fc6135a09b2ff46d158f795c6402e Mon Sep 17 00:00:00 2001 From: freezy Date: Wed, 12 Sep 2018 19:56:20 +0200 Subject: [PATCH 4/5] Fix format of error output for 1.x versions --- templates/test/test_cloudflare_phan.bats | 4 ++-- test/test_cloudflare_phan-1.0.0.bats | 4 ++-- test/test_cloudflare_phan-1.0.1.bats | 4 ++-- test/test_cloudflare_phan-edge.bats | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/templates/test/test_cloudflare_phan.bats b/templates/test/test_cloudflare_phan.bats index bd86f07..d14be9a 100644 --- a/templates/test/test_cloudflare_phan.bats +++ b/templates/test/test_cloudflare_phan.bats @@ -24,8 +24,8 @@ setup() { [ $status -eq 1 ] [ ${#lines[@]} -eq 2 ] - [ "${lines[0]}" = "./undefined_class.php:3 PhanUndeclaredClassMethod Call to method __construct from undeclared class \Stub" ] - [ "${lines[1]}" = "./undefined_class.php:4 PhanUndeclaredClassConstant Reference to constant TYPE_STRING from undeclared class \Stub" ] + [ "${lines[0]}" = "undefined_class.php:3 PhanUndeclaredClassMethod Call to method __construct from undeclared class \Stub" ] + [ "${lines[1]}" = "undefined_class.php:4 PhanUndeclaredClassConstant Reference to constant TYPE_STRING from undeclared class \Stub" ] } @test "checkstyle output format is available" { diff --git a/test/test_cloudflare_phan-1.0.0.bats b/test/test_cloudflare_phan-1.0.0.bats index 19df8f6..a3ba132 100644 --- a/test/test_cloudflare_phan-1.0.0.bats +++ b/test/test_cloudflare_phan-1.0.0.bats @@ -24,8 +24,8 @@ setup() { [ $status -eq 1 ] [ ${#lines[@]} -eq 2 ] - [ "${lines[0]}" = "./undefined_class.php:3 PhanUndeclaredClassMethod Call to method __construct from undeclared class \Stub" ] - [ "${lines[1]}" = "./undefined_class.php:4 PhanUndeclaredClassConstant Reference to constant TYPE_STRING from undeclared class \Stub" ] + [ "${lines[0]}" = "undefined_class.php:3 PhanUndeclaredClassMethod Call to method __construct from undeclared class \Stub" ] + [ "${lines[1]}" = "undefined_class.php:4 PhanUndeclaredClassConstant Reference to constant TYPE_STRING from undeclared class \Stub" ] } @test "checkstyle output format is available" { diff --git a/test/test_cloudflare_phan-1.0.1.bats b/test/test_cloudflare_phan-1.0.1.bats index c914d1c..07aa63e 100644 --- a/test/test_cloudflare_phan-1.0.1.bats +++ b/test/test_cloudflare_phan-1.0.1.bats @@ -24,8 +24,8 @@ setup() { [ $status -eq 1 ] [ ${#lines[@]} -eq 2 ] - [ "${lines[0]}" = "./undefined_class.php:3 PhanUndeclaredClassMethod Call to method __construct from undeclared class \Stub" ] - [ "${lines[1]}" = "./undefined_class.php:4 PhanUndeclaredClassConstant Reference to constant TYPE_STRING from undeclared class \Stub" ] + [ "${lines[0]}" = "undefined_class.php:3 PhanUndeclaredClassMethod Call to method __construct from undeclared class \Stub" ] + [ "${lines[1]}" = "undefined_class.php:4 PhanUndeclaredClassConstant Reference to constant TYPE_STRING from undeclared class \Stub" ] } @test "checkstyle output format is available" { diff --git a/test/test_cloudflare_phan-edge.bats b/test/test_cloudflare_phan-edge.bats index 6d98751..2908d1c 100644 --- a/test/test_cloudflare_phan-edge.bats +++ b/test/test_cloudflare_phan-edge.bats @@ -25,8 +25,8 @@ setup() { [ $status -eq 1 ] [ ${#lines[@]} -eq 2 ] - [ "${lines[0]}" = "./undefined_class.php:3 PhanUndeclaredClassMethod Call to method __construct from undeclared class \Stub" ] - [ "${lines[1]}" = "./undefined_class.php:4 PhanUndeclaredClassConstant Reference to constant TYPE_STRING from undeclared class \Stub" ] + [ "${lines[0]}" = "undefined_class.php:3 PhanUndeclaredClassMethod Call to method __construct from undeclared class \Stub" ] + [ "${lines[1]}" = "undefined_class.php:4 PhanUndeclaredClassConstant Reference to constant TYPE_STRING from undeclared class \Stub" ] } @test "checkstyle output format is available" { From 20c73d08d864949f707893c5f93251984f4f76b9 Mon Sep 17 00:00:00 2001 From: freezy Date: Wed, 12 Sep 2018 20:13:22 +0200 Subject: [PATCH 5/5] Build versions 1.0.2, 1.0.3, 1.0.4 --- test/test_cloudflare_phan-1.0.2.bats | 36 ++++++++++++++++++++++++++++ test/test_cloudflare_phan-1.0.3.bats | 36 ++++++++++++++++++++++++++++ test/test_cloudflare_phan-1.0.4.bats | 36 ++++++++++++++++++++++++++++ versions/1.0.2/Dockerfile | 3 +++ versions/1.0.2/options | 5 ++++ versions/1.0.3/Dockerfile | 3 +++ versions/1.0.3/options | 5 ++++ versions/1.0.4/Dockerfile | 3 +++ versions/1.0.4/options | 5 ++++ 9 files changed, 132 insertions(+) create mode 100644 test/test_cloudflare_phan-1.0.2.bats create mode 100644 test/test_cloudflare_phan-1.0.3.bats create mode 100644 test/test_cloudflare_phan-1.0.4.bats create mode 100644 versions/1.0.2/Dockerfile create mode 100644 versions/1.0.2/options create mode 100644 versions/1.0.3/Dockerfile create mode 100644 versions/1.0.3/options create mode 100644 versions/1.0.4/Dockerfile create mode 100644 versions/1.0.4/options diff --git a/test/test_cloudflare_phan-1.0.2.bats b/test/test_cloudflare_phan-1.0.2.bats new file mode 100644 index 0000000..c43d7ea --- /dev/null +++ b/test/test_cloudflare_phan-1.0.2.bats @@ -0,0 +1,36 @@ +setup() { + VERSION=1.0.2 + docker history "cloudflare/phan:${VERSION}" >/dev/null 2>&1 +} + +@test "pass arguments to phan" { + run docker run -v $PWD/test/fixtures/pass:/mnt/src "cloudflare/phan:${VERSION}" -h + [ $status -eq 0 ] + [ "${lines[0]}" = "Usage: /opt/phan/phan [options] [files...]" ] +} + +@test "outputs zero lines if source has no issues" { + run docker run -v $PWD/test/fixtures/pass:/mnt/src "cloudflare/phan:${VERSION}" \ + -l . + [ $status -eq 0 ] + [ ${#lines[@]} -eq 0 ] +} + +@test "outputs lines if source has issues" { + run docker run -v $PWD/test/fixtures/fail:/mnt/src "cloudflare/phan:${VERSION}" \ + -l . + + # even if there's failures, phan reports 1 + [ $status -eq 1 ] + + [ ${#lines[@]} -eq 2 ] + [ "${lines[0]}" = "undefined_class.php:3 PhanUndeclaredClassMethod Call to method __construct from undeclared class \Stub" ] + [ "${lines[1]}" = "undefined_class.php:4 PhanUndeclaredClassConstant Reference to constant TYPE_STRING from undeclared class \Stub" ] +} + +@test "checkstyle output format is available" { + run docker run -v $PWD/test/fixtures/pass:/mnt/src "cloudflare/phan:${VERSION}" \ + --output-mode checkstyle -l . + [ $status -eq 0 ] + [ ${#lines[@]} -eq 2 ] +} diff --git a/test/test_cloudflare_phan-1.0.3.bats b/test/test_cloudflare_phan-1.0.3.bats new file mode 100644 index 0000000..d6395ea --- /dev/null +++ b/test/test_cloudflare_phan-1.0.3.bats @@ -0,0 +1,36 @@ +setup() { + VERSION=1.0.3 + docker history "cloudflare/phan:${VERSION}" >/dev/null 2>&1 +} + +@test "pass arguments to phan" { + run docker run -v $PWD/test/fixtures/pass:/mnt/src "cloudflare/phan:${VERSION}" -h + [ $status -eq 0 ] + [ "${lines[0]}" = "Usage: /opt/phan/phan [options] [files...]" ] +} + +@test "outputs zero lines if source has no issues" { + run docker run -v $PWD/test/fixtures/pass:/mnt/src "cloudflare/phan:${VERSION}" \ + -l . + [ $status -eq 0 ] + [ ${#lines[@]} -eq 0 ] +} + +@test "outputs lines if source has issues" { + run docker run -v $PWD/test/fixtures/fail:/mnt/src "cloudflare/phan:${VERSION}" \ + -l . + + # even if there's failures, phan reports 1 + [ $status -eq 1 ] + + [ ${#lines[@]} -eq 2 ] + [ "${lines[0]}" = "undefined_class.php:3 PhanUndeclaredClassMethod Call to method __construct from undeclared class \Stub" ] + [ "${lines[1]}" = "undefined_class.php:4 PhanUndeclaredClassConstant Reference to constant TYPE_STRING from undeclared class \Stub" ] +} + +@test "checkstyle output format is available" { + run docker run -v $PWD/test/fixtures/pass:/mnt/src "cloudflare/phan:${VERSION}" \ + --output-mode checkstyle -l . + [ $status -eq 0 ] + [ ${#lines[@]} -eq 2 ] +} diff --git a/test/test_cloudflare_phan-1.0.4.bats b/test/test_cloudflare_phan-1.0.4.bats new file mode 100644 index 0000000..ad35f7d --- /dev/null +++ b/test/test_cloudflare_phan-1.0.4.bats @@ -0,0 +1,36 @@ +setup() { + VERSION=1.0.4 + docker history "cloudflare/phan:${VERSION}" >/dev/null 2>&1 +} + +@test "pass arguments to phan" { + run docker run -v $PWD/test/fixtures/pass:/mnt/src "cloudflare/phan:${VERSION}" -h + [ $status -eq 0 ] + [ "${lines[0]}" = "Usage: /opt/phan/phan [options] [files...]" ] +} + +@test "outputs zero lines if source has no issues" { + run docker run -v $PWD/test/fixtures/pass:/mnt/src "cloudflare/phan:${VERSION}" \ + -l . + [ $status -eq 0 ] + [ ${#lines[@]} -eq 0 ] +} + +@test "outputs lines if source has issues" { + run docker run -v $PWD/test/fixtures/fail:/mnt/src "cloudflare/phan:${VERSION}" \ + -l . + + # even if there's failures, phan reports 1 + [ $status -eq 1 ] + + [ ${#lines[@]} -eq 2 ] + [ "${lines[0]}" = "undefined_class.php:3 PhanUndeclaredClassMethod Call to method __construct from undeclared class \Stub" ] + [ "${lines[1]}" = "undefined_class.php:4 PhanUndeclaredClassConstant Reference to constant TYPE_STRING from undeclared class \Stub" ] +} + +@test "checkstyle output format is available" { + run docker run -v $PWD/test/fixtures/pass:/mnt/src "cloudflare/phan:${VERSION}" \ + --output-mode checkstyle -l . + [ $status -eq 0 ] + [ ${#lines[@]} -eq 2 ] +} diff --git a/versions/1.0.2/Dockerfile b/versions/1.0.2/Dockerfile new file mode 100644 index 0000000..471344e --- /dev/null +++ b/versions/1.0.2/Dockerfile @@ -0,0 +1,3 @@ +FROM alpine:3.8 +ADD rootfs.tar.gz / +ENTRYPOINT ["/sbin/tini", "-g", "--", "/docker-entrypoint.sh"] diff --git a/versions/1.0.2/options b/versions/1.0.2/options new file mode 100644 index 0000000..ba4308a --- /dev/null +++ b/versions/1.0.2/options @@ -0,0 +1,5 @@ +export RELEASE="1.0.2" +export MIRROR="http://mirror.sfo12.us.leaseweb.net/alpine" +export AST="0.1.6" +export BUILD_OPTIONS=(-s -r $RELEASE -m $MIRROR -a $AST) +export TAGS=(cloudflare/phan:1.0.2) diff --git a/versions/1.0.3/Dockerfile b/versions/1.0.3/Dockerfile new file mode 100644 index 0000000..471344e --- /dev/null +++ b/versions/1.0.3/Dockerfile @@ -0,0 +1,3 @@ +FROM alpine:3.8 +ADD rootfs.tar.gz / +ENTRYPOINT ["/sbin/tini", "-g", "--", "/docker-entrypoint.sh"] diff --git a/versions/1.0.3/options b/versions/1.0.3/options new file mode 100644 index 0000000..ca90ae7 --- /dev/null +++ b/versions/1.0.3/options @@ -0,0 +1,5 @@ +export RELEASE="1.0.3" +export MIRROR="http://mirror.sfo12.us.leaseweb.net/alpine" +export AST="0.1.6" +export BUILD_OPTIONS=(-s -r $RELEASE -m $MIRROR -a $AST) +export TAGS=(cloudflare/phan:1.0.3) diff --git a/versions/1.0.4/Dockerfile b/versions/1.0.4/Dockerfile new file mode 100644 index 0000000..471344e --- /dev/null +++ b/versions/1.0.4/Dockerfile @@ -0,0 +1,3 @@ +FROM alpine:3.8 +ADD rootfs.tar.gz / +ENTRYPOINT ["/sbin/tini", "-g", "--", "/docker-entrypoint.sh"] diff --git a/versions/1.0.4/options b/versions/1.0.4/options new file mode 100644 index 0000000..ccb0b6b --- /dev/null +++ b/versions/1.0.4/options @@ -0,0 +1,5 @@ +export RELEASE="1.0.4" +export MIRROR="http://mirror.sfo12.us.leaseweb.net/alpine" +export AST="0.1.6" +export BUILD_OPTIONS=(-s -r $RELEASE -m $MIRROR -a $AST) +export TAGS=(cloudflare/phan:1.0.4)