This repository has been archived by the owner on Nov 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ci): migration from Travis CI to github actions
- Loading branch information
1 parent
69bd58e
commit 8f9247e
Showing
6 changed files
with
211 additions
and
358 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Release | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
test: | ||
name: Test @ PHP ${{ matrix.php-version }} - x86 - ubuntu-latest | ||
# Support [skip ci] out of box with github actions Workaround | ||
# Only works for push https://github.com/actions/runner/issues/774 | ||
if: github.event_name == 'pull_request' || (github.event_name == 'push' && contains(toJson(github.event.commits), '[skip ci]') == false) | ||
strategy: | ||
matrix: | ||
php-version: | ||
- 7.4 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup NodeJS LTS | ||
uses: actions/setup-node@v2 | ||
- name: Install dependencies | ||
run: | | ||
npm prune | ||
npm i | ||
- name: Install Dependencies::PHP${{ matrix.php-version }} | ||
run: | | ||
echo "$HOME/.composer/vendor/bin" >> $GITHUB_PATH | ||
composer global require phpunit/phpunit dealerdirect/phpcodesniffer-composer-installer roave/security-advisories:dev-master squizlabs/php_codesniffer phpcompatibility/php-compatibility | ||
# TODO migrate the below to gulp calls | ||
- name: Check PHP Compatibility | ||
run: phpcs --standard=PHPCompatibility -q -n --colors --runtime-set testVersion ${{ matrix.php-version }} --extensions=php --ignore=node_modules,vendor,templates_c . || exit 1; | ||
- name: Check PSR12 Standard | ||
run: phpcs --standard=PSR12 -q -n --colors --extensions=php,inc,lib --ignore=node_modules,vendor,templates_c . | ||
- name: Run tests | ||
run: phpunit | ||
release: | ||
name: Release @ NodeJS LTS - x86 - ubuntu-latest | ||
runs-on: ubuntu-latest | ||
needs: | ||
- test | ||
if: github.ref == 'refs/heads/master' && github.event_name == 'push' | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
persist-credentials: false | ||
- name: Setup NodeJS LTS | ||
uses: actions/setup-node@v2 | ||
- name: Install dependencies | ||
run: | | ||
npm prune | ||
npm i | ||
- name: Release | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||
WHMCSMP_LOGIN: ${{ secrets.WHMCSMP_LOGIN }} | ||
WHMCSMP_PASSWORD: ${{ secrets.WHMCSMP_PASSWORD }} | ||
WHMCSMP_PRODUCTID: ${{ secrets.WHMCSMP_PRODUCTID_ISPAPI_PRICINGIMPORT }} | ||
run: npx semantic-release |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
const { series, src, dest } = require('gulp') | ||
const clean = require('gulp-clean') | ||
const zip = require('gulp-zip') | ||
const tar = require('gulp-tar') | ||
const gzip = require('gulp-gzip') | ||
const exec = require('util').promisify(require('child_process').exec) | ||
const cfg = require('./gulpfile.json') | ||
|
||
/** | ||
* Perform PHP Linting | ||
*/ | ||
async function doLint () { | ||
// these may fail, it's fine | ||
try { | ||
await exec(`${cfg.phpcsfixcmd} ${cfg.phpcsparams}`) | ||
} catch (e) { | ||
} | ||
|
||
// these shouldn't fail | ||
try { | ||
await exec(`${cfg.phpcschkcmd} ${cfg.phpcsparams}`) | ||
await exec(`${cfg.phpcomptcmd} ${cfg.phpcsparams}`) | ||
// await exec(`${cfg.phpstancmd}`); | ||
} catch (e) { | ||
await Promise.reject(e.message) | ||
} | ||
await Promise.resolve() | ||
} | ||
|
||
/** | ||
* cleanup old build folder / archive | ||
* @return stream | ||
*/ | ||
function doDistClean () { | ||
return src([cfg.archiveBuildPath, `${cfg.archiveFileName}-latest.zip`], { read: false, base: '.', allowEmpty: true }) | ||
.pipe(clean({ force: true })) | ||
} | ||
|
||
/** | ||
* Copy all files/folders to build folder | ||
* @return stream | ||
*/ | ||
function doCopyFiles () { | ||
return src(cfg.filesForArchive, { base: '.' }) | ||
.pipe(dest(cfg.archiveBuildPath)) | ||
} | ||
|
||
/** | ||
* Clean up files | ||
* @return stream | ||
*/ | ||
function doFullClean () { | ||
return src(cfg.filesForCleanup, { read: false, base: '.', allowEmpty: true }) | ||
.pipe(clean({ force: true })) | ||
} | ||
|
||
/** | ||
* build latest zip archive | ||
* @return stream | ||
*/ | ||
function doGitZip () { | ||
return src(`./${cfg.archiveBuildPath}/**`) | ||
.pipe(zip(`${cfg.archiveFileName}-latest.zip`)) | ||
.pipe(dest('.')) | ||
} | ||
|
||
/** | ||
* build zip archive | ||
* @return stream | ||
*/ | ||
function doZip () { | ||
return src(`./${cfg.archiveBuildPath}/**`) | ||
.pipe(zip(`${cfg.archiveFileName}.zip`)) | ||
.pipe(dest('./pkg')) | ||
} | ||
|
||
/** | ||
* build tar archive | ||
* @return stream | ||
*/ | ||
function doTar () { | ||
return src(`./${cfg.archiveBuildPath}/**`) | ||
.pipe(tar(`${cfg.archiveFileName}.tar`)) | ||
.pipe(gzip()) | ||
.pipe(dest('./pkg')) | ||
} | ||
|
||
exports.lint = series( | ||
doLint | ||
) | ||
|
||
exports.copy = series( | ||
doDistClean, | ||
doCopyFiles | ||
) | ||
|
||
exports.prepare = series( | ||
exports.lint, | ||
exports.copy | ||
) | ||
|
||
exports.archives = series( | ||
doGitZip, | ||
doZip, | ||
doTar | ||
) | ||
|
||
exports.default = series( | ||
exports.prepare, | ||
exports.archives, | ||
doFullClean | ||
) | ||
exports.release = series( | ||
exports.copy, | ||
exports.archives, | ||
doFullClean | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"phpcsparams": "--extensions=php --ignore=node_modules,vendor,templates_c -q .", | ||
"phpcsfixcmd": "phpcbf --standard=PSR12", | ||
"phpcschkcmd": "phpcs -n --colors --standard=PSR12", | ||
"phpcomptcmd": "phpcs -n --colors --standard=PHPCompatibility --runtime-set testVersion \"$(php -r 'echo PHP_MAJOR_VERSION . \".\" . PHP_MINOR_VERSION;')\"", | ||
"phpstancmd": "./vendor/bin/phpstan analyse", | ||
"archiveFileName": "whmcs-ispapi-pricingimporter", | ||
"archiveBuildPath": "build", | ||
"filesForArchive": [ | ||
"README.md", | ||
"CONTRIBUTING.md", | ||
"HISTORY.md", | ||
"LICENSE", | ||
"modules/**" | ||
], | ||
"filesForCleanup": [ | ||
"templates_c", | ||
"composer.lock", | ||
".phpunit.result.cache", | ||
"package-lock.json", | ||
"tmp" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.