From 362054ac77997148ee3e05aa58f139ed317e9388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20Felix=20=C5=A0ulc?= Date: Fri, 15 Dec 2023 11:03:27 +0100 Subject: [PATCH] CI: modernize --- .editorconfig | 16 -- .gitattributes | 11 -- .github/workflows/codesniffer.yml | 18 ++ .github/workflows/coverage.yml | 18 ++ .github/workflows/main.yaml | 269 ------------------------------ .github/workflows/phpstan.yml | 18 ++ .github/workflows/tests.yml | 37 ++++ .gitignore | 10 -- Makefile | 30 ---- phpstan.neon | 5 - ruleset.xml | 17 -- 11 files changed, 91 insertions(+), 358 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .gitattributes create mode 100644 .github/workflows/codesniffer.yml create mode 100644 .github/workflows/coverage.yml delete mode 100644 .github/workflows/main.yaml create mode 100644 .github/workflows/phpstan.yml create mode 100644 .github/workflows/tests.yml delete mode 100644 .gitignore delete mode 100644 Makefile delete mode 100644 phpstan.neon delete mode 100644 ruleset.xml diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 3faf149..0000000 --- a/.editorconfig +++ /dev/null @@ -1,16 +0,0 @@ -# EditorConfig is awesome: http://EditorConfig.org - -root = true - -[*] -charset = utf-8 -end_of_line = lf -insert_final_newline = true -trim_trailing_whitespace = true -indent_style = tab -indent_size = tab -tab_width = 4 - -[{*.json, *.yaml, *.yml, *.md}] -indent_style = space -indent_size = 2 diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 12910b6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,11 +0,0 @@ -# Not archived -.docs export-ignore -tests export-ignore -.editorconfig export-ignore -.gitattributes export-ignore -.gitignore export-ignore -.travis.yml export-ignore -Makefile export-ignore -phpstan.neon export-ignore -README.md export-ignore -ruleset.xml export-ignore diff --git a/.github/workflows/codesniffer.yml b/.github/workflows/codesniffer.yml new file mode 100644 index 0000000..a58ac4f --- /dev/null +++ b/.github/workflows/codesniffer.yml @@ -0,0 +1,18 @@ +name: "Codesniffer" + +on: + pull_request: + workflow_dispatch: + + push: + branches: ["*"] + + schedule: + - cron: "0 8 * * 1" + +jobs: + codesniffer: + name: "Codesniffer" + uses: contributte/.github/.github/workflows/codesniffer.yml@master + with: + php: "8.2" diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..860c47e --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,18 @@ +name: "Coverage" + +on: + pull_request: + workflow_dispatch: + + push: + branches: ["*"] + + schedule: + - cron: "0 8 * * 1" + +jobs: + coverage: + name: "Nette Tester" + uses: contributte/.github/.github/workflows/nette-tester-coverage-v2.yml@master + with: + php: "8.2" diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml deleted file mode 100644 index 642dd5c..0000000 --- a/.github/workflows/main.yaml +++ /dev/null @@ -1,269 +0,0 @@ -name: "build" - -on: - pull_request: - paths-ignore: - - ".docs/**" - push: - branches: - - "*" - schedule: - - cron: "0 8 * * 1" # At 08:00 on Monday - -env: - extensions: "json" - cache-version: "1" - composer-version: "v2" - composer-install: "composer update --no-interaction --no-progress --prefer-dist --prefer-stable" - -jobs: - qa: - name: "Quality assurance" - runs-on: "${{ matrix.operating-system }}" - - strategy: - matrix: - php-version: [ "7.4" ] - operating-system: [ "ubuntu-latest" ] - fail-fast: false - - steps: - - name: "Checkout" - uses: "actions/checkout@v2" - - - name: "Setup PHP cache environment" - id: "extcache" - uses: "shivammathur/cache-extensions@v1" - with: - php-version: "${{ matrix.php-version }}" - extensions: "${{ env.extensions }}" - key: "${{ env.cache-version }}" - - - name: "Cache PHP extensions" - uses: "actions/cache@v2" - with: - path: "${{ steps.extcache.outputs.dir }}" - key: "${{ steps.extcache.outputs.key }}" - restore-keys: "${{ steps.extcache.outputs.key }}" - - - name: "Install PHP" - uses: "shivammathur/setup-php@v2" - with: - php-version: "${{ matrix.php-version }}" - extensions: "${{ env.extensions }}" - tools: "composer:${{ env.composer-version }} " - - - name: "Setup problem matchers for PHP" - run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"' - - - name: "Get Composer cache directory" - id: "composercache" - run: 'echo "::set-output name=dir::$(composer config cache-files-dir)"' - - - name: "Cache PHP dependencies" - uses: "actions/cache@v2" - with: - path: "${{ steps.composercache.outputs.dir }}" - key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}" - restore-keys: "${{ runner.os }}-composer-" - - - name: "Validate Composer" - run: "composer validate" - - - name: "Install dependencies" - run: "${{ env.composer-install }}" - - - name: "Coding Standard" - run: "make cs" - - static-analysis: - name: "Static analysis" - runs-on: "${{ matrix.operating-system }}" - - strategy: - matrix: - php-version: [ "7.4" ] - operating-system: [ "ubuntu-latest" ] - fail-fast: false - - steps: - - name: "Checkout" - uses: "actions/checkout@v2" - - - name: "Setup PHP cache environment" - id: "extcache" - uses: "shivammathur/cache-extensions@v1" - with: - php-version: "${{ matrix.php-version }}" - extensions: "${{ env.extensions }}" - key: "${{ env.cache-version }}" - - - name: "Cache PHP extensions" - uses: "actions/cache@v2" - with: - path: "${{ steps.extcache.outputs.dir }}" - key: "${{ steps.extcache.outputs.key }}" - restore-keys: "${{ steps.extcache.outputs.key }}" - - - name: "Install PHP" - uses: "shivammathur/setup-php@v2" - with: - php-version: "${{ matrix.php-version }}" - extensions: "${{ env.extensions }}" - tools: "composer:${{ env.composer-version }} " - - - name: "Setup problem matchers for PHP" - run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"' - - - name: "Get Composer cache directory" - id: "composercache" - run: 'echo "::set-output name=dir::$(composer config cache-files-dir)"' - - - name: "Cache PHP dependencies" - uses: "actions/cache@v2" - with: - path: "${{ steps.composercache.outputs.dir }}" - key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}" - restore-keys: "${{ runner.os }}-composer-" - - - name: "Install dependencies" - run: "${{ env.composer-install }}" - - - name: "PHPStan" - run: "make phpstan" - - tests: - name: "Tests" - runs-on: "${{ matrix.operating-system }}" - - strategy: - matrix: - php-version: [ "7.2", "7.3", "7.4", "8.0" ] - operating-system: [ "ubuntu-latest" ] - composer-args: [ "" ] - include: - - php-version: "7.4" - operating-system: "ubuntu-latest" - composer-args: "--prefer-lowest" - - php-version: "8.0" - operating-system: "ubuntu-latest" - composer-args: "" - fail-fast: false - - continue-on-error: "${{ matrix.php-version == '8.0' }}" - - steps: - - name: "Checkout" - uses: "actions/checkout@v2" - - - name: "Setup PHP cache environment" - id: "extcache" - uses: "shivammathur/cache-extensions@v1" - with: - php-version: "${{ matrix.php-version }}" - extensions: "${{ env.extensions }}" - key: "${{ env.cache-version }}" - - - name: "Cache PHP extensions" - uses: "actions/cache@v2" - with: - path: "${{ steps.extcache.outputs.dir }}" - key: "${{ steps.extcache.outputs.key }}" - restore-keys: "${{ steps.extcache.outputs.key }}" - - - name: "Install PHP" - uses: "shivammathur/setup-php@v2" - with: - php-version: "${{ matrix.php-version }}" - extensions: "${{ env.extensions }}" - tools: "composer:${{ env.composer-version }} " - - - name: "Setup problem matchers for PHP" - run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"' - - - name: "Get Composer cache directory" - id: "composercache" - run: 'echo "::set-output name=dir::$(composer config cache-files-dir)"' - - - name: "Cache PHP dependencies" - uses: "actions/cache@v2" - with: - path: "${{ steps.composercache.outputs.dir }}" - key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}" - restore-keys: "${{ runner.os }}-composer-" - - - name: "Install dependencies" - run: "${{ env.composer-install }} ${{ matrix.composer-args }}" - - - name: "Setup problem matchers for PHPUnit" - run: 'echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"' - - - name: "Tests" - run: "make tests" - - tests-code-coverage: - name: "Tests with code coverage" - runs-on: "${{ matrix.operating-system }}" - - strategy: - matrix: - php-version: [ "7.4" ] - operating-system: [ "ubuntu-latest" ] - fail-fast: false - - if: "github.event_name == 'push'" - - steps: - - name: "Checkout" - uses: "actions/checkout@v2" - - - name: "Setup PHP cache environment" - id: "extcache" - uses: "shivammathur/cache-extensions@v1" - with: - php-version: "${{ matrix.php-version }}" - extensions: "${{ env.extensions }}" - key: "${{ env.cache-version }}" - - - name: "Cache PHP extensions" - uses: "actions/cache@v2" - with: - path: "${{ steps.extcache.outputs.dir }}" - key: "${{ steps.extcache.outputs.key }}" - restore-keys: "${{ steps.extcache.outputs.key }}" - - - name: "Install PHP" - uses: "shivammathur/setup-php@v2" - with: - php-version: "${{ matrix.php-version }}" - extensions: "${{ env.extensions }}" - tools: "composer:${{ env.composer-version }} " - - - name: "Setup problem matchers for PHP" - run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"' - - - name: "Get Composer cache directory" - id: "composercache" - run: 'echo "::set-output name=dir::$(composer config cache-files-dir)"' - - - name: "Cache PHP dependencies" - uses: "actions/cache@v2" - with: - path: "${{ steps.composercache.outputs.dir }}" - key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}" - restore-keys: "${{ runner.os }}-composer-" - - - name: "Install dependencies" - run: "${{ env.composer-install }}" - - - name: "Tests" - run: "make coverage-clover" - - - name: "Coveralls.io" - env: - CI_NAME: github - CI: true - COVERALLS_REPO_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - run: | - wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar - php php-coveralls.phar --verbose --config tests/.coveralls.yml diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml new file mode 100644 index 0000000..eb916bf --- /dev/null +++ b/.github/workflows/phpstan.yml @@ -0,0 +1,18 @@ +name: "Phpstan" + +on: + pull_request: + workflow_dispatch: + + push: + branches: ["*"] + + schedule: + - cron: "0 8 * * 1" + +jobs: + phpstan: + name: "Phpstan" + uses: contributte/.github/.github/workflows/phpstan.yml@master + with: + php: "8.2" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..a574bd1 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,37 @@ +name: "Nette Tester" + +on: + pull_request: + workflow_dispatch: + + push: + branches: [ "*" ] + + schedule: + - cron: "0 8 * * 1" + +jobs: + test83: + name: "Nette Tester" + uses: contributte/.github/.github/workflows/nette-tester.yml@master + with: + php: "8.3" + + test82: + name: "Nette Tester" + uses: contributte/.github/.github/workflows/nette-tester.yml@master + with: + php: "8.2" + + test81: + name: "Nette Tester" + uses: contributte/.github/.github/workflows/nette-tester.yml@master + with: + php: "8.1" + + testlower: + name: "Nette Tester" + uses: contributte/.github/.github/workflows/nette-tester.yml@master + with: + php: "8.1" + composer: "composer update --no-interaction --no-progress --prefer-dist --prefer-stable --prefer-lowest" diff --git a/.gitignore b/.gitignore deleted file mode 100644 index b1b6f4d..0000000 --- a/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -# IDE -/.idea - -# Composer -/vendor -/composer.lock - -# Tests -/temp -/coverage.xml diff --git a/Makefile b/Makefile deleted file mode 100644 index 0598beb..0000000 --- a/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -.PHONY: qa lint cs csf phpstan tests coverage - -all: - @$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs - -vendor: composer.json composer.lock - composer install - -qa: lint phpstan cs - -lint: vendor - vendor/bin/linter src tests - -cs: vendor - vendor/bin/codesniffer src tests - -csf: vendor - vendor/bin/codefixer src tests - -phpstan: vendor - vendor/bin/phpstan analyse -l max -c phpstan.neon src - -tests: vendor - vendor/bin/tester -s -p php --colors 1 -C tests/cases - -coverage-clover: - vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage ./coverage.xml --coverage-src ./src tests/cases - -coverage-html: - vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage ./coverage.html --coverage-src ./src tests/cases diff --git a/phpstan.neon b/phpstan.neon deleted file mode 100644 index 9e9adeb..0000000 --- a/phpstan.neon +++ /dev/null @@ -1,5 +0,0 @@ -includes: - - vendor/phpstan/phpstan-deprecation-rules/rules.neon - - vendor/phpstan/phpstan-nette/extension.neon - - vendor/phpstan/phpstan-nette/rules.neon - - vendor/phpstan/phpstan-strict-rules/rules.neon diff --git a/ruleset.xml b/ruleset.xml deleted file mode 100644 index 225b9ae..0000000 --- a/ruleset.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - /tests/tmp -