From 78d80559eeda3a893d5cec52a0e0445328eadcbf Mon Sep 17 00:00:00 2001 From: Jonny Harris <148061917+jonnynews@users.noreply.github.com> Date: Tue, 21 Nov 2023 12:19:46 +0000 Subject: [PATCH] Add Github CI (#229) * Add Github CI * Add PHP lints --- .github/workflows/lint-php.yml | 44 ++++++++++++++++++++++++++++++++++ bin/release.sh | 1 + 2 files changed, 45 insertions(+) create mode 100644 .github/workflows/lint-php.yml diff --git a/.github/workflows/lint-php.yml b/.github/workflows/lint-php.yml new file mode 100644 index 0000000..1d4bb8d --- /dev/null +++ b/.github/workflows/lint-php.yml @@ -0,0 +1,44 @@ +name: PHP Lints + +on: + push: + branches: + - master + - release/* + pull_request: + +jobs: + lint-php: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + coverage: none + tools: composer, cs2pr + + - name: Get Composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Setup Composer cache + uses: pat-s/always-upload-cache@v2.1.3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + ${{ runner.os }}- + + - name: Validate composer.json + run: composer --no-interaction validate --no-check-all + + - name: Install dependencies + run: composer install --prefer-dist --no-suggest --no-progress --no-interaction + + - name: Detect coding standard violations (PHPCS) + run: vendor/bin/phpcs -q --report=checkstyle --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 | cs2pr --graceful-warnings \ No newline at end of file diff --git a/bin/release.sh b/bin/release.sh index d055cee..3389be9 100644 --- a/bin/release.sh +++ b/bin/release.sh @@ -51,6 +51,7 @@ rm "composer.json" rm "book.json" rm -r "bin" rm -r "docs" +rm -r ".github" # Add any new files svn status | grep -v "^.[ \t]*\..*" | grep "^?" | awk '{print $2}' | xargs svn add