From fa5499b9fe91971de9f54317eec17c2984ea26cc Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Thu, 26 Nov 2020 16:19:29 +0300 Subject: [PATCH] Move CI to GitHub Actions (#11) --- .github/workflows/ci.yml | 62 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 46 ----------------------------- README.md | 9 +++--- 3 files changed, 67 insertions(+), 50 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c5b1618 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,62 @@ +name: ci + +on: + push: + branches: + - '**' + tags-ignore: + - '*.*' + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [10.x, 12.x, 13.x, 14.x] + steps: + - uses: actions/checkout@v2 + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: Install dependencies + run: npm install + - name: Run tests + run: npm run test + - name: Coverage + run: | + npm install -g codecov + npm run report-coverage + gh-pages: + needs: ['test'] + if: success() && github.event_name == 'push' && github.repository_owner == 'retailcrm' && github.ref == 'refs/heads/master' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup Node.js + uses: actions/setup-node@v1 + with: + node-version: 10.x + - name: Generate doc + run: npm run doc + - name: Deploy doc + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./out + deploy: + needs: ['test'] + if: success() && github.event_name == 'push' && github.repository_owner == 'retailcrm' && github.ref == 'refs/heads/master' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-node@v1 + with: + node-version: 10.x + - name: Build + run: npm run build + - name: Publish + uses: JS-DevTools/npm-publish@v1 + with: + token: ${{ secrets.NPM_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d955e7d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,46 +0,0 @@ -os: linux -language: node_js - -if: tag IS blank - -stages: - - test - - gh pages - - npm deploy - -script: npm run test - -jobs: - include: - - node_js: 10 - - node_js: 12 - - node_js: 13 - - node_js: 14 - after_success: - - npm install -g codecov - - npm run report-coverage - - stage: gh pages - node_js: 10 - script: skip - before_deploy: npm run doc - deploy: - provider: pages - skip-cleanup: true - github-token: $GITHUB_TOKEN - keep-history: true - local-dir: out - on: - branch: master - if: branch = master AND type = push AND fork = false - - stage: npm deploy - node_js: 10 - script: skip - before_deploy: npm run build - deploy: - provider: npm - email: $NPM_EMAIL - api_key: $NPM_API_KEY - skip-cleanup: true - on: - branch: master - if: branch = master AND type = push AND fork = false diff --git a/README.md b/README.md index 51ca915..1fcad5d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ -[![Build Status](https://img.shields.io/travis/retailcrm/mg-bot-api-client-js/master.svg?logo=travis&style=flat-square)](https://travis-ci.org/retailcrm/mg-bot-api-client-js) -[![GitHub release](https://img.shields.io/github/release/retailcrm/mg-bot-api-client-js.svg?style=flat-square)](https://github.com/retailcrm/mg-bot-api-client-js/releases) -[![Node version](https://img.shields.io/node/v/mg-api-client.svg?style=flat-square)](https://www.npmjs.com/package/mg-api-client) - +[![Build Status](https://github.com/retailcrm/mg-bot-api-client-js/workflows/ci/badge.svg)](https://github.com/retailcrm/mg-bot-api-client-js/actions) +[![Coverage](https://img.shields.io/codecov/c/gh/retailcrm/mg-bot-api-client-js/master.svg?logo=codecov)](https://codecov.io/gh/retailcrm/mg-bot-api-client-js) +[![Latest stable](https://img.shields.io/npm/v/mg-api-client.svg)](https://npmjs.com/package/mg-api-client) +[![Node version](https://img.shields.io/node/v/mg-api-client.svg)](https://www.npmjs.com/package/mg-api-client) +[![JS Doc](https://img.shields.io/badge/doc-github_pages-green)](https://retailcrm.github.io/mg-bot-api-client-js/) # Message Gateway Bot API JS client