Skip to content

Commit

Permalink
Merge pull request #158 from ConductionNL/dev-bundleRunner-2021062313…
Browse files Browse the repository at this point in the history
…5352

Readme update (badges + description)
  • Loading branch information
rjzondervan authored Jun 23, 2021
2 parents 94781d7 + 4373064 commit b4ac5b0
Show file tree
Hide file tree
Showing 47 changed files with 3,307 additions and 1,888 deletions.
8 changes: 4 additions & 4 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
# The shortcode for this component, should be a small set of letters reprecentint the application (use only letters, capitals and spaces)
APP_NAME=proto-component-commonground

APP_NAME_TECHNICAL=proto-component-commonground
APP_NAME_TECHNCICAL=proto-component-commonground


# The description for this api
APP_DESCRIPTION=Het Proto Component vormt zowel de gemeenschappelijke basis onder alle componenten, als een “template” voor het maken van nieuwe componenten.
BADGES=[![StyleCI](https://github.styleci.io/repos/198371552/shield?branch=master)](https://github.styleci.io/repos/198371552?branch=master),[![Docker Image CI](https://github.com/ConductionNL/Proto-component-commonground/workflows/Docker%20Image%20CI/badge.svg?branch=master)](https://github.com/ConductionNL/Proto-component-commonground/actions?query=workflow%3A"Docker+Image+CI"),[![Artifacthub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/proto-component-commonground)](https://artifacthub.io/packages/helm/proto-component-commonground/proto-component-commonground),[![BCH compliance](https://bettercodehub.com/edge/badge/ConductionNL/Proto-component-commonground?branch=master)](https://bettercodehub.com/),[![Status badge](https://shields.api-test.nl/endpoint.svg?style=for-the-badge&url=https%3A//api-test.nl/api/v1/provider-latest-badge/b5afe4ac-8c11-41c8-9028-27c5ac234fa6/)](https://api-test.nl/server/4/5a4a23e8-d342-4dd6-bac9-2bbb17b32018/b5afe4ac-8c11-41c8-9028-27c5ac234fa6/latest/)

# The current version of the application
APP_VERSION=V1.0
APP_MAJOR_VERSION=v1
Expand Down Expand Up @@ -81,10 +82,9 @@ APP_REPRO=https://github.com/ConductionNL/Proto-component-commonground
# Docker settings
##################################################

CONTAINER_REGISTRY_BASE=docker.io/conduction
CONTAINER_REGISTRY_BASE=ghcr.io/conductionnl
HELM_REPOSITORY=https://raw.githubusercontent.com/ConductionNL/Proto-component-commonground/master/api/helm/
CONTAINER_PROJECT_NAME=proto-component-commonground

##################################################
# Notifcation settings
##################################################
Expand Down
67 changes: 39 additions & 28 deletions .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,41 +70,52 @@ jobs:
#- name: Database Check
# run: docker-compose exec -T php bin/console doctrine:schema:validate
- name: Security Checks
run: docker-compose exec -T php composer req sensiolabs/security-checker
run: |
curl -L -sS --output local-php-security-checker https://github.com/fabpot/local-php-security-checker/releases/download/v1.0.0/local-php-security-checker_1.0.0_linux_amd64
chmod +x ./local-php-security-checker
./local-php-security-checker --path ./api/composer.lock
- uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
name: codecov-umbrella
fail_ci_if_error: true
verbose: true
#- name: Run Postman Tests
# if: contains( github.ref, 'master' ) == false && contains( github.base_ref, 'master' ) == false
# run: newman run api/public/schema/*.postman_collection.json
# - name: Add docker tags
# if: github.ref == 'refs/heads/master'
# run: |
# images=$(docker-compose images -q | xargs docker inspect --format='{{ index .RepoTags 0}}' | cut -d':' -f1 | grep $APP_NAME_TECHNICAL)
# for image in $images
# do
# docker tag "${image}":latest "${image}":"${APP_BUILD}"
# done
# echo 'IMAGES=$images' >> $GITHUB_ENV
- name: Add docker tags
if: github.ref == 'refs/heads/master'
run: |
images=$(docker-compose images -q | xargs docker inspect --format='{{ index .RepoTags 0}}' | cut -d':' -f1 | grep $APP_NAME)
for image in $images
do
docker tag "${image}":latest "${image}":"${APP_BUILD}"
done
echo 'IMAGES=$images' >> $GITHUB_ENV
- name: Show all images
run: docker images
- name: Login to DockerHub Registry
id: dockerhub-login
- name: Login to Container Registry
id: containerregistry-login
run: |
if [ "${{ secrets.DOCKERHUB_PASSWORD }}" != "" ] && [ "${{ secrets.DOCKERHUB_USERNAME }}" != "" ]; then
echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
echo "##[set-output name=success;]true"
else
echo "##[set-output name=success;]false"
fi
- if: steps.dockerhub-login.outputs.success == 'true' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/development')
name: Push to docker hub
if [ "${{ secrets.GITHUB_TOKEN }}" != "" ]; then
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $(cut -d'/' -f1 <<< $GITHUB_REPOSITORY) --password-stdin
echo "##[set-output name=success;]true"
else
echo "##[set-output name=success;]false"
fi
- if: steps.containerregistry-login.outputs.success == 'true' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/development')
name: Push to Container Registry
run: docker-compose push
# - if: steps.dockerhub-login.outputs.success == 'true' && github.ref == 'refs/heads/master'
# name: Push versioned containers to Docker Hub
# run: |
# images=$(docker-compose images -q | xargs docker inspect --format='{{ index .RepoTags 0}}' | cut -d':' -f1 | grep $APP_NAME)
# for image in $images
# do
# docker push "${image}":"${APP_BUILD}"
# done

- if: steps.containerregistry-login.outputs.success == 'true' && github.ref == 'refs/heads/master'
name: Push versioned containers to Container Registry
run: |
images=$(docker-compose images -q | xargs docker inspect --format='{{ index .RepoTags 0}}' | cut -d':' -f1 | grep $APP_NAME)
for image in $images
do
docker push "${image}":"${APP_BUILD}"
done
- name: Create kube config
id: kubeconfig
if: contains( github.ref, 'development' )
Expand Down
25 changes: 25 additions & 0 deletions api/.bettercodehub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
component_depth: 3
languages:
- php
exclude:
- /nlx-setup/.*
- /resources/.*
- /api/bin/.*
- /api/config/.*
- /api/docker/.*
- /api/docs/.*
- /api/helm/.*
- /api/migrations/.*
- /api/nlx-setup/.*
- /api/public/.*
- /api/templates/.*
- /api/translations/.*
- /api/var/.*
- /api/vendor/.*
- /api/src/Entity/.*
- /api/src/DataFixtures/.*
- /api/src/Repository/.*
- /api/src/Kernel.php
test:
include:
- /api/tests/TrouwServiceTest.php
5 changes: 5 additions & 0 deletions api/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@
/.php_cs
/.php_cs.cache
###< friendsofphp/php-cs-fixer ###

###> symfony/phpunit-bridge ###
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###
45 changes: 12 additions & 33 deletions api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ COPY src src/
COPY templates templates/
COPY translations translations/

RUN apk add --no-cache $PHPIZE_DEPS \
&& pecl install xdebug-2.9.2 \
&& docker-php-ext-enable xdebug;\
echo -e "xdebug.overload_var_dump=off" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini

RUN set -eux; \
mkdir -p var/cache var/log; \
composer dump-autoload --classmap-authoritative --no-dev; \
Expand All @@ -53,50 +58,24 @@ RUN chmod +x /usr/local/bin/docker-entrypoint
ENTRYPOINT ["docker-entrypoint"]
CMD ["php-fpm"]

#############################
# "nginx" stage #
#############################
# depends on the "php" stage above, and with an litle bit of help from https://github.com/shiphp/nginx-env
FROM conduction/pc-nginx:prod AS api_platform_nginx

# Due to our config we need a copy of the public folder for serving static content
COPY docker/nginx/conf.d/default.conf.template /etc/nginx/conf.d/default.conf
WORKDIR /srv/api
COPY --from=api_platform_php /srv/api/public public/

#############################
# "varnish" stage #
#############################
# does not depend on any of the above stages, but placed here to keep everything in one Dockerfile
FROM conduction/pc-varnish:prod AS api_platform_varnish

COPY docker/varnish/conf/default.vcl /etc/varnish/conf.d/
# Lets install envsubst
#RUN apk --no-cache add gettext

#COPY docker/varnish/conf /usr/local/etc/varnish/

#RUN envsubst '$PHP_SERVICE' < /usr/local/etc/varnish/default.vcl.template > /usr/local/etc/varnish/default.vcl

# Lets parse the toml file
# RUN envsubst < /usr/local/etc/varnish/default.vcl.template > /usr/local/etc/varnish/default.vcl

#############################
# NLX Outway #
#############################
# does not depend on any of the above stages, but placed here to keep everything in one Dockerfile
FROM nlxio/outway AS api-nlx-outway

COPY nlx-setup /certs/
#FROM nlxio/outway AS api-nlx-outway
#
#COPY nlx-setup /certs/

#############################
# NLX Inway #
#############################
# depends on the "php" stage above
FROM nlxio/inway AS api-nlx-inway

COPY nlx-setup /certs/
COPY nlx-setup/service-config.toml.template /service-config.toml.template
#FROM nlxio/inway AS api-nlx-inway
#
#COPY nlx-setup /certs/
#COPY nlx-setup/service-config.toml.template /service-config.toml.template

# Lets install envsubst
#RUN apk --no-cache add gettext
Expand Down
13 changes: 13 additions & 0 deletions api/Dockerfile-nginx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#############################
# "nginx" stage #
#############################
# depends on the "php" stage above, and with an litle bit of help from https://github.com/shiphp/nginx-env
FROM nginx:latest AS api_platform_nginx

# Due to our config we need a copy of the public folder for serving static content
COPY docker/nginx/conf.d/default.conf.template /etc/nginx/templates/default.conf.template
WORKDIR /srv/api
COPY public public/

RUN apt update; \
apt upgrade -y
19 changes: 19 additions & 0 deletions api/bin/phpunit
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php

if (!ini_get('date.timezone')) {
ini_set('date.timezone', 'UTC');
}

if (is_file(dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit')) {
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php');
require PHPUNIT_COMPOSER_INSTALL;
PHPUnit\TextUI\Command::main();
} else {
if (!is_file(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
exit(1);
}

require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
}
26 changes: 16 additions & 10 deletions api/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,32 @@
"ext-ctype": "*",
"ext-iconv": "*",
"api-platform/api-pack": "^1.1",
"conduction/commongroundbundle": "dev-symfony51",
"phpdocumentor/reflection-docblock": "^4.3",
"conduction/commongroundbundle": "^2.*-dev",
"phpdocumentor/reflection-docblock": "^5.1",
"sensio/framework-extra-bundle": "^5.5",
"sensiolabs/security-checker": "^6.0",
"symfony/asset": "5.1.*",
"symfony/console": "5.1.*",
"symfony/dotenv": "5.1.*",
"symfony/asset": "^5.1",
"symfony/console": "5.1",
"symfony/dotenv": "^5.1",
"symfony/flex": "^1.1",
"symfony/framework-bundle": "5.1.*",
"symfony/framework-bundle": "^5.1",
"symfony/mercure-bundle": "*",
"symfony/property-access": "5.1.*",
"symfony/translation": "5.1.*",
"symfony/yaml": "5.1.*",
"symfony/property-access": "^5.1",
"symfony/translation": "^5.1",
"symfony/yaml": "^5.1",
"tbbc/money-bundle": "^4.0",
"webonyx/graphql-php": "^0.13.8"
},
"require-dev" : {
"api-platform/schema-generator": "^2.1",
"phpunit/phpunit": "^9",
"phar-io/manifest": "^2.0.1",
"phar-io/version": "^3.0.1",
"phpspec/prophecy": "^1.11.1",
"phpunit/php-code-coverage": "^9",
"phpunit/phpunit": "^9.3",
"sebastian/global-state": "^5.0",
"symfony/maker-bundle": "^1.11",
"symfony/phpunit-bridge": "^5.1",
"symfony/profiler-pack": "^1.0"
},
"config" : {
Expand Down
Loading

0 comments on commit b4ac5b0

Please sign in to comment.