From 1f58fe46dcdfb0948f19291c4ec14f8e88e7aaeb Mon Sep 17 00:00:00 2001 From: codepuncher Date: Wed, 27 Dec 2023 13:20:08 +0000 Subject: [PATCH 1/3] ci: add `test` workflow --- .github/workflows/test.yml | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..52f4807 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,41 @@ +# yamllint disable-line rule:document-start +name: test + +# yamllint disable-line rule:truthy +on: + push: + branches: + - "*" + +jobs: + php: + name: php-${{ matrix.php }} + runs-on: ubuntu-latest + strategy: + matrix: + php: [8.1] + steps: + - uses: actions/checkout@v3 + + - name: Setup PHP ${{ matrix.php }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + env: + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Get composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> "${GITHUB_OUTPUT}" + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer- + + - name: Install Composer dependencies + run: composer install --no-progress --prefer-dist --optimize-autoloader + + - run: composer run-script style:check From 072cd22281857e34c4261c9fd7a4afd04388a5aa Mon Sep 17 00:00:00 2001 From: codepuncher Date: Wed, 27 Dec 2023 13:53:57 +0000 Subject: [PATCH 2/3] ci: add `release` workflow --- .github/workflows/release.yml | 52 +++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..864f1be --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,52 @@ +# yamllint disable-line rule:document-start +name: release + +# yamllint disable-line rule:truthy +on: + push: + tags: + - "*.*.*" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Setup PHP 8.1 + uses: shivammathur/setup-php@v2 + with: + php-version: 8.1 + env: + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Build release + run: composer run-script release:build + + - uses: actions/upload-artifact@v4 + with: + name: gf-sagepay + path: release/*.zip + + lint-wp-org: + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/download-artifact@v4 + with: + name: gf-sagepay + - run: unzip gf-sagepay.zip -d /tmp/plugin-source-code + - run: find /tmp/plugin-source-code -name "*.php" -print0 | xargs -n 1 -0 php -l + + publish-to-github-releases: + runs-on: ubuntu-latest + needs: lint-wp-org + steps: + - uses: actions/checkout@v3 + - uses: actions/download-artifact@v4 + with: + name: gf-sagepay + - name: Create release + run: gh release create "${GITHUB_REF/refs\/tags\//}" gf-sagepay.zip --generate-notes + env: + GH_TOKEN: ${{ github.token }} From 40b6d93d9585ccd62b1fa4ee52eba8a4500d60db Mon Sep 17 00:00:00 2001 From: codepuncher Date: Wed, 27 Dec 2023 14:40:24 +0000 Subject: [PATCH 3/3] chore: delete circleci config --- .circleci/config.yml | 90 -------------------------------------------- 1 file changed, 90 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index e5c539f..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,90 +0,0 @@ -version: 2.1 - -orbs: - php: circleci/php@1 - -executors: - default: - docker: - - image: 'cibuilds/github:latest' - -jobs: - lint-wp-org: - parameters: - zip: - type: string - description: path to plugin zip file - executor: - name: php/default - tag: '7.2' - steps: - - run: unzip << parameters.zip >> -d /tmp/plugin-source-code - - run: find /tmp/plugin-source-code -name "*.php" -print0 | xargs -n 1 -0 php -l - publish-to-github-releases: - parameters: - github_token: - type: string - description: GitHub personal access token. For a private repository you need `repo` scope and for a public repository you need `public_repo` scope - default: ${GITHUB_TOKEN} - artifact_dir: - type: string - description: directory path of the artifacts to be uploaded - default: . - executor: - type: executor - default: default - executor: << parameters.executor >> - steps: - - run: ghr -t << parameters.github_token >> -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -soft ${CIRCLE_TAG} << parameters.artifact_dir >> - -workflows: - test: - jobs: - - php/test: - name: style-check - test-command: style:check - - # TODO: Extract orbs - # TODO: Commit wo.org svn - build_release: - jobs: - - php/test: - name: build - # Build with lowest support PHP version - # wp.org svn pre-commit hook rejects PHP 7.3+ syntax - version: '7.2' - test-command: release:build - post-steps: - - store_artifacts: - path: release - - persist_to_workspace: - root: ~/project - paths: - - release/*.zip - filters: - tags: - only: /.*/ - - lint-wp-org: - name: lint-wp-org - requires: - - build - zip: release/gf-sagepay.zip - pre-steps: - - attach_workspace: - at: ~/project - filters: - tags: - only: /.*/ - - publish-to-github-releases: - requires: - - build - - lint-wp-org - artifact_dir: release - pre-steps: - - attach_workspace: - at: ~/project - filters: - tags: - only: /.*/ - branches: - ignore: /.*/