From 08ea30ff4e64696190c778e51ef1e148f75caf10 Mon Sep 17 00:00:00 2001 From: zombiej Date: Fri, 30 Oct 2020 15:28:55 +0800 Subject: [PATCH 1/3] chore: Use github action --- .github/workflows/main.yml | 113 +++++++++++++++++++++++++++++++++++++ .travis.yml | 18 ------ 2 files changed, 113 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/main.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..531d5c3 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,113 @@ +name: CI + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + setup: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@master + + - uses: actions/setup-node@v1 + with: + node-version: '12' + + - name: cache package-lock.json + uses: actions/cache@v1 + with: + path: package-temp-dir + key: lock-${{ github.sha }} + + - name: create package-lock.json + run: npm i --package-lock-only + + - name: hack for singe file + run: | + if [ ! -d "package-temp-dir" ]; then + mkdir package-temp-dir + fi + cp package-lock.json package-temp-dir + - name: cache node_modules + id: node_modules_cache_id + uses: actions/cache@v1 + with: + path: node_modules + key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} + + - name: install + if: steps.node_modules_cache_id.outputs.cache-hit != 'true' + run: npm ci + + lint: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@master + + - name: restore cache from package-lock.json + uses: actions/cache@v1 + with: + path: package-temp-dir + key: lock-${{ github.sha }} + + - name: restore cache from node_modules + uses: actions/cache@v1 + with: + path: node_modules + key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} + + - name: lint + run: npm run lint + + needs: setup + + compile: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@master + + - name: restore cache from package-lock.json + uses: actions/cache@v1 + with: + path: package-temp-dir + key: lock-${{ github.sha }} + + - name: restore cache from node_modules + uses: actions/cache@v1 + with: + path: node_modules + key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} + + - name: compile + run: npm run compile + + needs: setup + + coverage: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@master + + - name: restore cache from package-lock.json + uses: actions/cache@v1 + with: + path: package-temp-dir + key: lock-${{ github.sha }} + + - name: restore cache from node_modules + uses: actions/cache@v1 + with: + path: node_modules + key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} + + - name: coverage + run: npm run coverage && bash <(curl -s https://codecov.io/bash) + + needs: setup diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 322d9dc..0000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: node_js - -node_js: - - 12 - -script: -- | - if [ "$TEST_TYPE" = test ]; then - npm run test -- --coverage && \ - bash <(curl -s https://codecov.io/bash) - else - npm run $TEST_TYPE - fi -env: - matrix: - - TEST_TYPE=lint - - TEST_TYPE=test - - TEST_TYPE=compile \ No newline at end of file From dc2c7000236b2363ae2138288bf735fbf342707f Mon Sep 17 00:00:00 2001 From: zombiej Date: Fri, 30 Oct 2020 15:34:34 +0800 Subject: [PATCH 2/3] chore: Update badge --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6fac23d..fe524a7 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ React Notification UI Component [![NPM version][npm-image]][npm-url] -[![build status][travis-image]][travis-url] +[![build status][github-actions-image]][github-actions-url] [![Test coverage][coveralls-image]][coveralls-url] [![Dependencies][david-image]][david-url] [![DevDependencies][david-dev-image]][david-dev-url] @@ -13,8 +13,8 @@ React Notification UI Component [npm-image]: http://img.shields.io/npm/v/rc-notification.svg?style=flat-square [npm-url]: http://npmjs.org/package/rc-notification -[travis-image]: https://img.shields.io/travis/react-component/notification/master?style=flat-square -[travis-url]: https://travis-ci.org/react-component/notification +[github-actions-image]: https://github.com/react-component/notification/workflows/CI/badge.svg +[github-actions-url]: https://github.com/react-component/notification/actions [coveralls-image]: https://img.shields.io/coveralls/react-component/notification.svg?style=flat-square [coveralls-url]: https://coveralls.io/r/react-component/notification?branch=master [david-url]: https://david-dm.org/react-component/notification From 4e7891ed5e93d819d297387ed1370493ce643634 Mon Sep 17 00:00:00 2001 From: zombiej Date: Fri, 30 Oct 2020 15:35:12 +0800 Subject: [PATCH 3/3] chore: fix script --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 531d5c3..8d6a38c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -108,6 +108,6 @@ jobs: key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} - name: coverage - run: npm run coverage && bash <(curl -s https://codecov.io/bash) + run: npm test -- --coverage && bash <(curl -s https://codecov.io/bash) needs: setup