From 996c8b53ebb134098a5752b8f671b0a62ab5cf0f Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Thu, 23 Apr 2020 15:44:24 +0100 Subject: [PATCH 1/2] Build on github --- .github/workflows/build.yml | 56 +++++++++++++++++++++++++++ .github/workflows/publish-website.yml | 26 +++++++++++++ .github/workflows/update-phars.yml | 23 +++++++++++ Makefile | 22 +++++------ bin/devkit.php | 2 +- resources/tools.json | 2 +- 6 files changed, 118 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/publish-website.yml create mode 100644 .github/workflows/update-phars.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..17b2cea2 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,56 @@ +name: Build + +on: + push: + branches: [master] + pull_request: + release: + types: [created] + schedule: + - cron: '0 4 * * *' + +jobs: + tests: + runs-on: ubuntu-latest + name: Build and test + strategy: + matrix: + php: [7.2, 7.3, 7.4] + deps: [high] + include: + - php: 7.2 + deps: low + container: + image: docker://jakzal/phpqa:php${{ matrix.php }}-alpine + steps: + - uses: actions/checkout@master + - if: matrix.deps == 'high' + run: make install test package package-devkit + - if: matrix.deps == 'low' + run: make update-min test-min + - uses: actions/upload-artifact@v1 + if: matrix.php == '7.2' && matrix.deps == 'high' + with: + name: toolbox.phar + path: build/toolbox.phar + - uses: actions/upload-artifact@v1 + if: matrix.php == '7.2' && matrix.deps == 'high' + with: + name: devkit.phar + path: build/devkit.phar + integration-tests: + runs-on: ubuntu-latest + name: Run integration tests + needs: tests + strategy: + matrix: + php: [7.2, 7.3, 7.4] + container: + image: docker://jakzal/phpqa:php${{ matrix.php }}-alpine + steps: + - uses: actions/checkout@master + - uses: actions/download-artifact@v1 + with: + name: toolbox.phar + path: build/ + - run: make test-integration diff --git a/.github/workflows/publish-website.yml b/.github/workflows/publish-website.yml new file mode 100644 index 00000000..2d8cdd96 --- /dev/null +++ b/.github/workflows/publish-website.yml @@ -0,0 +1,26 @@ +name: Publish the website + +on: + push: + branches: [master] + release: + types: [created] + +jobs: + publish-website: + runs-on: ubuntu-latest + name: Build and publish + steps: + - uses: actions/checkout@v2 + with: + persist-credentials: false + - name: Build the website + uses: docker://jakzal/phpqa:alpine + with: + args: make package-devkit website + - name: Publish the website + uses: JamesIves/github-pages-deploy-action@releases/v3 + with: + ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} + BRANCH: gh-pages + FOLDER: build/website diff --git a/.github/workflows/update-phars.yml b/.github/workflows/update-phars.yml new file mode 100644 index 00000000..e7c381f4 --- /dev/null +++ b/.github/workflows/update-phars.yml @@ -0,0 +1,23 @@ +name: Update PHARs + +on: + push: + branches: [master] + pull_request: + release: + types: [created] + +jobs: + update-phars: + runs-on: ubuntu-latest + name: Create a PR + steps: + - uses: actions/checkout@v2 + - uses: geertvdc/setup-hub@master + - run: git config user.email 'jakub@zalas.pl' && git config user.name 'Jakub Zalas' + - uses: docker://jakzal/phpqa:alpine + with: + args: make package-devkit update-phars + - run: "hub pull-request -h tools-update -a jakzal -m 'Update tools' -m '' -m ':robot: This pull request was automagically sent from Github'" + env: + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} diff --git a/Makefile b/Makefile index ebb2688b..5cac9c21 100644 --- a/Makefile +++ b/Makefile @@ -28,10 +28,11 @@ test: vendor cs deptrac phpunit infection test-min: update-min cs deptrac phpunit infection .PHONY: test-min -test-integration: package +test-integration: build/toolbox.phar rm -rf ./build/tools && \ export PATH="$(shell pwd)/build/tools:$(shell pwd)/build/tools/.composer/vendor/bin:$(shell pwd)/build/tools/QualityAnalyzer/bin:$(shell pwd)/build/tools/EasyCodingStandard/bin:$$PATH" && \ export COMPOSER_HOME=$(shell pwd)/build/tools/.composer && \ + ls -l build && whoami && \ chmod +x build/toolbox.phar && \ mkdir -p ./build/tools && \ build/toolbox.phar install --target-dir ./build/tools --exclude-tag exclude-php:$(PHP_VERSION) && \ @@ -93,10 +94,10 @@ package-devkit: tools/box @rm -rf build/devkit-phar .PHONY: package-devkit -website: +website: build/devkit.phar rm -rf build/website mkdir -p build/website - php bin/devkit.php generate:html > build/website/index.html + php build/devkit.phar generate:html > build/website/index.html touch build/website/.nojekyll .PHONY: website @@ -108,16 +109,15 @@ publish-website: website git push --force --quiet "https://github.com/jakzal/toolbox.git" master:gh-pages .PHONY: publish-website -update-phars: +update-phars: vendor php bin/devkit.php update:phars git diff --exit-code resources/ || \ - ( \ - git checkout -b tools-update && \ - git add resources/*.json && \ - git commit -m "Update tools" && \ - git push origin tools-update && \ - hub pull-request -h tools-update -a jakzal -m 'Update tools' -m '' -m ':robot: This pull request was automagically sent from [Travis CI]('$(TRAVIS_BUILD_WEB_URL)').' \ - ) + ( \ + git checkout -b tools-update && \ + git add resources/*.json && \ + git commit -m "Update tools" && \ + git push origin tools-update \ + ) .PHONY: update-phars tools: tools/php-cs-fixer tools/deptrac tools/infection tools/box diff --git a/bin/devkit.php b/bin/devkit.php index 2badf191..89abea87 100755 --- a/bin/devkit.php +++ b/bin/devkit.php @@ -170,7 +170,7 @@ protected function configure() protected function execute(InputInterface $input, OutputInterface $output) { - $tools = $this->loadTools($input->getOption('tools'), new Filter([\Zalas\Toolbox\UseCase\InstallTools::PRE_INSTALLATION_TAG], [])); + $tools = $this->loadTools($input->getOption('tools'), new Filter(['pre-installation'], [])); $output->writeln($this->renderPage($tools->map($this->toolToHtml()))); diff --git a/resources/tools.json b/resources/tools.json index 0c737dee..56d8f837 100644 --- a/resources/tools.json +++ b/resources/tools.json @@ -174,7 +174,7 @@ "website": "https://pdepend.org/", "command": { "phar-download": { - "phar": "https://github.com/pdepend/pdepend/releases/download/2.7.1/pdepend.phar", + "phar": "https://github.com/pdepend/pdepend/releases/download/2.7.0/pdepend.phar", "bin": "%target-dir%/pdepend" } }, From fd3a2b1720be4a5e9f319c213428432e58e23006 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Fri, 24 Apr 2020 12:05:32 +0000 Subject: [PATCH 2/2] Update tools --- resources/tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/tools.json b/resources/tools.json index 56d8f837..0c737dee 100644 --- a/resources/tools.json +++ b/resources/tools.json @@ -174,7 +174,7 @@ "website": "https://pdepend.org/", "command": { "phar-download": { - "phar": "https://github.com/pdepend/pdepend/releases/download/2.7.0/pdepend.phar", + "phar": "https://github.com/pdepend/pdepend/releases/download/2.7.1/pdepend.phar", "bin": "%target-dir%/pdepend" } },