Skip to content

Commit

Permalink
Feat/add ci headless (#998)
Browse files Browse the repository at this point in the history
* feat: update git action

* feat: add puppeteer to ci browser test

* feat: add puppeteer to ci browser test
  • Loading branch information
taotao7 committed Oct 8, 2021
1 parent ebd73d3 commit 8307ced
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
30 changes: 30 additions & 0 deletions .github/workflows/node_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,36 @@ on:
- completed

jobs:
browser_test:
environment: ali_oss_AK
runs-on: macos-latest

env:
ALI_SDK_OSS_ID: ${{secrets.ALI_SDK_OSS_ID}}
ALI_SDK_OSS_SECRET: ${{secrets.ALI_SDK_OSS_SECRET}}
ALI_SDK_STS_BUCKET: ${{secrets.ALI_SDK_STS_BUCKET}}
ALI_SDK_STS_ID: ${{secrets.ALI_SDK_STS_ID}}
ALI_SDK_STS_REGION: ${{secrets.ALI_SDK_STS_REGION}}
ALI_SDK_STS_ROLE: ${{secrets.ALI_SDK_STS_ROLE}}
ALI_SDK_STS_SECRET: ${{secrets.ALI_SDK_STS_SECRET}}
ONCI: true


strategy:
matrix:
node-version: [14.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v2
- name: browser build and test
run: |
npm install
mkdir test/browser/build
node browser-build.js > test/browser/build/aliyun-oss-sdk.min.js
node task/browser-test-build.js > test/browser/build/tests.js
npx karma start
node_10:
environment: ali_oss_AK
runs-on: macos-latest
Expand Down
5 changes: 4 additions & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
process.env.CHROME_BIN = require('puppeteer').executablePath()
const isCiEnv = process.env.ONCI

module.exports = function (config) {
config.set({
frameworks: ['mocha', 'browserify'],
Expand All @@ -8,7 +11,7 @@ module.exports = function (config) {
require('karma-safari-launcher'),
require('karma-firefox-launcher')
],
browsers: ['Chrome', 'Safari', 'Firefox'],
browsers: isCiEnv ? ['ChromeHeadless'] : ['ChromeHeadless', 'Chrome', 'Safari', 'Firefox'],
files: ['test/browser/build/aliyun-oss-sdk.min.js', 'test/browser/build/tests.js'],
// preprocessors: {
// 'dist/aliyun-oss-sdk.js': ['coverage']
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"mocha": "^9.1.2",
"nyc": "^15.1.0",
"promise-polyfill": "^6.0.2",
"puppeteer": "^10.4.0",
"request": "^2.88.0",
"should": "^11.0.0",
"sinon": "^1.17.7",
Expand Down

0 comments on commit 8307ced

Please sign in to comment.