Skip to content

Commit

Permalink
Updated project structure. (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
tannguyen04 authored Dec 12, 2023
1 parent 2d82382 commit 1497772
Show file tree
Hide file tree
Showing 13 changed files with 240 additions and 45 deletions.
14 changes: 7 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,26 @@ jobs:
command: composer validate --ansi --strict
- run:
name: Start containers.
command: docker-compose up -d --build
command: docker compose up -d --build
- run:
name: Copy codebase into container.
command: docker cp -L /app/. $(docker-compose ps -q phpserver):/app/
command: docker cp -L /app/. $(docker compose ps -q phpserver):/app/
- run:
name: Install dev dependencies.
command: docker-compose exec phpserver composer install --ansi --no-suggest
command: docker compose exec phpserver composer install --ansi --no-suggest
- run:
name: Lint code.
command: docker-compose exec phpserver vendor/bin/phpcs
command: docker compose exec phpserver vendor/bin/phpcs
- run:
name: Run tests.
command: |
docker-compose exec phpserver mkdir -p /app/screenshots
docker-compose exec phpserver vendor/bin/behat
docker compose exec phpserver mkdir -p /app/screenshots
docker compose exec phpserver vendor/bin/behat
- run:
name: Copy artifacts.
command: |
mkdir -p /tmp/artifacts/behat
docker cp $(docker-compose ps -q phpserver):/app/screenshots /tmp/artifacts/behat
docker cp $(docker compose ps -q phpserver):/app/screenshots /tmp/artifacts/behat
when: always
- store_artifacts:
path: /tmp/artifacts
19 changes: 19 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Checklist before requesting a review

- [ ] I have formatted the subject to include ticket number
as `[PRJ-123] Verb in past tense with dot at the end.`
- [ ] I have added a link to the issue tracker
- [ ] I have provided information in `Changed` section about WHY something was
done if this was not a normal implementation
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] I have run new and existing relevant tests locally with my changes, and
they passed
- [ ] I have provided screenshots, where applicable

## Changed

1.

## Screenshots
12 changes: 12 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name-template: '$NEXT_MINOR_VERSION'
tag-template: '$NEXT_MINOR_VERSION'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
template: |
## What's new since $PREVIOUS_TAG
$CHANGES
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...$NEXT_MINOR_VERSION
$CONTRIBUTORS
16 changes: 16 additions & 0 deletions .github/workflows/auto-assign-pr-author.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 'Auto Author Assign'

on:
pull_request_target:
types:
- opened
- reopened

permissions:
pull-requests: write

jobs:
assign-author:
runs-on: ubuntu-latest
steps:
- uses: toshimaru/auto-author-assign@v2.0.1
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Release

on:
push:
tags:
- '*'
branches:
- master

permissions:
contents: write

jobs:
release-drafter:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release-php:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
- uses: php-actions/composer@v6
- name: Build and test
run: composer build
- name: Get Tag Name
id: get-version
run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
46 changes: 30 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
# Behat Progress Fail Output Extension
Behat output formatter to show progress as TAP and fails inline.
<p align="center">
<a href="" rel="noopener">
<img width=200px height=200px src="https://placehold.jp/000000/ffffff/200x200.png?text=Behat+Progress+Fail+Output&css=%7B%22border-radius%22%3A%22%20100px%22%7D" alt="Yourproject logo"></a>
</p>

<h1 align="center">Behat Progress Fail Output Extension</h1>

<div align="center">

[![GitHub Issues](https://img.shields.io/github/issues/drevops/behat-format-progress-fail.svg)](https://github.com/drevops/behat-format-progress-fail/issues)
[![GitHub Pull Requests](https://img.shields.io/github/issues-pr/drevops/behat-format-progress-fail.svg)](https://github.com/drevops/behat-format-progress-fail/pulls)
[![CircleCI](https://circleci.com/gh/drevops/behat-format-progress-fail.svg?style=shield)](https://circleci.com/gh/drevops/behat-format-progress-fail)
![GitHub release (latest by date)](https://img.shields.io/github/v/release/drevops/behat-format-progress-fail)
[![Total Downloads](https://poser.pugx.org/drevops/behat-format-progress-fail/downloads)](https://packagist.org/packages/drevops/behat-format-progress-fail)
![LICENSE](https://img.shields.io/github/license/drevops/behat-format-progress-fail)
![Renovate](https://img.shields.io/badge/renovate-enabled-green?logo=renovatebot)

</div>

## Features

- Behat output formatter to show progress as TAP and fails inline.

## Output
```
..
--- FAIL ---
Expand All @@ -24,44 +36,46 @@ Behat output formatter to show progress as TAP and fails inline.

![Output in CI](https://cloud.githubusercontent.com/assets/378794/26039517/1765b812-395f-11e7-9932-dd1aa43a97d4.png)

## Installing
## Installation

```bash
composer require --dev drevops/behat-format-progress-fail
```

## Configure
## Usage

```bash
vendor/bin/behat --format=progress_fail
```

### Configure

>behat.yml
```yaml
default:
extensions:
DrevOps\BehatFormatProgressFail\FormatExtension: ~
```
## Usage
```bash
vendor/bin/behat --format=progress_fail
```
## Maintenance
### Local development setup
1. Install Docker.
2. Start environment: `docker-compose up -d --build`.
3. Install dependencies: `docker-compose exec phpserver composer install --ansi --no-suggest`.
2. Start environment: `docker compose up -d --build`.
3. Install dependencies: `docker compose exec phpserver composer install --ansi --no-suggest`.

### Lint code

```bash
docker-compose exec phpserver vendor/bin/phpcs
docker compose exec phpserver composer lint
docker compose exec phpserver composer lint:fix
```

### Run tests

```bash
docker-compose exec phpserver vendor/bin/behat
docker compose exec phpserver vendor/bin/behat
```

### Enable Xdebug
Expand All @@ -73,5 +87,5 @@ XDEBUG_ENABLE=true docker-compose up -d phpserver
To disable, run

```bash
docker-compose up -d phpserver
docker compose up -d phpserver
```
30 changes: 28 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
{
"name": "drevops/behat-format-progress-fail",
"description": "Behat output formatter to show progress as TAP and fails inline.",
"type": "library",
"description": "Behat output formatter to show progress as TAP and fails inline.",
"license": "GPL-2.0-or-later",
"authors": [
{
"name": "Alex Skrypnyk",
"email": "alex@drevops.com"
}
],
"homepage": "https://github.com/drevops/behat-format-progress-fail",
"support": {
"issues": "https://github.com/drevops/behat-format-progress-fail/issues",
"source": "https://github.com/drevops/behat-format-progress-fail"
},
"require": {
"behat/behat": "^3.3"
},
Expand All @@ -19,11 +24,32 @@
"squizlabs/php_codesniffer": "^3",
"escapestudios/symfony2-coding-standard": "^3",
"phpunit/phpunit": "^9.5",
"symfony/process": "^5.3"
"symfony/process": "^5.3",
"phpstan/phpstan": "^1.10",
"phpmd/phpmd": "^2.14"
},
"autoload": {
"psr-0": {
"DrevOps\\BehatFormatProgressFail": "src/"
}
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"scripts": {
"lint": [
"phpcs",
"phpmd --exclude vendor,vendor-bin,node_modules . text phpmd.xml",
"phpstan"
],
"lint:fix": "phpcbf",
"test": "vendor/bin/behat",
"build": [
"@composer bin box require --dev humbug/box",
"box validate",
"box compile"
]
}
}
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '2'
services:
phpserver:
image: amazeeio/php:7.4-cli-drupal
image: amazeeio/php:8.1-cli-drupal
volumes:
- .:/app:delegated
environment:
Expand Down
24 changes: 24 additions & 0 deletions phpmd.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0"?>
<ruleset name="Custom PHPMD ruleset."
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">

<rule ref="rulesets/unusedcode.xml"/>
<rule ref="rulesets/codesize.xml">
<exclude name="TooManyPublicMethods" />
</rule>
<rule ref="rulesets/codesize.xml/TooManyPublicMethods">
<properties>
<property name="maxmethods" value="25"/>
</properties>
</rule>
<rule ref="rulesets/cleancode.xml/MissingImport">
<properties>
<property name="ignore-global" value="true"/>
</properties>
</rule>

<exclude-pattern>*/tests/*Test.php</exclude-pattern>
</ruleset>
16 changes: 16 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
##
# Configuration file for PHPStan static code checking, see https://phpstan.org .
#

parameters:

level: 9

paths:
- src
- tests

excludePaths:
- vendor/*
- node_modules/*
- tests/behat/features/bootstrap
7 changes: 7 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"dependencyDashboard": true,
"extends": [
"config:base"
]
}
8 changes: 4 additions & 4 deletions src/DrevOps/BehatFormatProgressFail/FormatExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class FormatExtension implements ExtensionInterface
/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
}

Expand All @@ -57,14 +57,14 @@ public function getConfigKey()
/**
* {@inheritdoc}
*/
public function initialize(ExtensionManager $extensionManager)
public function initialize(ExtensionManager $extensionManager): void
{
}

/**
* {@inheritdoc}
*/
public function configure(ArrayNodeDefinition $builder)
public function configure(ArrayNodeDefinition $builder): void
{
$builder->children()->scalarNode('name')->defaultValue(self::MOD_ID);
$builder->children()->scalarNode('base_path')->defaultValue(self::BASE_PATH);
Expand All @@ -73,7 +73,7 @@ public function configure(ArrayNodeDefinition $builder)
/**
* {@inheritdoc}
*/
public function load(ContainerBuilder $container, array $config)
public function load(ContainerBuilder $container, array $config): void
{
$definition = new Definition(
'Behat\Behat\Output\Node\EventListener\AST\StepListener', [
Expand Down
Loading

0 comments on commit 1497772

Please sign in to comment.