Skip to content

Commit

Permalink
Fix coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Mar 11, 2023
1 parent b7db8d5 commit f63440a
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v3

- name: Lint markdown files
uses: nosborn/github-action-markdown-cli@v3.1.0
uses: nosborn/github-action-markdown-cli@v3.2.0
with:
files: .
ignore_path: .markdownlintignore
Expand Down
18 changes: 13 additions & 5 deletions .github/workflows/interoperability.yml
Expand Up @@ -22,18 +22,18 @@ jobs:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.0']
php-versions: ['8.2']

steps:
- name: Setup PHP, with composer and extensions
# https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml
extensions: ctype, date, dom, hash, mbstring, openssl, pcre, spl, xml
tools: composer:v2
ini-values: error_reporting=E_ALL, memory_limit=-1
coverage: pcov
coverage: none

- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
Expand Down Expand Up @@ -61,10 +61,18 @@ jobs:
- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader

- name: Cache eduGAIN metadata
uses: actions/cache@v3
with:
path: /tmp/metadata
key: ${{ runner.os }}-metadata-${{ hashFiles('**/edugain-v2.lock') }}
restore-keys: ${{ runner.os }}-metadata-

- name: Download eduGAIN metadata & public key
run: |
wget https://mds.edugain.org/edugain-v2.xml -O /tmp/edugain.xml
wget https://technical.edugain.org/mds-v2.cer -O /tmp/edugain-pub.crt
mkdir -p /tmp/metadata
wget https://mds.edugain.org/edugain-v2.xml -O /tmp/metadata/edugain.xml
wget https://technical.edugain.org/mds-v2.cer -O /tmp/metadataedugain-pub.crt
- name: Run unit tests
run: |
Expand Down
56 changes: 35 additions & 21 deletions .github/workflows/php.yml
Expand Up @@ -27,6 +27,8 @@ jobs:
env:
VALIDATE_ALL_CODEBASE: true
LINTER_RULES_PATH: 'tools/linters'
VALIDATE_CSS: true
VALIDATE_JAVASCRIPT_ES: true
VALIDATE_JSON: true
VALIDATE_PHP_BUILTIN: true
VALIDATE_YAML: true
Expand All @@ -42,15 +44,19 @@ jobs:
# https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
# Should be the higest supported version, so we can use the newest tools
php-version: '8.2'
tools: composer:v2
extensions: dom, mbstring, openssl, xml, zlib
extensions: ctype, date, dom, hash, mbstring, openssl, pcre, spl, xml

- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"

- uses: actions/checkout@v3

- name: Get composer cache directory
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"

- name: Cache composer dependencies
uses: actions/cache@v3
with:
Expand All @@ -65,28 +71,29 @@ jobs:
run: composer install --no-progress --prefer-dist --optimize-autoloader

- name: PHP Code Sniffer
run: php vendor/bin/phpcs
run: php vendor/simplesamlphp/simplesamlphp-test-framework/tools/phpcs

- name: Psalm
continue-on-error: true
run: |
php vendor/bin/psalm \
php vendor/simplesamlphp/simplesamlphp-test-framework/tools/psalm \
-c psalm.xml \
--show-info=true \
--shepherd \
--php-version=${{ steps.setup-php.outputs.php-version }}
- name: Psalm (testsuite)
continue-on-error: true
run: |
php vendor/bin/psalm \
php vendor/simplesamlphp/simplesamlphp-test-framework/tools/psalm \
-c psalm-dev.xml \
--show-info=true \
--shepherd \
--php-version=${{ steps.setup-php.outputs.php-version }}
- name: Psalter
run: |
php vendor/bin/psalter \
php vendor/simplesamlphp/simplesamlphp-test-framework/tools/psalm \
--alter \
--issues=UnnecessaryVarAnnotation \
--dry-run \
--php-version=${{ steps.setup-php.outputs.php-version }}
Expand All @@ -99,8 +106,9 @@ jobs:
# https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: dom, mbstring, openssl, xml, zlib
# Should be the lowest supported version
php-version: '8.0'
extensions: ctype, date, dom, hash, mbstring, openssl, pcre, spl, xml
tools: composer:v2
coverage: none

Expand All @@ -109,6 +117,9 @@ jobs:

- uses: actions/checkout@v3

- name: Get composer cache directory
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"

- name: Cache composer dependencies
uses: actions/cache@v3
with:
Expand All @@ -125,7 +136,7 @@ jobs:
- name: Update Composer dependencies
run: composer update --no-progress --prefer-dist --optimize-autoloader

- name: Security check for locked dependencies
- name: Security check for updated dependencies
run: composer audit

unit-tests-linux:
Expand All @@ -144,10 +155,10 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: dom, mbstring, openssl, soap, xml
extensions: ctype, date, dom, hash, mbstring, openssl, pcre, spl, xml
tools: composer:v2
ini-values: error_reporting=E_ALL
coverage: xdebug
coverage: pcov

- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
Expand All @@ -159,6 +170,7 @@ jobs:
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v3

- name: Get composer cache directory
Expand All @@ -175,19 +187,20 @@ jobs:
run: composer install --no-progress --prefer-dist --optimize-autoloader

- name: Run unit tests with coverage
if: ${{ matrix.php-versions == '8.1' }}
run: ./vendor/bin/phpunit
if: ${{ matrix.php-versions == '8.2' }}
run: vendor/bin/phpunit

- name: Run unit tests (no coverage)
if: ${{ matrix.php-versions != '8.1' }}
run: ./vendor/bin/phpunit --no-coverage
if: ${{ matrix.php-versions != '8.2' }}
run: vendor/bin/phpunit --no-coverage

- name: Save coverage data
if: ${{ matrix.php-versions == '8.1' }}
if: ${{ matrix.php-versions == '8.2' }}
uses: actions/upload-artifact@v3
with:
name: coverage-data
path: ${{ github.workspace }}/build
# The build-directory alone is not enough to make codecov work
path: ${{ github.workspace }}

unit-tests-windows:
name: "Syntax and unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
Expand All @@ -205,10 +218,10 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: dom, mbstring, openssl, soap, xml
extensions: ctype, date, dom, hash, mbstring, openssl, pcre, spl, xml
tools: composer:v2
ini-values: error_reporting=E_ALL
coverage: xdebug
coverage: none

- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
Expand All @@ -220,6 +233,7 @@ jobs:
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v3

- name: Get composer cache directory
Expand All @@ -236,7 +250,7 @@ jobs:
run: composer install --no-progress --prefer-dist --optimize-autoloader

- name: Run unit tests
run: ./vendor/bin/phpunit --no-coverage
run: vendor/bin/phpunit --no-coverage

coverage:
name: Code coverage
Expand Down
4 changes: 2 additions & 2 deletions codecov.yml
Expand Up @@ -6,13 +6,13 @@ coverage:
default:
target: 0%
threshold: 2%
patch: false
patch: off
comment:
layout: "diff"
behavior: once
require_changes: true
require_base: no
require_head: true
require_head: yes
branches: null
github_checks:
annotations: false
4 changes: 3 additions & 1 deletion composer.json
Expand Up @@ -18,8 +18,10 @@
],
"require": {
"php": "^8.0",
"ext-openssl": "*",
"ext-date": "*",
"ext-dom": "*",
"ext-openssl": "*",
"ext-pcre": "*",
"ext-zlib": "*",

"nyholm/psr7": "^1.5.1",
Expand Down

0 comments on commit f63440a

Please sign in to comment.