Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mabar committed Jul 29, 2024
0 parents commit a07b4f0
Show file tree
Hide file tree
Showing 74 changed files with 6,377 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# EditorConfig is awesome: https://EditorConfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab

[**.{yaml, yml}]
indent_style = space
indent_size=2
12 changes: 12 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Not archived

.github export-ignore
docs export-ignore
tests export-ignore
tools export-ignore

.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
Makefile export-ignore
README.md export-ignore
263 changes: 263 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
name: "CI"

on:
pull_request:
types: [ "opened", "synchronize", "edited", "reopened" ]
paths-ignore:
- "docs/**"
push:
branches:
- "**"
paths-ignore:
- "docs/**"
schedule:
- cron: "0 8 * * 1" # At 08:00 on Monday
workflow_dispatch:
inputs: {}

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

permissions:
contents: "read"

jobs:
coding-standard:
name: "Coding standard"
runs-on: "${{ matrix.operating-system }}"

if: |
github.event_name != 'pull_request'
|| github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
strategy:
matrix:
include:
- operating-system: "ubuntu-latest"
php-version: "8.3"

steps:
- name: "Checkout"
uses: "actions/checkout@v4"

- name: "PHP"
uses: "orisai/github-workflows/.github/actions/setup-php@v1"
with:
version: "${{ matrix.php-version }}"
token: "${{ secrets.GITHUB_TOKEN }}"

- name: "Composer"
uses: "orisai/github-workflows/.github/actions/setup-composer@v1"

- name: "PHP_CodeSniffer"
uses: "orisai/github-workflows/.github/actions/php-codesniffer@v1"
with:
command: "make cs ARGS='--report=checkstyle -q | vendor/bin/cs2pr'"
cache-path: "var/tools/PHP_CodeSniffer"

static-analysis:
name: "Static analysis"
runs-on: "${{ matrix.operating-system }}"

if: |
github.event_name != 'pull_request'
|| github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
strategy:
matrix:
include:
- operating-system: "ubuntu-latest"
php-version: "8.3"

steps:
- name: "Checkout"
uses: "actions/checkout@v4"

- name: "PHP"
uses: "orisai/github-workflows/.github/actions/setup-php@v1"
with:
version: "${{ matrix.php-version }}"
token: "${{ secrets.GITHUB_TOKEN }}"

- name: "Composer"
uses: "orisai/github-workflows/.github/actions/setup-composer@v1"

- name: "PHPStan"
uses: "orisai/github-workflows/.github/actions/phpstan@v1"
with:
command: "make phpstan"
cache-path: "var/tools/PHPStan"

tests:
name: "Tests"
runs-on: "${{ matrix.operating-system }}"
continue-on-error: "${{ matrix.experimental }}"

if: |
github.event_name != 'pull_request'
|| github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
strategy:
matrix:
operating-system: [ "ubuntu-latest" ]
php-version: [ "7.4", "8.0", "8.1", "8.2", "8.3" ]
composer-flags: [ "" ]
experimental: [ false ]
include:
- operating-system: "ubuntu-latest"
php-version: "7.4"
composer-flags: "--prefer-lowest --prefer-stable"
experimental: false
- operating-system: "ubuntu-latest"
php-version: "8.4"
composer-flags: "--ignore-platform-req=php+"
experimental: true
# TODO - docker not supported
- operating-system: "macos-latest"
php-version: "8.3"
composer-flags: ""
experimental: true
- operating-system: "windows-latest"
php-version: "8.3"
composer-flags: ""
experimental: true

services:
mysql:
image: "mysql:8.0"

options: >-
--health-cmd "mysqladmin ping --silent"
-e MYSQL_ROOT_PASSWORD=root
ports:
- "3306:3306"

steps:
- name: "Checkout"
uses: "actions/checkout@v4"

- name: "PHP"
uses: "orisai/github-workflows/.github/actions/setup-php@v1"
with:
version: "${{ matrix.php-version }}"
coverage: "pcov"
token: "${{ secrets.GITHUB_TOKEN }}"

- name: "Composer"
uses: "orisai/github-workflows/.github/actions/setup-composer@v1"
with:
command: "composer update --no-interaction --no-progress --prefer-dist ${{ matrix.composer-flags }}"

- name: "PHPUnit"
uses: "orisai/github-workflows/.github/actions/phpunit@v1"
with:
command: "make coverage-clover"
cache-path: "var/tools/PHPUnit"

- name: "Coveralls"
uses: "orisai/github-workflows/.github/actions/coveralls-php-upload@v1"
with:
config: "tools/.coveralls.yml"
token: "${{ secrets.GITHUB_TOKEN }}"

- name: "Upload logs"
uses: "actions/upload-artifact@v4"
with:
name: "Logs - Tests (${{ matrix.operating-system }}, ${{ matrix.php-version }}, ${{ matrix.composer-flags }})"
path: "var/log"
if-no-files-found: "ignore"

coverage-finish:
name: "Code coverage finish"
needs: "tests"
runs-on: "${{ matrix.operating-system }}"

if: |
github.event_name != 'pull_request'
|| github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
strategy:
matrix:
include:
- operating-system: "ubuntu-latest"
php-version: "8.3"

steps:
- name: "Coveralls"
uses: "orisai/github-workflows/.github/actions/coveralls-finish@v1"
with:
token: "${{ secrets.GITHUB_TOKEN }}"

tests-mutations:
name: "Test for mutants"
runs-on: "${{ matrix.operating-system }}"

if: |
github.event_name != 'pull_request'
|| github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
strategy:
matrix:
include:
- operating-system: "ubuntu-latest"
php-version: "8.3"

services:
mysql:
image: "mysql:8.0"

options: >-
--health-cmd "mysqladmin ping --silent"
-e MYSQL_ROOT_PASSWORD=root
ports:
- "3306:3306"

steps:
- name: "Checkout"
uses: "actions/checkout@v4"

- name: "PHP"
uses: "orisai/github-workflows/.github/actions/setup-php@v1"
with:
version: "${{ matrix.php-version }}"
coverage: "pcov"
token: "${{ secrets.GITHUB_TOKEN }}"

- name: "Composer"
uses: "orisai/github-workflows/.github/actions/setup-composer@v1"

- name: "PHPUnit"
uses: "orisai/github-workflows/.github/actions/phpunit@v1"
with:
command: "make mutations-tests"
cache-path: "var/tools/PHPUnit"

- name: "Infection PHP"
uses: "orisai/github-workflows/.github/actions/infection-php@v1"
with:
command: "make mutations-infection ARGS='--logger-github'"
cache-path: "var/tools/Infection"
stryker-token: "${{ secrets.STRYKER_DASHBOARD_API_KEY }}"

- name: "Upload logs"
uses: "actions/upload-artifact@v4"
with:
name: "Logs - Mutations"
path: "var/coverage/mutations/infection.log"
if-no-files-found: "ignore"

status-check:
name: "Status check - ${{ github.workflow }}"
runs-on: "ubuntu-latest"
needs: [ "coding-standard", "static-analysis", "tests", "tests-mutations" ]

if: "${{ always() }}"

steps:
- name: "Check required jobs are successful"
uses: "orisai/github-workflows/.github/actions/status-check@v1"
with:
needs: "${{ toJSON(needs) }}"
38 changes: 38 additions & 0 deletions .github/workflows/dependency-review.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "Dependency Review"

on:
pull_request:
types: [ "opened", "synchronize", "edited", "reopened" ]
paths-ignore:
- "docs/**"
push:
branches:
- "**"
paths-ignore:
- "docs/**"

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

permissions:
contents: "read"

jobs:
dependency-review:
name: "Dependency Review"
runs-on: "ubuntu-latest"

if: |
github.event_name != 'pull_request'
|| github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- name: "Checkout"
uses: "actions/checkout@v4"

- name: "Dependency Review"
uses: "actions/dependency-review-action@v4"
with:
base-ref: "${{ github.event.before }}"
head-ref: "${{ github.sha }}"
15 changes: 15 additions & 0 deletions .github/workflows/lock-closed-threads.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Lock inactive closed issues and PRs"

on:
schedule:
- cron: "0 12 * * 1"
workflow_dispatch:
inputs: {}

permissions:
issues: "write"
pull-requests: "write"

jobs:
lock:
uses: "orisai/github-workflows/.github/workflows/lock-closed-threads.yaml@v1"
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# IDE
/.idea

# Composer
/vendor
/composer.lock

# Generated
/var
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased](https://github.com/orisai/db-audit/compare/...v1.x)

### Added
Loading

0 comments on commit a07b4f0

Please sign in to comment.