From 2704155b3ec5abd4e12a80a79673877fb8c3dd0f Mon Sep 17 00:00:00 2001 From: yunnysunny Date: Fri, 21 Jan 2022 18:12:56 +0800 Subject: [PATCH] feat: add github action --- .github/workflows/ci.yml | 46 ++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..f85f00718 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,46 @@ +name: CI +on: + push: + +env: + SAUCE_USERNAME: shtylman-superagent + SAUCE_ACCESS_KEY: 39a45464-cb1d-4b8d-aa1f-83c7c04fa673 + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + include: + - node-version: 12.x + # test-on-brower: 1 + - node-version: 14.x + # test-http2: 1 + - node-version: 16.x + # test-http2: 1 + steps: + - uses: actions/checkout@v2 + + - name: Install Node - ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - name: Cache node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} + - name: Install Dependencies + run: yarn install + - name: Build + run: npm run build + - name: Test On Node ${{ matrix.node-version }} + env: + BROWSER: ${{ matrix.test-on-brower }} + HTTP2_TEST: ${{ matrix.test-http2 }} + run: | + npm run test + npm run coverage \ No newline at end of file diff --git a/Makefile b/Makefile index 97821bfa3..01267b1ba 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ test: @if [ "x$(BROWSER)" = "x" ]; then make test-node; else make test-browser; fi test-node: - @NODE_ENV=test ./node_modules/.bin/mocha \ + @NODE_ENV=test nyc ./node_modules/.bin/mocha \ --require should \ --trace-warnings \ --throw-deprecation \