Skip to content

refactor(ldap): migrate to using the pear/net_ldap2 package #935

refactor(ldap): migrate to using the pear/net_ldap2 package

refactor(ldap): migrate to using the pear/net_ldap2 package #935

name: Linters
# If a pull-request is pushed then cancel all previously running jobs related
# to that pull-request
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
on:
# push:
pull_request:
types: [opened, synchronize, reopened]
branches:
- develop
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-python@v6.2.0
with:
python-version: "3.13"
- run: pip install --upgrade tox
- name: Run commitizen (https://commitizen-tools.github.io/commitizen/)
run: tox -e cz
- name: Run config-check
run: tox -e config-check
- name: Ensure no merge-commits in the Pull Request (PR)
if: github.event_name == 'pull_request'
run: |
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
echo "GITHUB_BASE_REF: ${GITHUB_BASE_REF}"
echo "HEAD_SHA: ${HEAD_SHA}"
git fetch origin "${GITHUB_BASE_REF}"
MERGE_COMMITS=$(git rev-list --merges origin/${GITHUB_BASE_REF}..${HEAD_SHA})
if [[ -n "${MERGE_COMMITS}" ]]; then
echo "ERROR: The Pull Request (PR) contains a 'merge commit' which is not allowed: ${MERGE_COMMITS}"
exit 1
fi
markdownlint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: markdownlint-cli2-action
uses: DavidAnson/markdownlint-cli2-action@v22
with:
config: 'docs/.markdownlint.yml'
globs: |
*.md
phpunit:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ["8.2", "8.3", "8.4"]
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ldap
- name: Install Composer dependencies
# Allow the previous check to fail but not abort
if: always()
uses: ramsey/composer-install@v2
with:
# Ignore zip for php-webdriver/webdriver
composer-options: "--ignore-platform-req=ext-zip"
- name: Install optional LDAP plugin dependency for test suite
run: composer require --dev --no-interaction --no-progress pear/net_ldap2
- name: Create main config.php for unit tests
run: cp config/config.dist.php config/config.php
- name: Unit Tests
run: |
set -o pipefail
composer phpunit | tee phpunit.log
if ! grep -qE "Tests:|OK \(" phpunit.log; then
echo "❌ PHPUnit exited early (no summary line found)"
exit 1
fi
lint-php-files:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ["8.2", "8.3", "8.4"]
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
# Ignore zip for php-webdriver/webdriver
composer-options: "--ignore-platform-reqs"
- name: Update the composer.lock file
run: composer update
- name: Validate composer.json and composer.lock
run: composer validate --strict
# TODO: Enable this after resolving issues
# - name: Cache coding-standard
# # Allow the previous check to fail but not abort
# if: always()
# uses: actions/cache@v4
# with:
# path: .phpcs-cache
# key: phpcs-cache
- name: Lint PHP files
run: ./ci/ci-phplint
# TODO: Enable this after resolving issues
# - name: Check coding-standard
# # Allow the previous check to fail but not abort
# if: always()
# run: composer phpcs
analyse-php:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ["8.4"]
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ldap
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
- name: Install optional LDAP plugin dependency for test suite
run: composer require --dev --no-interaction --no-progress pear/net_ldap2
- name: Analyse files with PHPStan
run: composer phpstan -- --memory-limit 2G
# - name: Analyse files with Psalm
# # Allow the previous check to fail but not abort
# if: always()
# run: composer psalm -- --shepherd