diff --git a/.github/workflows/coding-style.yml b/.github/workflows/coding-style.yml new file mode 100644 index 00000000..37eacf2b --- /dev/null +++ b/.github/workflows/coding-style.yml @@ -0,0 +1,27 @@ +name: Code Style + +on: + push: + pull_request: + workflow_dispatch: + +jobs: + analyse: + name: Code Style + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup PHP + uses: sunxyw/workflows/setup-environment@main + with: + php-version: 8.0 + php-extensions: swoole, posix, json + operating-system: ubuntu-latest + use-cache: true + + - name: Code Style + uses: sunxyw/workflows/coding-style@main diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml deleted file mode 100644 index d14f8f72..00000000 --- a/.github/workflows/integration-test.yml +++ /dev/null @@ -1,103 +0,0 @@ -name: Integration and Style Test - -on: - push: - branches: - - master - - '*-develop' - paths: - - '**/**.php' - pull_request: - branches: - - master - - '*-develop' - types: - - opened - - synchronize - - reopened - - ready_for_review - - review_requested - paths: - - '**/**.php' - -jobs: - integration: - name: Integration Test (PHP ${{ matrix.php-versions }}) (OS ${{ matrix.operating-system }}) - runs-on: ${{ matrix.operating-system }} - strategy: - matrix: - operating-system: [ "ubuntu-latest", "macos-latest", "windows-latest" ] - php-versions: [ "7.4", "8.0", "8.1" ] - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Setup PHP - uses: "shivammathur/setup-php@v2" - with: - php-version: ${{ matrix.php-versions }} - extensions: swoole, posix, json, mbstring, pdo, sqlite3, pdo_sqlite - env: - SWOOLE_CONFIGURE_OPTS: --enable-openssl - - - name: Setup problem matchers for PHP - run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" - - - name: Validate composer.json - run: "composer validate --strict" - - - name: Get composer cache directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - - name: Cache dependencies - uses: actions/cache@v2 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: ${{ runner.os }}-composer- - - - name: Install Composer Dependencies - run: "composer install --prefer-dist --no-progress --optimize-autoloader" - - - name: Run Static Analysis - run: "composer analyse" - - - name: Run PHPUnit - run: "composer test" - - cs-check: - name: PHP CS Fixer Check - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Setup PHP 8.1 - uses: "shivammathur/setup-php@v2" - with: - php-version: "8.1" - extensions: swoole, posix, json - - - name: Setup problem matchers for PHP - run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" - - - name: Validate composer.json - run: "composer validate --strict" - - - name: Get composer cache directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - - name: Cache dependencies - uses: actions/cache@v2 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: ${{ runner.os }}-composer- - - - name: Install Composer Dependencies - run: "composer install --prefer-dist --no-progress --optimize-autoloader" - - - name: Run PHP CS Fixer Check - run: "composer cs-fix -- --dry-run --diff" diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml new file mode 100644 index 00000000..c9bd057d --- /dev/null +++ b/.github/workflows/static-analysis.yml @@ -0,0 +1,27 @@ +name: Static Analysis + +on: + push: + pull_request: + workflow_dispatch: + +jobs: + analyse: + name: Static Analysis + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup PHP + uses: sunxyw/workflows/setup-environment@main + with: + php-version: 8.0 + php-extensions: swoole, posix, json + operating-system: ubuntu-latest + use-cache: true + + - name: Static Analysis + uses: sunxyw/workflows/static-analysis@main diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..848a64df --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,39 @@ +name: Test + +on: + push: + branches: + - main + - develop + - '*-dev*' + pull_request: + types: + - opened + - reopened + - review_requested + workflow_dispatch: + +jobs: + test: + strategy: + matrix: + operating-system: [ ubuntu-latest, windows-latest, macos-latest ] + php-version: [ 7.4, 8.0 ] + name: PHP ${{ matrix.php-version }} Test (${{ matrix.operating-system }}) + runs-on: ${{ matrix.operating-system }} + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup PHP + uses: sunxyw/workflows/setup-environment@main + with: + php-version: ${{ matrix.php-version }} + php-extensions: swoole, posix, json + operating-system: ${{ matrix.operating-system }} + use-cache: true + + - name: Test + uses: sunxyw/workflows/test@main