From b81a5298904ba4d7772bab475b7cb385dd86cb43 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Wed, 10 Feb 2021 08:48:49 -0600 Subject: [PATCH] feat: 1.0.0 readiness - Removes obsolete `index.js` file. - Updates documentation to reflect v1 everywhere. - Updates `Dockerfile` to pull v1 container. Signed-off-by: Matthew Weier O'Phinney --- Dockerfile | 2 +- README.md | 22 ++++++-- index.js | 155 ----------------------------------------------------- 3 files changed, 19 insertions(+), 160 deletions(-) delete mode 100644 index.js diff --git a/Dockerfile b/Dockerfile index dbbd086f..f6b42a49 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/laminas/laminas-ci-matrix-container:0 +FROM ghcr.io/laminas/laminas-ci-matrix-container:1 LABEL "com.github.actions.icon"="share-2" LABEL "com.github.actions.color"="blue" diff --git a/README.md b/README.md index 66cb1fab..1d08d274 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,9 @@ Currently, it identifies the following: - phpcs checks based on the presence of `phpcs.xml.dist` or `phpcs.xml` files. - Psalm checks based on the presence of `psalm.xml.dist` or `psalm.xml` files. - phpbench benchmarks based on the presence of a `phpbench.json`. +- Markdown documentation based on the presence of a `mkdocs.yml` and/or markdown files in the `doc/book/` or `doc/books/` trees. + +Further, when triggered by a `pull_request` event, it determines what checks are necessary based on which files were affected. ## Usage @@ -22,10 +25,9 @@ jobs: outputs: matrix: ${{ steps.matrix.outputs.matrix }} steps: - - uses: actions/checkout@v2 - name: Gather CI configuration + - name: Gather CI configuration id: matrix - uses: laminas/laminas-ci-matrix-action@v0 + uses: laminas/laminas-ci-matrix-action@v1 qa: name: QA Checks @@ -36,7 +38,7 @@ jobs: matrix: ${{ fromJSON(needs.matrix.outputs.matrix) }} steps: - name: ${{ matrix.name }} - uses: laminas/laminas-continuous-integration-action@v0 + uses: laminas/laminas-continuous-integration-action@v1 with: job: ${{ matrix.job }} ``` @@ -110,3 +112,15 @@ The package can include a configuration file in its root, `.laminas-ci.json`, wh The "checks" array should be in the same format as listed above for the outputs. Please remember that the **job** element **MUST** be a JSON **string** + +The easiest way to exclude a single job is via the `name` parameter: + +```json +{ + "exclude": [ + { + "name": "PHPUnit on PHP 8.0 with latest dependencies" + } + ] +} +``` diff --git a/index.js b/index.js deleted file mode 100644 index e83a9e41..00000000 --- a/index.js +++ /dev/null @@ -1,155 +0,0 @@ -const core = require('@actions/core'); -const semver = require('semver') -const fs = require('fs') - -let config = {}; -if (fs.existsSync('.laminas-ci.json')) { - try { - config = JSON.parse(fs.readFileSync('.laminas-ci.json')); - } catch (error) { - core.setFailed('Failed to parse .laminas-ci.json: ' + error.message); - } -} - -let composerJson = {}; -try { - composerJson = JSON.parse(fs.readFileSync('composer.json')); -} catch (error) { - core.setFailed('Failed to parse composer.json: ' + error.message); -} - -let stablePHP = config["stablePhp"] !== undefined ? config["stablePhp"] : "7.4"; -core.info(`Using stable PHP version: ${stablePHP}`); - -let phpIni = ["memory_limit=-1"]; -if (config.ini !== undefined && Array.isArray(config.ini)) { - phpIni = phpIni.concat(config.ini); -} -core.info(`Providing php.ini settings: ${JSON.stringify(phpIni)}`); - -let extensions = []; -if (config.extensions !== undefined && Array.isArray(config.extensions)) { - extensions = extensions.concat(config.extensions); -} -core.info(`Using php extensions: ${JSON.stringify(extensions)}`); - -let versions = []; -[ - '5.6', - '7.0', - '7.1', - '7.2', - '7.3', - '7.4', - '8.0', -].forEach(function (version) { - if (semver.satisfies(version + '.0', composerJson['require']['php'])) { - versions.push(version); - } -}); -core.info(`Versions found: ${JSON.stringify(versions)}`); - -let dependencies = ['lowest', 'latest']; -if (fs.existsSync('composer.lock')) { - dependencies.push('locked'); -} -core.info(`Dependency sets found: ${JSON.stringify(dependencies)}`); - -let phpunit = false; -if (fs.existsSync('./phpunit.xml.dist') || fs.existsSync('./phpunit.xml')) { - core.info('Found phpunit configuration'); - phpunit = true; -} else { - core.info('NO phpunit configuration found'); -} - -let checks = []; - -if (config.checks !== undefined && Array.isArray(config.checks)) { - core.info('Using checks found in configuration'); - checks = config; -} else { - core.info('Discovering checks based on QA files in package'); - [ - { - // Eventually: command: "./vendor/bin/phpcs --report checkstyle | cs2pr", - command: "./vendor/bin/phpcs", - test: [ - 'phpcs.xml.dist', - 'phpcs.xml', - ] - }, - { - command: "./vendor/bin/psalm --shepherd --stats --output-format=github", - test: [ - 'psalm.xml.dist', - 'psalm.xml', - ] - }, - { - command: "./vendor/bin/phpbench run --revs=2 --iterations=2 --report=aggregate", - test: [ - 'phpbench.json', - ] - }, - ].forEach(function (check) { - check.test.forEach(function (filename) { - if (checks.indexOf(check.command) !== -1) { - return; - } - - if (fs.existsSync(filename)) { - checks.push(check.command); - } - }); - }); -} -core.info(`Checks found: ${JSON.stringify(checks)}`); - -let jobs = []; -if (phpunit) { - versions.forEach(function (version) { - dependencies.forEach(function (deps) { - let job = { - command: './vendor/bin/phpunit', - php: version, - extensions: extensions, - ini: phpIni, - dependencies: deps, - }; - jobs.push({ - name: 'PHPUnit on PHP ' + version + ' with ' + deps + ' dependencies', - job: JSON.stringify(job), - operatingSystem: 'ubuntu-latest', - action: 'docker://ghcr.io/weierophinney/laminas-check-runner:latest', - }); - }); - }); -} -if (checks.length) { - checks.forEach(function (command) { - let job = { - command: command, - php: stablePHP, - extensions: extensions, - ini: phpIni, - dependencies: 'locked', - }; - jobs.push({ - name: command + ' on PHP ' + stablePHP, - job: JSON.stringify(job), - operatingSystem: 'ubuntu-latest', - action: 'docker://ghcr.io/weierophinney/laminas-check-runner:latest', - }); - }); -} - -let matrix = {include: jobs}; - -if (config.exclude !== undefined && Array.isArray(config.exclude)) { - core.info('Adding exclusions from configuration'); - matrix.exclude = config.exclude; -} - -core.info(`Matrix: ${JSON.stringify(matrix)}`); -core.setOutput('matrix', JSON.stringify(matrix));