Skip to content

Commit 9538c92

Browse files
authored
Initialize SonarCloud and tools
Review PHPUnit settings
1 parent a6379d3 commit 9538c92

File tree

6 files changed

+144
-7
lines changed

6 files changed

+144
-7
lines changed

.github/CODE_OF_CONDUCT.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
## Our Standards
8+
9+
Examples of behavior that contributes to creating a positive environment include:
10+
11+
* Using welcoming and inclusive language
12+
* Being respectful of differing viewpoints and experiences
13+
* Gracefully accepting constructive criticism
14+
* Focusing on what is best for the community
15+
* Showing empathy towards other community members
16+
17+
Examples of unacceptable behavior by participants include:
18+
19+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
20+
* Trolling, insulting/derogatory comments, and personal or political attacks
21+
* Public or private harassment
22+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
23+
* Other conduct which could reasonably be considered inappropriate in a professional setting
24+
25+
## Our Responsibilities
26+
27+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28+
29+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30+
31+
## Scope
32+
33+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34+
35+
## Enforcement
36+
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38+
39+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40+
41+
## Attribution
42+
43+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44+
45+
[homepage]: http://contributor-covenant.org
46+
[version]: http://contributor-covenant.org/version/1/4/

.github/CONTRIBUTING.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Contributing
2+
3+
Contributions are **welcome** and will be fully **credited**.
4+
5+
We accept contributions via pull requests on [Github].
6+
Please make all pull requests to the `develop` branch, not the `master` branch.
7+
8+
## Before posting an issue
9+
10+
- If a command is failing, post the full output you get when running the command, with the `--verbose` argument
11+
12+
## Pull Requests
13+
14+
- **Create an issue** - Explain as detailed as possible the issue you encountered so we can understand the context of your pull request
15+
- **[Symfony Coding Standard]** - The easiest way to apply the conventions is to run `composer lint`
16+
- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
17+
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
18+
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
19+
- **Create feature branches** - Don't ask us to pull from your master branch.
20+
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
21+
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting.
22+
23+
## Running Tests
24+
25+
``` bash
26+
$ composer test
27+
```
28+
29+
**Happy coding**!
30+
31+
[Github]: https://github.com/wsdltophp/wssecurity
32+
[Symfony Coding Standard]: http://symfony.com/doc/current/contributing/code/standards.html

.github/workflows/sonarcloud.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: SonarCloud
2+
on:
3+
push:
4+
branches:
5+
- develop
6+
- feature/*
7+
- feat/*
8+
pull_request:
9+
types: [ opened, synchronize, reopened ]
10+
jobs:
11+
sonarcloud:
12+
name: SonarCloud
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Setup PHP with Xdebug
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: 7.4
23+
coverage: xdebug
24+
25+
- name: Install dependencies with composer
26+
run: composer update --no-ansi --no-interaction --no-progress
27+
28+
- name: Generate coverage report with phpunit/phpunit
29+
run: vendor/bin/phpunit --coverage-clover coverage.xml --log-junit report.xml
30+
31+
- name: Monitor coverage
32+
uses: slavcodev/coverage-monitor-action@v1
33+
with:
34+
github_token: ${{ secrets.SECRET_GITHUB_TOKEN }}
35+
coverage_path: coverage.xml
36+
threshold_alert: 75
37+
threshold_warning: 95
38+
39+
- name: Codecov analyze
40+
uses: codecov/codecov-action@v3
41+
with:
42+
files: coverage.xml
43+
44+
- name: Fix phpunit files paths
45+
run: sed -i 's@'$GITHUB_WORKSPACE/'@''@g' coverage.xml report.xml
46+
47+
- name: SonarCloud Scan
48+
uses: SonarSource/sonarcloud-github-action@master
49+
env:
50+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

phpunit.xml.dist

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="vendor/autoload.php">
33
<coverage>
44
<include>
5-
<directory>./</directory>
5+
<directory>./src</directory>
66
</include>
7-
<exclude>
8-
<directory>./src/resources</directory>
9-
<directory>./tests</directory>
10-
<directory>./vendor</directory>
11-
</exclude>
127
</coverage>
138
<testsuites>
149
<testsuite name="full">

sonar-project.properties

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
sonar.projectKey=WsdlToPhp_WsSecurity
2+
sonar.organization=wsdltophp
3+
sonar.php.coverage.reportPaths=coverage.xml
4+
sonar.php.tests.reportPath=report.xml
5+
6+
# This is the name and version displayed in the SonarCloud UI.
7+
#sonar.projectName=WsSecurity
8+
#sonar.projectVersion=1.0
9+
10+
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
11+
#sonar.sources=.
12+
13+
# Encoding of the source code. Default is default system encoding
14+
#sonar.sourceEncoding=UTF-8

tests/WsSecurityTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
/**
1111
* @internal
12-
* @coversDefaultClass
12+
* @coversDefaultClass \WsdlToPhp\WsSecurity\WsSecurity
1313
*/
1414
final class WsSecurityTest extends TestCase
1515
{

0 commit comments

Comments
 (0)