diff --git a/.editorconfig b/.editorconfig index 5ce6485..6f313c6 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,5 +12,4 @@ trim_trailing_whitespace = true trim_trailing_whitespace = false [*.yml] -indent_style = space -indent_size = 4 +indent_size = 2 diff --git a/.gitattributes b/.gitattributes index 36b2770..d3af6fb 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,12 +1,10 @@ * text=auto /.github export-ignore + /tests export-ignore +phpunit.xml export-ignore .editorconfig export-ignore .gitattributes export-ignore .gitignore export-ignore -.styleci.yml export-ignore -.travis.yml export-ignore -monorepo-builder.yml export-ignore -phpunit.xml export-ignore diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml new file mode 100644 index 0000000..ebfe0f3 --- /dev/null +++ b/.github/workflows/codestyle.yml @@ -0,0 +1,45 @@ +name: codestyle + +on: + push: + pull_request: + +jobs: + psalm: + name: Code Style + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + php: [ '8.2' ] + os: [ ubuntu-latest ] + steps: + - name: Set Git To Use LF + run: | + git config --global core.autocrlf false + git config --global core.eol lf + - name: Checkout + uses: actions/checkout@v3.3.0 + - name: Setup PHP ${{ matrix.php }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + - name: Validate Composer + run: composer validate + - name: Get Composer Cache Directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: Restore Composer Cache + uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer- + - name: Install Dependencies + uses: nick-invision/retry@v1 + with: + timeout_minutes: 5 + max_attempts: 5 + command: composer update --prefer-dist --no-interaction --no-progress + - name: Check Code Style + run: composer phpcs:check diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1315410..8b895a7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,146 +1,61 @@ name: build on: - push: - pull_request: - schedule: - - cron: '0 0 * * *' + push: + pull_request: env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: - security: - name: Security - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - php: [ '8.1' ] - os: [ ubuntu-latest ] - steps: - - name: Set Git To Use LF - run: | - git config --global core.autocrlf false - git config --global core.eol lf - - name: Checkout - uses: actions/checkout@v2 - - name: Setup PHP ${{ matrix.php }} - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - - name: Update Composer - run: composer self-update - - name: Validate Composer Config - run: composer validate - - name: Get Composer Cache Directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - name: Restore Composer Cache - uses: actions/cache@v1 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer- - - name: Install Dependencies - uses: nick-invision/retry@v1 - with: - timeout_minutes: 5 - max_attempts: 5 - command: composer update --prefer-dist --no-interaction --no-progress - - name: Security Advisories - run: composer require --dev roave/security-advisories:dev-latest - - psalm: - name: Psalm - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - php: [ '8.1' ] - os: [ ubuntu-latest ] - steps: - - name: Set Git To Use LF - run: | - git config --global core.autocrlf false - git config --global core.eol lf - - name: Checkout - uses: actions/checkout@v2 - - name: Setup PHP ${{ matrix.php }} - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - - name: Update Composer - run: composer self-update - - name: Validate Composer Config - run: composer validate - - name: Get Composer Cache Directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - name: Restore Composer Cache - uses: actions/cache@v1 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer- - - name: Install Dependencies - uses: nick-invision/retry@v1 - with: - timeout_minutes: 5 - max_attempts: 5 - command: composer update --prefer-dist --no-interaction --no-progress - - name: Static Analysis - continue-on-error: true - run: vendor/bin/psalm --no-cache - - unit-tests: - name: Build (${{matrix.php}}, ${{ matrix.os }}, ${{ matrix.stability }}) - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - php: [ '8.1', '8.2' ] - os: [ ubuntu-latest, macos-latest, windows-latest ] - stability: [ prefer-lowest, prefer-stable ] - steps: - - name: Set Git To Use LF - run: | - git config --global core.autocrlf false - git config --global core.eol lf - - name: Checkout - uses: actions/checkout@v2 - - name: Setup PHP ${{ matrix.php }} - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - coverage: pcov - tools: pecl - ini-values: "memory_limit=-1" - extensions: phar, ffi - - name: Update Composer - run: composer self-update - - name: Validate Composer Config - run: composer validate - - name: Get Composer Cache Directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - name: Restore Composer Cache - uses: actions/cache@v1 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer- - - name: Install Dependencies - uses: nick-invision/retry@v1 - with: - timeout_minutes: 5 - max_attempts: 5 - command: composer update --${{ matrix.stability }} --ignore-platform-reqs --prefer-dist --no-interaction --no-progress - - name: Install Linux SDL2 - if: runner.os == 'Linux' - run: sudo apt-get install -y libsdl2-2.0-0 - - name: Install MacOS SDL2 - if: runner.os == 'macOS' - run: brew install sdl2 - - name: Execute Tests - run: vendor/bin/phpunit --testdox + unit-tests: + name: Build (${{matrix.php}}, ${{ matrix.os }}, ${{ matrix.stability }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + php: [ '8.1', '8.2' ] + os: [ ubuntu-latest, macos-latest, windows-latest ] + stability: [ prefer-lowest, prefer-stable ] + steps: + - name: Set Git To Use LF + run: | + git config --global core.autocrlf false + git config --global core.eol lf + - name: Checkout + uses: actions/checkout@v3.3.0 + - name: Setup PHP ${{ matrix.php }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: pcov + tools: pecl + ini-values: ffi.enable=1 + extensions: ffi + - name: Update Composer + run: composer self-update + - name: Validate Composer Config + run: composer validate + - name: Get Composer Cache Directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: Restore Composer Cache + uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer- + - name: Install Dependencies + uses: nick-invision/retry@v1 + with: + timeout_minutes: 5 + max_attempts: 5 + command: composer update --${{ matrix.stability }} --ignore-platform-reqs --prefer-dist --no-interaction --no-progress + - name: Install Linux SDL2 + if: runner.os == 'Linux' + run: sudo apt-get install -y libsdl2-2.0-0 + - name: Install MacOS SDL2 + if: runner.os == 'macOS' + run: brew install sdl2 + - name: Execute Tests + run: vendor/bin/phpunit --testdox diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml new file mode 100644 index 0000000..b49a48a --- /dev/null +++ b/.github/workflows/security.yml @@ -0,0 +1,49 @@ +name: security + +on: + push: + pull_request: + schedule: + - cron: '0 0 * * *' + +jobs: + security: + name: Security + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + php: [ '8.2' ] + os: [ ubuntu-latest ] + steps: + - name: Set Git To Use LF + run: | + git config --global core.autocrlf false + git config --global core.eol lf + - name: Checkout + uses: actions/checkout@v3.3.0 + - name: Setup PHP ${{ matrix.php }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + - name: Validate Composer + run: composer validate + - name: Get Composer Cache Directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: Restore Composer Cache + uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer- + - name: Install Dependencies + uses: nick-invision/retry@v1 + with: + timeout_minutes: 5 + max_attempts: 5 + command: composer update --prefer-dist --no-interaction --no-progress + - name: Composer Audit + run: composer audit + - name: Security Advisories + run: composer require --dev roave/security-advisories:dev-latest diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml new file mode 100644 index 0000000..3f59b8c --- /dev/null +++ b/.github/workflows/static-analysis.yml @@ -0,0 +1,46 @@ +name: static-analysis + +on: + push: + pull_request: + +jobs: + psalm: + name: Psalm + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + php: [ '8.2' ] + os: [ ubuntu-latest ] + steps: + - name: Set Git To Use LF + run: | + git config --global core.autocrlf false + git config --global core.eol lf + - name: Checkout + uses: actions/checkout@v3.3.0 + - name: Setup PHP ${{ matrix.php }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + - name: Validate Composer + run: composer validate + - name: Get Composer Cache Directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: Restore Composer Cache + uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer- + - name: Install Dependencies + uses: nick-invision/retry@v1 + with: + timeout_minutes: 5 + max_attempts: 5 + command: composer update --prefer-dist --no-interaction --no-progress + - name: Static Analysis + continue-on-error: true + run: composer psalm:check diff --git a/.gitignore b/.gitignore index a4df26d..9624eee 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,4 @@ .idea/ vendor/ -includes/ -composer.phar + composer.lock -.phpunit.result.cache -.DS_Store -Thumbs.db