phpseclib/.github/workflows/ci.yml

96 lines
4.1 KiB
YAML
Raw Normal View History

2022-02-27 22:35:58 +00:00
name: CI
on: [push, pull_request]
permissions:
contents: read # to fetch code (actions/checkout)
2022-02-27 22:35:58 +00:00
jobs:
lint:
name: Lint
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
2022-10-20 22:53:09 +00:00
env:
update: true
2022-10-16 02:16:45 +00:00
- name: Composer Install
run: composer install --classmap-authoritative --no-interaction --no-cache
2022-02-27 22:35:58 +00:00
- name: Lint
2022-10-16 02:16:45 +00:00
run: vendor/bin/parallel-lint --show-deprecated build phpseclib tests
2022-02-27 22:35:58 +00:00
strategy:
fail-fast: false
matrix:
2022-10-16 02:16:45 +00:00
php-version: ['8.1', '8.2']
2022-02-27 22:35:58 +00:00
quality_tools:
name: Quality Tools
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
2022-10-20 22:53:09 +00:00
env:
update: true
2022-02-27 22:35:58 +00:00
- name: Composer Install
run: composer install --classmap-authoritative --no-interaction --no-cache
- name: PHP_CodeSniffer
2022-10-16 02:16:45 +00:00
run: vendor/bin/phpcs --standard=build/php_codesniffer.xml
2022-02-27 22:35:58 +00:00
- name: PHP CS Fixer
2022-10-16 02:16:45 +00:00
run: vendor/bin/php-cs-fixer fix --config=build/php-cs-fixer.php --diff --dry-run --using-cache=no
2022-02-27 22:35:58 +00:00
- name: Psalm
2022-10-16 02:16:45 +00:00
run: vendor/bin/psalm --config=build/psalm.xml --no-cache --long-progress --report-show-info=false
strategy:
fail-fast: false
2022-02-27 22:35:58 +00:00
tests:
name: Tests
timeout-minutes: 10
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
2022-10-20 22:53:09 +00:00
env:
update: true
2022-02-27 22:35:58 +00:00
- name: Composer Install
run: composer install --classmap-authoritative --no-interaction --no-cache --ignore-platform-req=php
2022-02-27 22:35:58 +00:00
- name: Setup Secure Shell Functional Tests
if: matrix.os == 'ubuntu-latest'
run: |
PHPSECLIB_SSH_USERNAME='phpseclib'
PHPSECLIB_SSH_PASSWORD='EePoov8po1aethu2kied1ne0'
sudo useradd --create-home --base-dir /home "$PHPSECLIB_SSH_USERNAME"
echo "$PHPSECLIB_SSH_USERNAME:$PHPSECLIB_SSH_PASSWORD" | sudo chpasswd
ssh-keygen -t rsa -b 1024 -f "$HOME/.ssh/id_rsa" -q -N ""
eval `ssh-agent -s`
ssh-add "$HOME/.ssh/id_rsa"
sudo mkdir -p "/home/$PHPSECLIB_SSH_USERNAME/.ssh/"
sudo cp "$HOME/.ssh/id_rsa.pub" "/home/$PHPSECLIB_SSH_USERNAME/.ssh/authorized_keys"
sudo ssh-keyscan -t rsa localhost > "/tmp/known_hosts"
sudo cp "/tmp/known_hosts" "/home/$PHPSECLIB_SSH_USERNAME/.ssh/known_hosts"
sudo chown "$PHPSECLIB_SSH_USERNAME:$PHPSECLIB_SSH_USERNAME" "/home/$PHPSECLIB_SSH_USERNAME/.ssh/" -R
echo "PHPSECLIB_SSH_HOSTNAME=localhost" >> $GITHUB_ENV
echo "PHPSECLIB_SSH_USERNAME=$PHPSECLIB_SSH_USERNAME" >> $GITHUB_ENV
echo "PHPSECLIB_SSH_PASSWORD=$PHPSECLIB_SSH_PASSWORD" >> $GITHUB_ENV
echo "PHPSECLIB_SSH_HOME=/home/phpseclib" >> $GITHUB_ENV
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> $GITHUB_ENV
- name: PHPUnit
2022-10-16 02:16:45 +00:00
run: vendor/bin/paratest --verbose --configuration=tests/phpunit.xml --runner=WrapperRunner
2022-02-27 22:35:58 +00:00
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
php-version: ['8.1', '8.2']