From e5ca20fe3806ceb65f9205a210473794860caaf7 Mon Sep 17 00:00:00 2001 From: Roelof Roos Date: Sun, 21 Mar 2021 22:02:31 +0100 Subject: [PATCH 1/3] Fixed phar creation using the wrong file --- box.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/box.json b/box.json index 951802d..8c6fc81 100644 --- a/box.json +++ b/box.json @@ -5,7 +5,7 @@ "Herrera\\Box\\Compactor\\Php" ], "extract": false, - "main": "parallel-lint.php", + "main": "parallel-lint", "files": [ "LICENSE" ], From 483510753ada9b5d7c3c8f2ed884def93f371d9b Mon Sep 17 00:00:00 2001 From: Roelof Roos Date: Sun, 21 Mar 2021 22:02:51 +0100 Subject: [PATCH 2/3] Added GitHub Actions for release and testing --- .github/workflows/release.yml | 115 ++++++++++++++++++++++++++++++ .github/workflows/test.yml | 128 ++++++++++++++++++++++++++++++++++ 2 files changed, 243 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..9fbb685 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,115 @@ +name: Build and test phar + +on: + push: + tags: + - 'v*' + +jobs: + bundle: + name: Bundle binary + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 5.4 + extensions: exif, phar, openssl + coverage: false + ini-values: phar.readonly=Off + + - name: Install Box from GitHub + run: | + curl -LSs https://box-project.github.io/box2/installer.php | php + test -f ./box.phar + test -d ~/bin || mkdir ~/bin + mv ./box.phar ~/bin/box + ~/bin/box -V + echo "$HOME/bin" >> $GITHUB_PATH + + - name: Install Composer dependencies + uses: ramsey/composer-install@v1 + + - name: Building binary... + run: box build -v + + - uses: actions/upload-artifact@v2 + with: + name: parallel-lint-phar + path: ./parallel-lint.phar + + verify: + name: Validate binary on PHP ${{ matrix.php }} + runs-on: ubuntu-latest + continue-on-error: ${{ matrix.experimental == true }} + needs: + - bundle + + strategy: + matrix: + php: + - '5.4' + - '5.5' + - '5.6' + - '7.0' + - '7.1' + - '7.2' + - '7.3' + - '7.4' + - '8.0' + - '8.1' + + include: + - php: '8.1' + experimental: true + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - uses: actions/download-artifact@v2 + with: + name: parallel-lint-phar + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: false + + - name: Run linter against codebase + run: php ./parallel-lint.phar src/ + + publish: + name: Add binary to release + runs-on: ubuntu-latest + needs: + - bundle + - verify + + steps: + - uses: actions/download-artifact@v2 + with: + name: parallel-lint-phar + + - name: Draft Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: true + prerelease: false + + - name: Upload Phar as Release Asset + id: upload-release-asset + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + files: parallel-lint.phar diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..1491a1c --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,128 @@ +name: Run unit and style tests + +on: + pull_request: + push: + branches: + - develop + - master + +jobs: + lint: + name: Run style linter + runs-on: ubuntu-latest + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.0' + extensions: json + coverage: none + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install Composer dependencies + uses: ramsey/composer-install@v1 + + - name: Run code sniffer + run: vendor/bin/phpcs + + test: + name: Run unit tests + runs-on: ubuntu-latest + + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.0' + extensions: json + coverage: none + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install Composer dependencies + uses: ramsey/composer-install@v1 + + - name: Run tests + run: composer test + + bundle: + name: Bundle binary + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 5.4 + extensions: exif, phar, openssl + coverage: false + ini-values: phar.readonly=Off + + - name: Install Box from GitHub + run: | + curl -LSs https://box-project.github.io/box2/installer.php | php + test -f ./box.phar + test -d ~/bin || mkdir ~/bin + mv ./box.phar ~/bin/box + ~/bin/box -V + echo "$HOME/bin" >> $GITHUB_PATH + + - name: Install Composer dependencies + uses: ramsey/composer-install@v1 + + - name: Building binary... + run: box build -v + + - uses: actions/upload-artifact@v2 + with: + name: parallel-lint-phar + path: ./parallel-lint.phar + + verify-bundle: + name: Validate binary on PHP ${{ matrix.php }} + runs-on: ubuntu-latest + continue-on-error: ${{ matrix.experimental == true }} + needs: + - bundle + + strategy: + matrix: + php: + - '5.4' + - '5.5' + - '5.6' + - '7.0' + - '7.1' + - '7.2' + - '7.3' + - '7.4' + - '8.0' + - '8.1' + + include: + - php: '8.1' + experimental: true + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - uses: actions/download-artifact@v2 + with: + name: parallel-lint-phar + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: false + + - name: Run linter against codebase + run: php ./parallel-lint.phar src/ From 6866c027c21254b48912e394060fdb0f6b614542 Mon Sep 17 00:00:00 2001 From: Roelof Roos Date: Mon, 22 Mar 2021 00:23:44 +0100 Subject: [PATCH 3/3] Added tokenizer to setup-php on tests --- .github/workflows/test.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1491a1c..d948369 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,9 +36,8 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.0' - extensions: json - coverage: none + php-version: 5.4 + extensions: json, tokenizer - name: Checkout code uses: actions/checkout@v2