-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP Use only docker in GitHub actions
- Loading branch information
Showing
8 changed files
with
60 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
name: "coding standards" | ||
name: "docker coding standards" | ||
|
||
on: ["pull_request", "push"] | ||
|
||
jobs: | ||
coding-standards: | ||
name: "coding standards" | ||
name: "docker coding standards" | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: "checkout" | ||
uses: "actions/checkout@v2" | ||
|
||
- name: "installing PHP" | ||
uses: "shivammathur/setup-php@v2" | ||
with: | ||
php-version: "7.4" | ||
ini-values: memory_limit=-1 | ||
tools: composer:v2, cs2pr, php-cs-fixer | ||
- name: "build the environment" | ||
run: "dev/bin/docker-compose build" | ||
|
||
- name: "checking coding standards" | ||
run: "php-cs-fixer fix --dry-run --diff --ansi" | ||
run: "dev/bin/php php-cs-fixer fix --dry-run --diff --ansi" | ||
|
||
- name: Clear docker volumes | ||
if: ${{ always() }} | ||
run: dev/bin/docker-compose down --volumes |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,24 @@ | ||
name: "static analysis" | ||
name: "docker static analysis" | ||
|
||
on: ["pull_request", "push"] | ||
|
||
jobs: | ||
static-analysis: | ||
name: "static analysis" | ||
name: "docker static analysis" | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: "checkout" | ||
uses: "actions/checkout@v2" | ||
|
||
- name: "installing PHP" | ||
uses: "shivammathur/setup-php@v2" | ||
with: | ||
php-version: "7.4" | ||
ini-values: memory_limit=-1 | ||
tools: composer:v2, psalm | ||
extensions: intl, bcmath, curl, openssl, mbstring, pdo, pdo_sqlite | ||
- name: "build the environment" | ||
run: "dev/bin/docker-compose build" | ||
|
||
- name: "installing dependencies" | ||
run: "composer update --no-interaction --no-progress" | ||
- name: "install dependencies" | ||
run: "dev/bin/php composer install" | ||
|
||
- name: "running static analysis" | ||
run: "psalm --shepherd --stats" | ||
run: "dev/bin/php psalm --shepherd --stats" | ||
|
||
- name: Clear docker volumes | ||
if: ${{ always() }} | ||
run: dev/bin/docker-compose down --volumes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,32 @@ | ||
name: "unit tests" | ||
name: "docker unit tests" | ||
|
||
on: [ "pull_request", "push" ] | ||
on: ["pull_request", "push"] | ||
|
||
jobs: | ||
unit-tests: | ||
name: "unit tests" | ||
|
||
runs-on: "ubuntu-latest" | ||
|
||
strategy: | ||
matrix: | ||
symfony-version: | ||
- "5.3.*" | ||
php-version: | ||
- "7.2" | ||
- "7.3" | ||
- "7.4" | ||
- "8.0" | ||
dependencies: | ||
- "lowest" | ||
- "highest" | ||
|
||
steps: | ||
- name: "checkout" | ||
uses: "actions/checkout@v2" | ||
|
||
- name: "installing PHP" | ||
uses: "shivammathur/setup-php@v2" | ||
with: | ||
php-version: "${{ matrix.php-version }}" | ||
tools: composer:v2, cs2pr | ||
extensions: intl, bcmath, curl, openssl, mbstring, pdo, pdo_sqlite | ||
coverage: pcov | ||
ini-values: memory_limit=-1 | ||
|
||
- name: "caching dependencies" | ||
uses: "actions/cache@v2" | ||
with: | ||
path: | | ||
~/.composer/cache | ||
vendor | ||
key: "php-${{ matrix.php-version }}" | ||
restore-keys: "php-${{ matrix.php-version }}" | ||
|
||
- name: "configuring composer platform" | ||
if: (startsWith(matrix.php, '8.0')) | ||
run: composer config platform.php 7.4.99 | ||
|
||
- name: "install lowest dependencies" | ||
if: ${{ matrix.dependencies == 'lowest' }} | ||
run: composer update --prefer-lowest --no-interaction --no-progress --prefer-dist | ||
|
||
- name: "install highest dependencies" | ||
if: ${{ matrix.dependencies == 'highest' }} | ||
run: | | ||
composer require --no-update symfony/config=${{ matrix.symfony-version }} symfony/http-kernel=${{ matrix.symfony-version }} symfony/dependency-injection=${{ matrix.symfony-version }} symfony/options-resolver=${{ matrix.symfony-version }} | ||
composer require --no-update --dev symfony/framework-bundle=${{ matrix.symfony-version }} symfony/yaml=${{ matrix.symfony-version }} | ||
composer update --no-interaction --no-progress --prefer-dist | ||
- name: "installing phpunit" | ||
run: vendor/bin/simple-phpunit install | ||
|
||
- name: "running unit tests" | ||
run: vendor/bin/simple-phpunit | ||
unit-tests: | ||
name: "docker unit tests" | ||
runs-on: "ubuntu-latest" | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
php: [ '7.2', '7.3', '7.4', '8.0' ] | ||
symfony: [ '5.3' ] | ||
composer-flags: [ '', '--prefer-lowest', '--prefer-stable'] | ||
env: | ||
SYMFONY_REQUIRE: ${{ matrix.symfony }}.* | ||
steps: | ||
- name: "checkout" | ||
uses: "actions/checkout@v2" | ||
|
||
- name: "build the environment" | ||
run: "dev/bin/docker-compose build --build-arg PHP_VERSION=${{ matrix.php }} php" | ||
|
||
- name: "install dependencies" | ||
run: "dev/bin/php composer update --ansi ${{ matrix.composer-flags }}" | ||
|
||
- name: "running unit tests" | ||
run: "dev/bin/php-test vendor/bin/simple-phpunit --colors=always" | ||
|
||
- name: Clear docker volumes | ||
if: ${{ always() }} | ||
run: dev/bin/docker-compose down --volumes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,8 @@ | ||
ARG PHP_VERSION=7.4 | ||
|
||
FROM php:${PHP_VERSION}-cli-alpine3.14 | ||
FROM php:${PHP_VERSION}-cli-alpine | ||
LABEL maintainer="Petar Obradović <[email protected]>" | ||
|
||
ARG COMPOSER_VERSION=2.1.9 | ||
ARG FLEX_VERSION=1.17.1 | ||
ARG PHP_CS_FIXER_VERSION=3.2.1 | ||
ARG XDEBUG_VERSION=3.1.1 | ||
ARG PSALM_VERSION=4.11.2 | ||
|
||
ENV XDEBUG_START_WITH_REQUEST 0 | ||
|
||
# This is where we're going to store all of our non-project specific binaries | ||
RUN mkdir -p /app/bin | ||
ENV PATH /app/bin:$PATH | ||
|
@@ -25,13 +17,15 @@ RUN apk add --update --no-cache --virtual .build-deps \ | |
xml \ | ||
zip \ | ||
&& pecl install \ | ||
xdebug-${XDEBUG_VERSION} \ | ||
xdebug \ | ||
&& docker-php-ext-enable \ | ||
xdebug \ | ||
&& apk del --purge .build-deps | ||
|
||
RUN mv ${PHP_INI_DIR}/php.ini-development ${PHP_INI_DIR}/php.ini | ||
|
||
ENV XDEBUG_START_WITH_REQUEST 0 | ||
|
||
RUN echo '[xdebug]' >> ${PHP_INI_DIR}/conf.d/docker-php-ext-xdebug.ini \ | ||
&& echo 'xdebug.start_with_request = ${XDEBUG_START_WITH_REQUEST}' >> ${PHP_INI_DIR}/conf.d/docker-php-ext-xdebug.ini \ | ||
&& echo 'xdebug.mode = debug' >> ${PHP_INI_DIR}/conf.d/docker-php-ext-xdebug.ini \ | ||
|
@@ -47,26 +41,25 @@ RUN apk add --update --no-cache \ | |
shadow | ||
|
||
# Composer | ||
RUN curl --show-error https://getcomposer.org/installer | php -- \ | ||
--install-dir=/app/bin \ | ||
--filename=composer \ | ||
--version=${COMPOSER_VERSION} | ||
RUN curl --location --output /app/bin/composer --show-error \ | ||
https://github.com/composer/composer/releases/latest/download/composer.phar \ | ||
&& chmod a+x /app/bin/composer | ||
|
||
# PHP-CS-Fixer | ||
RUN curl --location --output /app/bin/php-cs-fixer --show-error \ | ||
https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v${PHP_CS_FIXER_VERSION}/php-cs-fixer.phar \ | ||
https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/latest/download/php-cs-fixer.phar \ | ||
&& chmod a+x /app/bin/php-cs-fixer | ||
|
||
# Psalm | ||
RUN curl --location --output /app/bin/psalm --show-error \ | ||
https://github.com/vimeo/psalm/releases/download/${PSALM_VERSION}/psalm.phar \ | ||
https://github.com/vimeo/psalm/releases/latest/download/psalm.phar \ | ||
&& chmod a+x /app/bin/psalm | ||
|
||
# Create the user that's going to run our application | ||
RUN useradd -ms /bin/sh app | ||
|
||
# Enable parallel package installation for Composer | ||
RUN su-exec app composer global require symfony/flex:${FLEX_VERSION} | ||
RUN su-exec app composer global require symfony/flex | ||
|
||
COPY entrypoint.sh /usr/local/bin/docker-entrypoint | ||
|
||
|