From 766f20e7d28d3e3c5622d8d20d3e9026e688745c Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 27 Jul 2021 08:38:45 +0200 Subject: [PATCH] run release process on github --- .github/workflows/deployRelease.yml | 42 +++++++++++++++++ .github/workflows/phpTestLinux.yml | 52 +++++++++++++++++++++ _test/{general.test.php => GeneralTest.php} | 40 +++++++++++----- 3 files changed, 123 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/deployRelease.yml create mode 100644 .github/workflows/phpTestLinux.yml rename _test/{general.test.php => GeneralTest.php} (68%) diff --git a/.github/workflows/deployRelease.yml b/.github/workflows/deployRelease.yml new file mode 100644 index 0000000..c5e6f6a --- /dev/null +++ b/.github/workflows/deployRelease.yml @@ -0,0 +1,42 @@ +name: Deploy Release + +on: + workflow_run: + workflows: ["PHP Tests on Linux"] + branches: [master] + types: + - completed + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v2.3.1 + + - name: Install and Build 🔧 + run: | + yarn install + yarn build + rm -rf .babelrc + rm -rf .eslintrc.js + rm -rf .github + rm -rf .gitignore + rm -rf .travis.yml + rm -rf _jstest + rm -rf _test + rm -rf node_modules + rm -rf package.json + rm -rf pre-commit.hook.sh + rm -rf requirements.txt + rm -rf script + rm -rf stylelint.config.js + rm -rf webpack.config.js + rm -rf yarn.lock + + - name: Deploy 🚀 + uses: JamesIves/github-pages-deploy-action@4.1.4 + with: + branch: release + folder: . diff --git a/.github/workflows/phpTestLinux.yml b/.github/workflows/phpTestLinux.yml new file mode 100644 index 0000000..60e745d --- /dev/null +++ b/.github/workflows/phpTestLinux.yml @@ -0,0 +1,52 @@ +name: PHP Tests on Linux + +on: [push, pull_request] + +jobs: + testLinux: + name: PHP ${{ matrix.php-versions }} DokuWiki ${{ matrix.dokuwiki-branch }} + runs-on: ubuntu-latest + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository + + strategy: + matrix: + php-versions: ['7.2', '7.3', '7.4', '8.0'] + dokuwiki-branch: [ 'stable' ] + exclude: + - dokuwiki-branch: 'stable' + php-versions: '8.0' + fail-fast: false + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring, intl, PDO, pdo_sqlite, bz2 + + - name: Setup problem matchers + run: | + echo ::add-matcher::${{ runner.tool_cache }}/php.json + echo ::add-matcher::${{ runner.tool_cache }}/phpunit.json + + - name: Download DokuWiki Test-setup + run: wget https://raw.github.com/splitbrain/dokuwiki-travis/master/travis.sh + + - name: Run DokuWiki Test-setup + env: + CI_SERVER: 1 + DOKUWIKI: ${{ matrix.dokuwiki-branch }} + run: sh travis.sh + + - name: Setup PHPUnit + run: | + php _test/fetchphpunit.php + cd _test + + - name: Run PHPUnit + run: | + cd _test + php phpunit.phar --verbose --stderr --group plugin_prosemirror diff --git a/_test/general.test.php b/_test/GeneralTest.php similarity index 68% rename from _test/general.test.php rename to _test/GeneralTest.php index c0b66e3..b667315 100644 --- a/_test/general.test.php +++ b/_test/GeneralTest.php @@ -1,18 +1,22 @@ assertFileExists($file); @@ -38,29 +42,43 @@ class general_plugin_prosemirror_test extends DokuWikiTest * Test to ensure that every conf['...'] entry in conf/default.php has a corresponding meta['...'] entry in * conf/metadata.php. */ - public function test_plugin_conf() + public function testPluginConf(): void { $conf_file = __DIR__ . '/../conf/default.php'; + $meta_file = __DIR__ . '/../conf/metadata.php'; + + if (!file_exists($conf_file) && !file_exists($meta_file)) { + self::markTestSkipped('No config files exist -> skipping test'); + } + if (file_exists($conf_file)) { include($conf_file); } - $meta_file = __DIR__ . '/../conf/metadata.php'; if (file_exists($meta_file)) { include($meta_file); } - $this->assertEquals(gettype($conf), gettype($meta), - 'Both ' . DOKU_PLUGIN . 'prosemirror/conf/default.php and ' . DOKU_PLUGIN . 'prosemirror/conf/metadata.php have to exist and contain the same keys.'); + $this->assertEquals( + gettype($conf), + gettype($meta), + 'Both ' . DOKU_PLUGIN . 'prosemirror/conf/default.php and ' . DOKU_PLUGIN . 'prosemirror/conf/metadata.php have to exist and contain the same keys.' + ); - if (gettype($conf) != 'NULL' && gettype($meta) != 'NULL') { + if ($conf !== null && $meta !== null) { foreach ($conf as $key => $value) { - $this->assertArrayHasKey($key, $meta, - 'Key $meta[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'prosemirror/conf/metadata.php'); + $this->assertArrayHasKey( + $key, + $meta, + 'Key $meta[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'prosemirror/conf/metadata.php' + ); } foreach ($meta as $key => $value) { - $this->assertArrayHasKey($key, $conf, - 'Key $conf[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'prosemirror/conf/default.php'); + $this->assertArrayHasKey( + $key, + $conf, + 'Key $conf[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'prosemirror/conf/default.php' + ); } }