Skip to content

Commit

Permalink
chore: use Github Actions to run tests (#156)
Browse files Browse the repository at this point in the history
* chore: add github action for ci test
* chore: add xvfb in github runner
* coveralls
* chore: add release jobs
* chore: merge release job
* disable import/named to fix error from typescript-eslint-parser
* chore: merge actions into a job
  • Loading branch information
embbnux authored Aug 24, 2021
1 parent dd56649 commit f773a20
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"import/no-unresolved": "off", // to capture direct deps in TS
"no-dupe-class-members": "off", // to enable TS overload
"no-undef": "off", //FIXME @see https://github.com/eslint/typescript-eslint-parser/issues/75
"import/named": "off", //FIXME @see https://github.com/eslint/typescript-eslint-parser/issues/75
"no-unused-expressions": "off", // tests
"react/sort-comp": "off",
"react/prop-types": "off",
Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: CI Pipeline

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest # Firefox in it
strategy:
matrix:
node-version: [14.x]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
- run: sudo apt-get install xvfb
- run: npm install
- run: DEBUG=eslint:cli-engine npm run lint:all
- run: npm run build
- run: xvfb-run --auto-servernum -- npm test
env:
CHROME_BIN: chromium-browser
- run: cat */coverage/lcov.info
- name: Coveralls SDK
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./sdk/coverage/lcov.info
parallel: true
- name: Coveralls Subscriptions
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./subscriptions/coverage/lcov.info
parallel: true
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- run: npm run publish:release -- --canary --preid=$BRANCH.$GITHUB_RUN_ID.$GITHUB_RUN_NUMBER --dist-tag=$BRANCH --yes
if: ${{ github.event_name == 'push' && github.repository == 'ringcentral/ringcentral-js' }}
env:
BRANCH: ${{ steps.extract_branch.outputs.branch }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- run: npm run publish:release -- $TAG --yes
if: ${{ env.TAG != '' && !contains(env.TAG, '/') && !contains(env.TAG, '-') && github.repository == 'ringcentral/ringcentral-js' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Release
if: ${{ env.TAG != '' && !contains(env.TAG, '/') && !contains(env.TAG, '-') && github.repository == 'ringcentral/ringcentral-js' }}
uses: softprops/action-gh-release@v1
with:
files: |
sdk/dist/ringcentral.js
sdk/dist/ringcentral.js.map
sdk/dist/ringcentral.min.js
sdk/dist/ringcentral.min.js.map
subscriptions/dist/ringcentral-subscriptions.js
subscriptions/dist/ringcentral-subscriptions.js.map
subscriptions/dist/ringcentral-subscriptions.min.js
subscriptions/dist/ringcentral-subscriptions.min.js.map
env:
GITHUB_REPOSITORY: ringcentral/ringcentral-js
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit f773a20

Please sign in to comment.