Skip to content

Commit

Permalink
chore: Add github workflows (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
jubianchi authored Jul 23, 2020
1 parent ead07e8 commit e1ad47e
Show file tree
Hide file tree
Showing 9 changed files with 148 additions and 109 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/Deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Test

on:
push:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-node-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-node-
- name: Build and push Docker images
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: pmsipilot/docker-compose-viz
tag_with_ref: true
43 changes: 43 additions & 0 deletions .github/workflows/Test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Test

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Validate composer.json
run: composer validate --ansi --strict

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-node-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress --no-suggest

- name: Unit tests
run: composer run ut

- name: Coding style
run: composer run cst

- name: Build and push Docker images
uses: docker/build-push-action@v1
with:
push: false
11 changes: 7 additions & 4 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
<?php

use PhpCsFixer as CS;

$finder = CS\Finder::create()
$finder = PhpCsFixer\Finder::create()
->in(__DIR__.DIRECTORY_SEPARATOR.'src')
->in(__DIR__.DIRECTORY_SEPARATOR.'spec')
;

return CS\Config::create()
return (new PhpCsFixer\Config())
->setRules([
'@PSR2' => true,
'@Symfony' => true,
'array_syntax' => ['syntax' => 'short'],
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => true,
])
->setFinder($finder)
;
40 changes: 0 additions & 40 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ docker: docker.lock
test: vendor unit cs

unit: vendor
$(PHP) bin/kahlan --pattern='*.php' --reporter=verbose --persistent=false --cc=true
$(COMPOSER) run ut

cs:
$(PHP) bin/php-cs-fixer fix --dry-run
$(COMPOSER) run cst

fix-cs:
$(PHP) bin/php-cs-fixer fix
$(COMPOSER) run cs

clean:
rm -rf vendor/
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# `docker-compose-viz`

[![Build Status](https://img.shields.io/travis/pmsipilot/docker-compose-viz/master.svg?style=flat-square)](https://travis-ci.org/pmsipilot/docker-compose-viz)
[![StyleCI](https://styleci.io/repos/65026022/shield)](https://styleci.io/repos/65026022)
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/pmsipilot/docker-compose-viz.svg)](http://isitmaintained.com/project/pmsipilot/docker-compose-viz "Average time to resolve an issue")
[![Percentage of issues still open](http://isitmaintained.com/badge/open/pmsipilot/docker-compose-viz.svg)](http://isitmaintained.com/project/pmsipilot/docker-compose-viz "Percentage of issues still open")
[![Docker Stars](https://img.shields.io/docker/stars/pmsipilot/docker-compose-viz.svg?style=flat)](https://hub.docker.com/r/pmsipilot/docker-compose-viz/)
Expand Down
10 changes: 6 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"graphp/graphviz": "^0.2"
},
"require-dev": {
"crysalead/kahlan": "^2.5.4",
"friendsofphp/php-cs-fixer": "^2"
"friendsofphp/php-cs-fixer": "^2",
"kahlan/kahlan": "^4.7"
},
"license": "MIT",
"authors": [
Expand All @@ -25,7 +25,9 @@
"PMSIpilot\\DockerComposeViz\\": "src/"
}
},
"config": {
"bin-dir": "bin/"
"scripts": {
"cs": "php-cs-fixer fix",
"cst": "php-cs-fixer fix --dry-run",
"ut": "kahlan --grep='*.php' --reporter=verbose --persistent=false"
}
}
110 changes: 56 additions & 54 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ function makeVerticesAndEdges(Graph $graph, array $services, array $volumes, arr
if (false === ((bool) ($flags & WITHOUT_NETWORKS))) {
foreach ($networks as $network => $definition) {
addNetwork(
$graph, 'net: '.$network,
$graph,
'net: '.$network,
isset($definition['external']) && true === $definition['external'] ? 'external_network' : 'network'
);
}
Expand All @@ -237,7 +238,7 @@ function makeVerticesAndEdges(Graph $graph, array $services, array $volumes, arr

if (isset($definition['extends'])) {
if (isset($definition['extends']['file'])) {
$configuration = readConfiguration(dirname($path) . DIRECTORY_SEPARATOR . $definition['extends']['file']);
$configuration = readConfiguration(dirname($path).DIRECTORY_SEPARATOR.$definition['extends']['file']);
$extendedServices = fetchServices($configuration);
$extendedVolumes = fetchVolumes($configuration);
$extendedNetworks = fetchVolumes($configuration);
Expand Down

0 comments on commit e1ad47e

Please sign in to comment.