Skip to content

Commit

Permalink
update config for renovate and phpunit (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
mimmi20 authored Feb 11, 2023
1 parent cac4801 commit a707e6f
Show file tree
Hide file tree
Showing 6 changed files with 198 additions and 36 deletions.
78 changes: 58 additions & 20 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -1,39 +1,77 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base",
":disableDependencyDashboard",
":preserveSemverRanges",
":label(dependencies)",
":assignee(mimmi20)",
":rebaseStalePrs",
":semanticCommitsDisabled",
":separateMajorReleases",
":combinePatchMinorReleases",
":enableVulnerabilityAlerts",
":timezone(UTC)",
":gitSignOff",
"group:allNonMajor"

"extends": ["github>whitesource/merge-confidence:beta"],

"enabled": true,
"assignees": [
"mimmi20"
],
"automerge": false,
"commitBody": "Signed-off-by: {{{gitAuthor}}}",
"commitBodyTable": true,
"dependencyDashboard": false,
"enabledManagers": ["composer", "github-actions", "npm"],
"lockFileMaintenance": {"enabled": true, "extends": ["schedule:daily"]},
"ignoreUnstable": true,
"labels": [
"dependencies"
],
"lockFileMaintenance": {
"enabled": false
},
"platformAutomerge": false,
"prBodyColumns": [
"Package",
"Change",
"Type",
"Update"
],
"prBodyDefinitions": {
"Package": "`{{{depName}}}`",
"Type": "{{{depType}}}",
"Update": "{{{updateType}}}",
"Change": "[{{#if displayFrom}}`{{{displayFrom}}}` -> {{else}}{{#if currentValue}}`{{{currentValue}}}` -> {{/if}}{{/if}}{{#if displayTo}}`{{{displayTo}}}`{{else}}`{{{newValue}}}`{{/if}}]({{#if depName}}https://renovatebot.com/diffs/npm/{{replace '/' '%2f' depName}}/{{{currentVersion}}}/{{{newVersion}}}{{/if}})"
},
"prCreation": "immediate",
"rangeStrategy": "bump",
"rebaseWhen": "behind-base-branch",
"reviewers": [
"mimmi20"
],
"rollbackPrs": true,
"schedule": ["before 3am"],
"updateLockFiles": true,
"semanticCommits": "disabled",
"separateMajorMinor": true,
"separateMinorPatch": false,
"timezone": "UTC",
"updateLockFiles": false,
"updateNotScheduled": false,
"packageRules": [
{"matchPackagePatterns": ["^mimmi20/"], "groupSlug": "mimmi20", "groupName": "mimmi20 packages"},
{
"groupName": "all non-major dependencies",
"groupSlug": "all-minor-patch",
"matchPackagePatterns": [
"*"
],
"matchUpdateTypes": [
"minor",
"patch"
]
},
{
"groupName": "mimmi20 packages",
"groupSlug": "mimmi20",
"matchPackagePatterns": ["^mimmi20/"]
},
{
"groupName": "PHP",
"matchPackageNames": ["php"],
"allowedVersions": "^8.1",
"extends": [":automergeDisabled", ":automergePr"],
"ignoreUnstable": false,
"groupName": "PHP"
"rangeStrategy": "widen"
}
],
"vulnerabilityAlerts": {
"extends": [":automergeDisabled", ":automergePr"]
"enabled": true
}
}
34 changes: 34 additions & 0 deletions .github/workflows/cleanup-caches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: cleanup caches by a branch
on:
pull_request:
types:
- closed
workflow_dispatch:

jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Cleanup
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
BRANCH=${{ github.ref }}
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76 changes: 76 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '28 0 * * 0'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
14 changes: 13 additions & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ jobs:
- "highest"
- "lowest"

ts:
- "ts"
- "nts"

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
Expand All @@ -68,6 +72,10 @@ jobs:
ini-values: "opcache.enable=1, opcache.fast_shutdown=0, zend.assertions=1, assert.exception=On, intl.default_locale=de, intl.use_exceptions=1, zend.exception_ignore_args=0"
coverage: "none"
tools: "composer:v2"
env:
fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
phpts: "${{ matrix.ts }}"

- name: "Update dependencies with composer"
uses: "ramsey/[email protected]"
Expand Down Expand Up @@ -120,6 +128,10 @@ jobs:
ini-values: "opcache.enable=1, opcache.fast_shutdown=0, zend.assertions=1, assert.exception=On, intl.default_locale=de, intl.use_exceptions=1, zend.exception_ignore_args=0, xdebug.mode=coverage"
coverage: "xdebug"
tools: "composer:v2"
env:
fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
phpts: "ts"

- name: "Update dependencies with composer"
uses: "ramsey/[email protected]"
Expand All @@ -131,7 +143,7 @@ jobs:
run: "mkdir -p .build/coverage"

- name: "Collect code coverage with Xdebug and phpunit/phpunit"
run: "vendor/bin/phpunit -c phpunit.xml --verbose --coverage-clover=.build/coverage/clover.xml --coverage-text --coverage-xml=.build/coverage/coverage-xml --log-junit=.build/coverage/phpunit.junit.xml"
run: "vendor/bin/phpunit -c phpunit.xml --coverage-clover=.build/coverage/clover.xml --coverage-text --coverage-xml=.build/coverage/coverage-xml --log-junit=.build/coverage/phpunit.junit.xml"

- name: "Upload coverage to Codecov"
uses: "codecov/[email protected]"
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
"ext-tokenizer": "*",
"ext-xml": "*",
"ext-xmlwriter": "*",
"infection/infection": "^0.26.18",
"infection/infection": "^0.26.19",
"mimmi20/coding-standard": "^3.0.26",
"nikic/php-parser": "^v4.15.3",
"phpstan/extension-installer": "^1.2.0",
"phpstan/phpstan": "^1.9.14",
"phpstan/phpstan": "^1.9.17",
"phpstan/phpstan-deprecation-rules": "^1.1.1",
"phpstan/phpstan-phpunit": "^1.3.3",
"phpunit/phpunit": "^9.5.28"
"phpstan/phpstan-phpunit": "^1.3.4",
"phpunit/phpunit": "^10.0.7"
},
"minimum-stability": "stable",
"prefer-stable": true,
Expand Down
24 changes: 13 additions & 11 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,24 @@

<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
backupStaticProperties="false"
beStrictAboutChangesToGlobalState="true"
beStrictAboutCoversAnnotation="false"
beStrictAboutCoverageMetadata="false"
beStrictAboutOutputDuringTests="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutTodoAnnotatedTests="true"
beStrictAboutResourceUsageDuringSmallTests="true"
convertDeprecationsToExceptions="true"
failOnEmptyTestSuite="true"
failOnIncomplete="true"
failOnRisky="true"
failOnSkipped="true"
failOnWarning="true"
verbose="false"
bootstrap="vendor/autoload.php"
enforceTimeLimit="false"
executionOrder="default"
resolveDependencies="true"
colors="true"
cacheDirectory="./.reports/.coverage-cache"
>
<php>
<ini name="error_reporting" value="-1"/>
Expand All @@ -31,13 +28,17 @@
<ini name="assert.exception" value="On"/>
<ini name="intl.default_locale" value="de"/>
<ini name="intl.use_exceptions" value="1"/>

<env name="COLUMNS" value="100" force="true"/>
</php>

<testsuite name="Contact Test Suite">
<directory>tests/</directory>
</testsuite>
<testsuites>
<testsuite name="Contact Test Suite">
<directory>tests/</directory>
</testsuite>
</testsuites>

<coverage includeUncoveredFiles="true" processUncoveredFiles="true">
<coverage includeUncoveredFiles="true">
<include>
<directory suffix=".php">src/</directory>
</include>
Expand All @@ -47,6 +48,7 @@
<text outputFile="php://stdout" showUncoveredFiles="true" showOnlySummary="false"/>
</report>
</coverage>

<logging>
<junit outputFile=".reports/junit.xml"/>
</logging>
Expand Down

0 comments on commit a707e6f

Please sign in to comment.