Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加 codecov #1001

Merged
merged 1 commit into from
Oct 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/codeCov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CodeCov

on:
push:
branches: [master]
workflow_run:
workflows: ['Receive PR']
types:
- completed

jobs:
CodeCov:
environment: ali_oss_AK
runs-on: ubuntu-latest
env:
ONCI: true
ALI_SDK_OSS_ID: ${{secrets.ALI_SDK_OSS_ID}}
ALI_SDK_OSS_SECRET: ${{secrets.ALI_SDK_OSS_SECRET}}
ALI_SDK_OSS_REGION: ${{secrets.ALI_SDK_OSS_REGION}}
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}}
steps:
- uses: actions/checkout@v2
- name: test and report upload
run: |
npm install
npm run tsc
npx nyc --reporter=lcov node_modules/.bin/_mocha -t 60000 -r should test/node/*.test.js test/node/**/*.test.js
npx codecov -t ${{secrets.CODECOV_KEY}}
11 changes: 9 additions & 2 deletions .github/workflows/node_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ jobs:
runs-on: macos-latest

env:
ONCI: true
ALI_SDK_OSS_ID: ${{secrets.ALI_SDK_OSS_ID}}
ALI_SDK_OSS_REGION: ${{secrets.ALI_SDK_OSS_REGION}}
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:
Expand All @@ -37,6 +38,7 @@ jobs:
- uses: actions/checkout@v2
- name: browser build and test
run: |
curl cip.cc
npm install
mkdir test/browser/build
node browser-build.js > test/browser/build/aliyun-oss-sdk.min.js
Expand All @@ -50,11 +52,13 @@ jobs:
env:
ALI_SDK_OSS_ID: ${{secrets.ALI_SDK_OSS_ID}}
ALI_SDK_OSS_SECRET: ${{secrets.ALI_SDK_OSS_SECRET}}
ALI_SDK_OSS_REGION: ${{secrets.ALI_SDK_OSS_REGION}}
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:
Expand All @@ -77,12 +81,14 @@ jobs:

env:
ALI_SDK_OSS_ID: ${{secrets.ALI_SDK_OSS_ID}}
ALI_SDK_OSS_REGION: ${{secrets.ALI_SDK_OSS_REGION}}
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:
Expand All @@ -105,13 +111,14 @@ jobs:

env:
ALI_SDK_OSS_ID: ${{secrets.ALI_SDK_OSS_ID}}
ALI_SDK_OSS_REGION: ${{secrets.ALI_SDK_OSS_REGION}}
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:
Expand Down
10 changes: 5 additions & 5 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
process.env.CHROME_BIN = require('puppeteer').executablePath()
const isCiEnv = process.env.ONCI
process.env.CHROME_BIN = require('puppeteer').executablePath();
const isCiEnv = process.env.ONCI;

module.exports = function (config) {
config.set({
Expand All @@ -8,10 +8,10 @@ module.exports = function (config) {
require('karma-mocha'),
require('karma-browserify'),
require('karma-chrome-launcher'),
require('karma-safari-launcher'),
require('karma-firefox-launcher')
require('karma-firefox-launcher'),
require('karma-safari-launcher')
],
browsers: isCiEnv ? ['ChromeHeadless'] : ['ChromeHeadless', 'Chrome', 'Safari', 'Firefox'],
browsers: isCiEnv ? ['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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"scripts": {
"build-change-log": "standard-version",
"test": "npm run tsc && mocha -t 60000 -r should -r dotenv/config test/node/*.test.js test/node/**/*.test.js",
"test-cov": "npm run tsc && nyc --reporter=lcov node_modules/.bin/_mocha -t 60000 -r thunk-mocha -r should test/node/*.test.js test/node/**/*.test.js",
"test-cov": "npm run tsc && nyc --reporter=lcov node_modules/.bin/_mocha -t 60000 -r should test/node/*.test.js test/node/**/*.test.js",
"jshint": "jshint .",
"autod": "autod",
"build-test": "MINIFY=1 node browser-build.js > test/browser/build/aliyun-oss-sdk.min.js && node -r dotenv/config task/browser-test-build.js > test/browser/build/tests.js",
Expand Down
8 changes: 4 additions & 4 deletions test/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ const config = module.exports;
config.oss = {
accessKeyId: env.ALI_SDK_OSS_ID,
accessKeySecret: env.ALI_SDK_OSS_SECRET,
endpoint: env.ALI_SDK_OSS_ENDPOINT,
region: env.ALI_SDK_OSS_REGION || 'oss-cn-hangzhou'
region: env.ALI_SDK_OSS_REGION || 'oss-cn-hangzhou',
endpoint: env.ONCI ? 'https://oss-us-west-1.aliyuncs.com' : null
};

config.sts = {
accessKeyId: env.ALI_SDK_STS_ID,
accessKeySecret: env.ALI_SDK_STS_SECRET,
roleArn: env.ALI_SDK_STS_ROLE,
bucket: env.ALI_SDK_STS_BUCKET,
endpoint: env.TRAVIS ? 'https://sts.us-west-1.aliyuncs.com/' : null
endpoint: env.ONCI ? 'https://sts.aliyuncs.com/' : null
};

config.metaSyncTime = env.TRAVIS ? '30s' : '1000ms';
config.metaSyncTime = env.ONCI ? '30s' : '1000ms';
13 changes: 3 additions & 10 deletions test/node/sts.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ describe('test/sts.test.js', () => {
const policy = {
Statement: [
{
Action: [
'oss:*'
],
Action: ['oss:*'],
Effect: 'Allow',
Resource: ['acs:oss:*:*:*']
}
Expand Down Expand Up @@ -106,9 +104,7 @@ describe('test/sts.test.js', () => {
let policy = {
Statement: [
{
Action: [
'oss:PutObject'
],
Action: ['oss:PutObject'],
Effect: 'Allow',
Resource: ['acs:oss:*:*:*']
}
Expand Down Expand Up @@ -145,9 +141,7 @@ describe('test/sts.test.js', () => {
policy = {
Statement: [
{
Action: [
'oss:DeleteObject'
],
Action: ['oss:DeleteObject'],
Effect: 'Allow',
Resource: ['acs:oss:*:*:*']
}
Expand Down Expand Up @@ -205,5 +199,4 @@ describe('test/sts.test.js', () => {
}
});
});

});