diff --git a/.editorconfig b/.editorconfig index 989704a..be2498e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,6 +12,6 @@ indent_size = 4 insert_final_newline = true trim_trailing_whitespace = true -# .travis.yml -[.travis.yml] +# YAML files +[*.yml] indent_size = 2 diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml new file mode 100644 index 0000000..49ce3d5 --- /dev/null +++ b/.github/workflows/coding-standards.yml @@ -0,0 +1,37 @@ +name: Coding Standards + +on: [ pull_request ] + +jobs: + phpcs: + name: PHP coding standards + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.1' + coverage: none + tools: composer, cs2pr + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v2 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Check coding standards using PHPCS + run: vendor/bin/phpcs -q -n --report=checkstyle --extensions=php,phpt --warning-severity=0 | cs2pr + diff --git a/.github/workflows/php-tester.yml b/.github/workflows/php-tester.yml new file mode 100644 index 0000000..4336833 --- /dev/null +++ b/.github/workflows/php-tester.yml @@ -0,0 +1,45 @@ +name: PHP Tests + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + test: + name: ${{ matrix.php }} test + runs-on: ubuntu-latest + strategy: + matrix: + php: [ '7.2', '7.3', '7.4', '8.0', '8.1' ] + + steps: + - uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: json + tools: composer + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v2 + with: + path: vendor + key: ${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.php }}- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: vendor/bin/tester tests -C -s -p php diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1e5be35..0000000 --- a/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: php -php: - - 7.2 - - 7.3 - - 7.4 - - 8.0 -before_script: - - composer install --no-interaction --dev --prefer-source -script: - - vendor/bin/phpcs --extensions=php,phpt --warning-severity=0 - - vendor/bin/tester tests -s -p php diff --git a/composer.json b/composer.json index 8d074f7..ccd2d34 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ "frontend", "design" ], - "homepage": "http://mexitek.github.com/phpColors/", + "homepage": "https://github.com/mexitek/phpColors", "license": "MIT", "authors": [ { diff --git a/tests/colorConvertHslToHex.phpt b/tests/colorConvertHslToHex.phpt index fd3adbd..3d22223 100644 --- a/tests/colorConvertHslToHex.phpt +++ b/tests/colorConvertHslToHex.phpt @@ -33,7 +33,7 @@ $white = [ ]; // Test cases. -$colorsToConvert = array( +$colorsToConvert = [ 'blue' => [ // hsl(194, 100%, 40%) 'hex' => '009ccc', 'hsl' => $blue, @@ -54,8 +54,7 @@ $colorsToConvert = array( 'hex' => 'ffffff', 'hsl' => $white, ], -); - +]; foreach ($colorsToConvert as $color) { $hsl = $color['hsl'];