From 54d82f55d508a89e4ba943643ebdd55ef8de5e84 Mon Sep 17 00:00:00 2001 From: Kermit Date: Mon, 16 Nov 2020 12:05:50 +0800 Subject: [PATCH 1/2] Create react-component-ci.yml --- .github/workflows/react-component-ci.yml | 114 +++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 .github/workflows/react-component-ci.yml diff --git a/.github/workflows/react-component-ci.yml b/.github/workflows/react-component-ci.yml new file mode 100644 index 0000000..432a3fb --- /dev/null +++ b/.github/workflows/react-component-ci.yml @@ -0,0 +1,114 @@ +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@v2 + 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@v2 + 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@v2 + with: + path: package-temp-dir + key: lock-${{ github.sha }} + + - name: restore cache from node_modules + uses: actions/cache@v2 + 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@v2 + with: + path: package-temp-dir + key: lock-${{ github.sha }} + + - name: restore cache from node_modules + uses: actions/cache@v2 + 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@v2 + with: + path: package-temp-dir + key: lock-${{ github.sha }} + + - name: restore cache from node_modules + uses: actions/cache@v2 + with: + path: node_modules + key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} + + - name: coverage + run: npm test -- --coverage && bash <(curl -s https://codecov.io/bash) + + needs: setup From a0f5d082d9ba66811cb5af235faf6cccdc86b17c Mon Sep 17 00:00:00 2001 From: Kermit Date: Mon, 16 Nov 2020 12:09:46 +0800 Subject: [PATCH 2/2] chore: update badge --- .travis.yml | 26 -------------------------- README.md | 6 +++--- 2 files changed, 3 insertions(+), 29 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2fbc8bf..0000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -language: node_js - -sudo: false - -notifications: - email: - - yiminghe@gmail.com - -node_js: -- 12 - -script: -- | - if [ "$TEST_TYPE" = test ]; then - npm 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=coverage - - TEST_TYPE=compile diff --git a/README.md b/README.md index 839d015..554e44a 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ rc-collapse ui component for react [![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] [![npm download][download-image]][download-url] [![Dependencies](https://img.shields.io/david/react-component/collapse.svg?style=flat-square)](https://david-dm.org/react-component/collapse) @@ -12,8 +12,8 @@ rc-collapse ui component for react [npm-image]: http://img.shields.io/npm/v/rc-collapse.svg?style=flat-square [npm-url]: http://npmjs.org/package/rc-collapse -[travis-image]: https://img.shields.io/travis/react-component/collapse.svg?style=flat-square -[travis-url]: https://travis-ci.org/react-component/collapse +[github-actions-image]: https://github.com/react-component/collapse/workflows/CI/badge.svg +[github-actions-url]: https://github.com/react-component/collapse/actions [coveralls-image]: https://img.shields.io/coveralls/react-component/collapse.svg?style=flat-square [coveralls-url]: https://coveralls.io/r/react-component/collapse?branch=master [download-image]: https://img.shields.io/npm/dm/rc-collapse.svg?style=flat-square