Skip to content

Bump the all-actions group across 1 directory with 2 updates #57

Bump the all-actions group across 1 directory with 2 updates

Bump the all-actions group across 1 directory with 2 updates #57

Workflow file for this run

---
name: CI
on: # yamllint disable-line rule:truthy
push:
branches: ['**']
paths-ignore:
- '**.md'
pull_request:
branches: [main, release-*]
paths-ignore:
- '**.md'
workflow_dispatch:
jobs:
phplinter:
name: 'PHP-Linter'
strategy:
fail-fast: false
matrix:
php-version: ['8.1', '8.2', '8.3', '8.4']
uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/[email protected]
with:
php-version: ${{ matrix.php-version }}
linter:
name: 'Linter'
strategy:
fail-fast: false
uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/[email protected]
with:
enable_eslinter: false
enable_jsonlinter: true
enable_stylelinter: false
enable_yamllinter: true
unit-tests-linux:
name: "Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
runs-on: ${{ matrix.operating-system }}
needs: [phplinter, linter]
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.1', '8.2', '8.3', '8.4']
steps:
- name: Setup test MySQL database
run: |
sudo systemctl start mysql.service
mysql -uroot -proot -e 'CREATE DATABASE IF NOT EXISTS simplesamlphp;'
mysql -uroot -proot -e '
CREATE TABLE IF NOT EXISTS `AttributeFromSQL` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`uid` VARCHAR(100) NOT NULL,
`sp` VARCHAR(250) DEFAULT "%",
`attribute` VARCHAR(30) NOT NULL,
`value` TEXT,
`expires` DATE DEFAULT "9999-12-31",
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8;
CREATE USER IF NOT EXISTS `phpunit`@`localhost` IDENTIFIED BY "phpunit";
GRANT ALL ON `simplesamlphp`.* TO `phpunit`@`localhost`;
' simplesamlphp
mysql -uroot -proot -e "
INSERT INTO AttributeFromSQL (uid, sp, attribute, value) VALUES
('[email protected]', '%', 'eduPersonEntitlement',
'urn:mace:exampleIdP.org:demoservice:demo-admin');
INSERT INTO AttributeFromSQL (uid, sp, attribute, value) VALUES
('[email protected]', 'https://idp.example.org/idp/shibboleth',
'eduPersonEntitlement', 'urn:mace:grnet.gr:eduroam:admin');
INSERT INTO AttributeFromSQL (uid, sp, attribute, value) VALUES
('[email protected]', '%', 'eduPersonAffiliation', 'faculty');
INSERT INTO AttributeFromSQL (uid, attribute, value) VALUES
('[email protected]', 'mail', '[email protected]');
INSERT INTO AttributeFromSQL (uid, attribute, value, expires) VALUES
('[email protected]', 'mail', '[email protected]', '2015-10-21');
" simplesamlphp
- 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: >
ctype, date, dom, fileinfo, filter, hash, intl, mbstring,
mysql, openssl, pcre, posix, spl, xdebug, xml
tools: composer
ini-values: error_reporting=E_ALL, pcov.directory=.
coverage: pcov
- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v5
- name: Get composer cache directory
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: $COMPOSER_CACHE
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Run unit tests with coverage
if: ${{ matrix.php-versions == '8.4' }}
run: vendor/bin/phpunit --exclude-group skipOnGithub
- name: Run unit tests (no coverage)
if: ${{ matrix.php-versions != '8.4' }}
run: vendor/bin/phpunit --exclude-group skipOnGithub --no-coverage
- name: Save coverage data
if: ${{ matrix.php-versions == '8.4' }}
uses: actions/upload-artifact@v5
with:
name: coverage-data
path: ${{ github.workspace }}/build
quality:
name: Quality control
runs-on: [ubuntu-latest]
steps:
- name: Setup PHP, with composer and extensions
id: setup-php
# https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2
with:
# Should be the higest supported version, so we can use the newest tools
php-version: '8.4'
tools: composer, composer-require-checker, composer-unused
extensions: ctype, date, dom, filter, hash, intl, mbstring, mysql, opcache, openssl, pcre, spl, xml
- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
- uses: actions/checkout@v5
- name: Get composer cache directory
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: $COMPOSER_CACHE
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Validate composer.json and composer.lock
run: composer validate
- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Check code for hard dependencies missing in composer.json
run: composer-require-checker check --config-file tools/composer-require-checker.json composer.json
- name: Check code for unused dependencies in composer.json
run: |
composer-unused
- name: PHP Code Sniffer
run: vendor/bin/phpcs
- name: PHPStan
run: |
vendor/bin/phpstan analyze -c phpstan.neon --debug
- name: PHPStan (testsuite)
run: |
vendor/bin/phpstan analyze -c phpstan-dev.neon --debug
security:
name: Security checks
runs-on: [ubuntu-latest]
steps:
- name: Setup PHP, with composer and extensions
# https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2
with:
# Should be the lowest supported version
php-version: '8.1'
extensions: ctype, date, dom, filter, hash, intl, mbstring, openssl, pcre, spl, xml
tools: composer
coverage: none
- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
- uses: actions/checkout@v5
- name: Get composer cache directory
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: $COMPOSER_CACHE
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Security check for locked dependencies
run: composer audit
- name: Update Composer dependencies
run: composer update --no-progress --prefer-dist --optimize-autoloader
- name: Security check for updated dependencies
run: composer audit
cleanup:
name: Cleanup artifacts
needs: [unit-tests-linux]
runs-on: [ubuntu-latest]
if: ${{ always() && needs.unit-tests-linux.result == 'success' }}
steps:
- uses: geekyeggo/delete-artifact@v5
with:
name: coverage-data