Skip to content

Commit

Permalink
Add workflow for github actions (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
m1k3lm authored Jun 12, 2024
1 parent 98dafa3 commit 7718d11
Show file tree
Hide file tree
Showing 7 changed files with 480 additions and 115 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* @sequra/partnerships @sequra/integrations-collaborators
* @ristokekovic
57 changes: 57 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂
✂✂✂ REMOVE FROM THIS PART BEFORE SUBMITTING YOUR PULL REQUEST ✂✂✂
✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂

Here are some friendly reminders before submitting your pull request:

- There should be an issue describing the motivation for this change.
- Everything should be well tested.
- Check that you are not making any intensive/slow queries (provide db explain if necessary).
- Migrations should be safe https://sequra.atlassian.net/wiki/display/EN/Safe+Operations+For+High+Volume+PostgreSQL

YOU CAN REMOVE THE PARTS OF THE TEMPLATE THAT DO NOT APPLY TO YOUR PULL REQUEST

✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂
✂✂✂ REMOVE UP TO THIS PART BEFORE SUBMITTING YOUR PULL REQUEST ✂✂✂
✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂✂

### What is the goal?

_Provide a description of the overall goal (you can usually use the one from the issue)_

### References
* **Issue:** _jira issue goes here, if suggesting a new feature or change, please discuss it in an issue first_
* **Related pull-requests:** _list of related pull-requests (comma-separated): #1, #2_
* **Sentry errors:** _list of links to Sentry errors (comma-separated): link1, link2_
* **Any other references (AppSignal, Prometheus, ...):** _list of links to other references (comma-separated): link1, link2_

### How is it being implemented?

_Provide a description of the implementation_

### Opportunistic refactorings

_Have you improved the code/app in anyway? Explain what you did._

### Caveats

_If you find any, please describe all the special conditions._

### Does it affect (changes or update) any sensitive data?

_Check [Sensitive data list documentation](../blob/master/docs/sensitive_data/README.md) and [Sensitive data list](../blob/master/docs/sensitive_data/sensitive-data.yml)

### How is it tested?

_Automatic tests? Manual tests?_

_If it cannot be tested explain why._

_Add use cases if specs are incomplete or missing._

### How is it going to be deployed?

_If it does not require anything special, just write "Standard deployment". Otherwise, put the required steps._

- [ ] _Step 1_
- [ ] _Step 2_
40 changes: 40 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CI
on: push

concurrency:
# For pull requests, cancel all currently-running jobs for this workflow
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
# Force terminal colors. @see https://www.npmjs.com/package/colors
FORCE_COLOR: 1

jobs:
ci:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v4

- name: Cache Composer dependencies
uses: actions/cache@v4
id: cache-composer
with:
path: |
vendor
key: composer-${{ hashFiles('composer.json') }}

- name: Install Composer dependencies
if: steps.cache-composer.outputs.cache-hit != 'true'
run: docker run --rm -v "$(pwd)":/app -w /app composer:latest composer install

- name: PHP_CodeSniffer
run: docker run --rm -v "$(pwd)":/app -w /app php:7.2-cli-alpine php vendor/bin/phpcs --standard=.phpcs.xml.dist --warning-severity=0 . # Ignore Warnings for now...

- name: PHPStan
run: docker run --rm -v "$(pwd)":/app -w /app php:7.2-cli-alpine php vendor/bin/phpstan analyse -c phpstan.neon --memory-limit=512M

- name: Run Tests
run: docker run --rm -v "$(pwd)":/app -w /app php:7.2-cli-alpine php vendor/bin/phpunit --configuration phpunit.xml --testdox
44 changes: 44 additions & 0 deletions .phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0"?>
<ruleset name="Integration-Core">
<rule ref="PSR12"/>
<!-- What to scan -->
<file>.</file>
<exclude-pattern>vendor/</exclude-pattern>
<!-- How to scan -->
<!-- Usage instructions: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage -->
<!-- Annotated ruleset: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
<arg value="sp"/> <!-- Show sniff and progress -->
<arg name="basepath" value="./"/><!-- Strip the file paths down to the relevant bit -->
<arg name="colors"/>
<arg name="extensions" value="php"/>
<arg name="parallel" value="8"/><!-- Enables parallel processing when available for faster results. -->
<!-- Rules: Check PHP version compatibility -->
<config name="testVersion" value="7.2-"/>
<rule ref="Generic.Commenting">
<exclude-pattern>tests/</exclude-pattern>
</rule>
<rule ref="Generic.Commenting.Todo.TaskFound">
<exclude name="Generic.Commenting.Todo.TaskFound"/>
</rule>
<rule ref="Generic.Commenting.DocComment.MissingShort">
<exclude name="Generic.Commenting.DocComment.MissingShort"/>
</rule>
<rule ref="Generic.Files.LineLength.TooLong">
<exclude name="Generic.Files.LineLength.TooLong"/>
</rule>
<rule ref="Squiz.PHP.CommentedOutCode.Found">
<exclude name="Squiz.PHP.CommentedOutCode.Found"/>
</rule>
<rule ref="Squiz.Commenting.ClassComment.Missing">
<exclude-pattern>tests/</exclude-pattern>
<exclude-pattern>src/</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.VariableComment.Missing">
<exclude-pattern>tests/</exclude-pattern>
<exclude-pattern>src/</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.Missing">
<exclude-pattern>tests/</exclude-pattern>
<exclude-pattern>src/</exclude-pattern>
</rule>
</ruleset>
14 changes: 11 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,19 @@
}
},
"require-dev": {
"phpunit/phpunit": "8.5.14"
"phpunit/phpunit": "8.5.14",
"phpcompatibility/php-compatibility": "*",
"phpstan/phpstan": "^1.11"
},
"prefer-stable": true,
"config": {
"platform": {
"php": "7.2"
}
},
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true
},
"preferred-install": "dist"
}
}
}
Loading

0 comments on commit 7718d11

Please sign in to comment.