From 718dc18c355f14c3972eba56a3e982a4a98c1356 Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Tue, 18 May 2021 20:18:13 +0200 Subject: [PATCH] use GitHub actions for CI and automate Sonarcloud analysis --- .github/workflows/test.yml | 44 +++++++++++++++++++ .../wordpress-plugin-asset-update.yml | 11 ++++- .github/workflows/wordpress-plugin-deploy.yml | 11 ++++- .travis.yml | 27 ------------ README.md | 2 +- 5 files changed, 63 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..acc1782 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,44 @@ +name: CI +on: push +jobs: + quality: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.0' + tools: composer + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: '14' + - name: Install + run: | + composer install --no-interaction + npm ci + - name: Code style checks for PHP, JS and CSS + run: | + composer lint-php + composer lint-js + composer lint-css + analysis: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Analyze with SonarCloud + uses: sonarsource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + with: + args: > + -Dsonar.organization=stklcode-github + -Dsonar.projectKey=stklcode:wp-liveticker + -Dsonar.sources=includes,scripts,views,stklcode-liveticker.php + -Dsonar.exclusions=scripts/*.min.js,styles/*.min.css diff --git a/.github/workflows/wordpress-plugin-asset-update.yml b/.github/workflows/wordpress-plugin-asset-update.yml index f7e32be..20fd65f 100644 --- a/.github/workflows/wordpress-plugin-asset-update.yml +++ b/.github/workflows/wordpress-plugin-asset-update.yml @@ -8,8 +8,15 @@ jobs: name: Push to stable runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: php-actions/composer@v5 + - name: Checkout + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.0' + tools: composer + - name: Install + run: composer install --no-interaction - name: Clean README.md run: tail -n +7 README.md > README.md.tmp && mv README.md.tmp README.md - name: WordPress.org plugin asset/readme update diff --git a/.github/workflows/wordpress-plugin-deploy.yml b/.github/workflows/wordpress-plugin-deploy.yml index 9d41b89..8b93218 100644 --- a/.github/workflows/wordpress-plugin-deploy.yml +++ b/.github/workflows/wordpress-plugin-deploy.yml @@ -9,8 +9,15 @@ jobs: name: New tag runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: php-actions/composer@v5 + - name: Checkout + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.0' + tools: composer + - name: Install + run: composer install --no-interaction - name: Clean README.md run: tail -n +7 README.md > README.md.tmp && mv README.md.tmp README.md - name: WordPress Plugin Deploy diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f16fc31..0000000 --- a/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -language: php -php: -- '7.3' -- '7.4' -- '8.0' -- nightly -dist: bionic - -matrix: - allow_failures: - - php: nightly - -before_install: - - nvm install 14 - -before_script: -- composer install -- npm install - -script: -- composer lint-php -- composer lint-js -- composer lint-css - -notifications: - slack: - secure: "R40BhRCETuDule7lz4oGN+qyLvd7dBmuEu6hVELNhWg3DgCgYOXyrWR2dgxsWsAZ3sldpWGfTJKzSShdDanGCpygpYzuvXxjt23YYJ2ihrohYJwiGIhkR9c24LF2yvWBQDBNZaeLBQ3o6FSnbkTBsmRy5ShgKehfKCOQTKmI1yWHi3fvkMElTorrJc710O41yy/bRKBnoIYd4ZfpLMSSVGCPzR5lZPZy3EiGWXPgYdY7jGMI7ADsy+T5VWHyFqgSSJz/U2bcryKzF08FAry8pyu9lN3r61kXHfVCCJX+kcsFxW9yCfuPLnLu14O776y3U6zrX9is+8mEfkMuTXFaL5o8+iq32AmFjTIDQn6o9BKHsknfmppjwZiLgFTp1T7Z/XR6I4nyK9Z5HXDU2HS0eCUknbgXlMLhxWpKhkyx4rQELuvVlgD+u7yRYraawc3v1ycqaPj0S0G5QBFljSuxsZgNnX1hs8VmgafIvOq5qm4ZVVBhhbz+LgvW1m9COr8DDPVhWWdpcWzF8jtkqC3m4Q/1Ssc6T/MbJMgcXRq/C4DlfEs4aYGYfSl7gLtF2PwlEQCppKJwx0fEPkcbZZ1PjpzF+JMwwRmWS88R0oRyThOyCwlG50c+ktB94pJC+sP1aQZrLAd4WDKUPD9vJTas86V3XBjTUJPs8HQaBDFqFdg=" diff --git a/README.md b/README.md index 6753761..062e2fb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.com/stklcode/wp-liveticker.svg?branch=stable)](https://travis-ci.com/stklcode/wp-liveticker) +[![CI](https://github.com/stklcode/wp-liveticker/actions/workflows/test.yml/badge.svg?branch=stable)](https://github.com/stklcode/wp-liveticker/actions/workflows/test.yml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=stklcode%3Awp-liveticker&metric=alert_status)](https://sonarcloud.io/dashboard?id=stklcode%3Awp-liveticker) [![WP Plugin Version](https://img.shields.io/wordpress/plugin/v/stklcode-liveticker.svg)](https://wordpress.org/plugins/stklcode-liveticker/) [![Packagist Version](https://img.shields.io/packagist/v/stklcode/stklcode-liveticker.svg)](https://packagist.org/packages/stklcode/stklcode-liveticker)