Skip to content

Commit 5264d91

Browse files
authored
Building Docker image and Phar file as part of CI (#23)
1 parent 45edad6 commit 5264d91

4 files changed

Lines changed: 122 additions & 0 deletions

File tree

.dockerignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#
2+
# JBZoo Toolbox - CI-Report-Converter.
3+
#
4+
# This file is part of the JBZoo Toolbox project.
5+
# For the full copyright and license information, please view the LICENSE
6+
# file that was distributed with this source code.
7+
#
8+
# @license MIT
9+
# @copyright Copyright (C) JBZoo.com, All rights reserved.
10+
# @see https://github.com/JBZoo/CI-Report-Converter
11+
#
12+
13+
.git
14+
.idea
15+
.github
16+
build
17+
tests
18+
vendor
19+
.DS_Store
20+
.editorconfig
21+
.gitattributes
22+
.gitignore
23+
.phan.php
24+
.phpunit.result.cache
25+
.travis.yml
26+
action.yml
27+
box.json.dist
28+
phpunit.xml.dist
29+
Makefile

.github/workflows/main.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,57 @@ jobs:
139139
with:
140140
name: Reports - ${{ matrix.php-version }}
141141
path: build/
142+
143+
phar:
144+
name: Phar
145+
runs-on: ubuntu-latest
146+
needs: [ phpunit, linters, report ]
147+
strategy:
148+
matrix:
149+
php-version: [ 8.1, 8.2 ]
150+
steps:
151+
- name: Checkout code
152+
uses: actions/checkout@v3
153+
with:
154+
fetch-depth: 0
155+
156+
- name: Setup PHP
157+
uses: shivammathur/setup-php@v2
158+
with:
159+
php-version: ${{ matrix.php-version }}
160+
coverage: xdebug
161+
tools: composer
162+
extensions: ast
163+
164+
- name: Build the project
165+
run: make build --no-print-directory
166+
167+
- name: Building Phar binary file
168+
run: make build-phar --no-print-directory
169+
170+
- name: Trying to use the phar file
171+
run: ./build/composer-diff.phar diff --help
172+
173+
- name: Upload Artifacts
174+
uses: actions/upload-artifact@v3
175+
continue-on-error: true
176+
with:
177+
name: Reports - ${{ matrix.php-version }}
178+
path: build/
179+
180+
181+
docker:
182+
name: Docker
183+
runs-on: ubuntu-latest
184+
needs: [ phar ]
185+
steps:
186+
- name: Checkout code
187+
uses: actions/checkout@v3
188+
with:
189+
fetch-depth: 0
190+
191+
- name: 🐳 Building Docker Image
192+
run: make build-docker
193+
194+
- name: Trying to use the Docker Image
195+
run: docker run --rm jbzoo-composer-diff diff --help

Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#
2+
# JBZoo Toolbox - Composer-Diff.
3+
#
4+
# This file is part of the JBZoo Toolbox project.
5+
# For the full copyright and license information, please view the LICENSE
6+
# file that was distributed with this source code.
7+
#
8+
# @license MIT
9+
# @copyright Copyright (C) JBZoo.com, All rights reserved.
10+
# @see https://github.com/JBZoo/Composer-Diff
11+
#
12+
13+
FROM php:8.1-cli-alpine
14+
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
15+
16+
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
17+
RUN chmod +x /usr/local/bin/install-php-extensions \
18+
&& sync \
19+
&& install-php-extensions \
20+
opcache \
21+
gd \
22+
zip \
23+
@composer
24+
25+
ENV COMPOSER_ALLOW_SUPERUSER=1
26+
COPY . /app
27+
RUN cd /app \
28+
&& composer install --no-dev --optimize-autoloader --no-progress \
29+
&& composer clear-cache
30+
31+
# Experimental. Forced colored output
32+
ENV TERM_PROGRAM=Hyper
33+
34+
ENTRYPOINT ["php", "/app/composer-diff.php"]

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ create-symlink: ##@Project Create Symlink (alias for testing)
3737
@ln -sfv `pwd`/build/composer-diff.phar `pwd`/vendor/bin/composer-diff
3838

3939

40+
build-docker: ##@Project Building Docker Image
41+
$(call title,"Building Docker Image")
42+
@docker build -t jbzoo-composer-diff .
43+
44+
4045
test-all: ##@Project Run all project tests at once
4146
@make test
4247
@make test-drupal

0 commit comments

Comments
 (0)