Make HttpRequestOptions accept 'headers' parameter when Axios request. #156
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: Singleton g11n-js-client CI | |
on: | |
push: | |
branches: [ g11n-js-client ] | |
pull_request: | |
branches: [ g11n-js-client ] | |
jobs: | |
pre-process: | |
name: Pre process | |
runs-on: ubuntu-latest | |
outputs: | |
were-only-docs-updated: ${{ steps.were-only-docs-updated-action.outputs.were-only-docs-updated }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 2. | |
- name: Get commit range | |
id: get-commit-range-action | |
uses: ./.github/actions/get-commit-range-action | |
- name: Were only docs updated | |
id: were-only-docs-updated-action | |
uses: ./.github/actions/were-only-docs-updated-action | |
with: | |
commit-range: ${{ steps.get-commit-range-action.outputs.commit-range }} | |
check-header: | |
name: Check Header | |
runs-on: ubuntu-latest | |
needs: pre-process | |
if: needs.pre-process.outputs.were-only-docs-updated != 'yes' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 2. | |
- name: Get commit range | |
id: get-commit-range-action | |
uses: ./.github/actions/get-commit-range-action | |
- name: Check header | |
run: | | |
git clone --branch=devops https://github.com/vmware/singleton.git devops | |
cp $GITHUB_WORKSPACE/devops/check_headers.py . | |
chmod +x check_headers.py | |
git diff ${{ steps.get-commit-range-action.outputs.commit-range }} --stat | |
git diff --name-only --diff-filter=d ${{ steps.get-commit-range-action.outputs.commit-range }} | |
python ./check_headers.py -f "$(git diff --name-only --diff-filter=d ${{ steps.get-commit-range-action.outputs.commit-range }})" | |
unit-test: | |
name: Unit Test | |
runs-on: ubuntu-latest | |
needs: pre-process | |
if: needs.pre-process.outputs.were-only-docs-updated != 'yes' | |
strategy: | |
matrix: | |
node-version: [14.x] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: Unit test | |
run: | | |
npm install --registry https://registry.npmjs.org | |
npm run test | |
- name: Upload Codecov report for g11n-js-client | |
uses: codecov/codecov-action@v2 | |
with: | |
files: ./coverage/lcov.info | |
flags: g11n-js-client | |
security-analysis: | |
name: Security Analysis | |
runs-on: ubuntu-latest | |
needs: pre-process | |
if: needs.pre-process.outputs.were-only-docs-updated != 'yes' | |
permissions: | |
actions: read | |
contents: read | |
security-events: write | |
strategy: | |
matrix: | |
node-version: [14.x] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Create cache folder | |
run: | | |
mkdir -p /home/runner/.npm | |
continue-on-error: true | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v2 | |
with: | |
languages: javascript | |
- name: Autobuild | |
uses: github/codeql-action/autobuild@v2 | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v2 | |
codacy-analysis-cli: | |
name: Codacy Analysis CLI | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@main | |
- name: Run Codacy Analysis CLI | |
uses: codacy/codacy-analysis-cli-action@master | |
with: | |
output: results.sarif | |
format: sarif | |
# Adjust severity of non-security issues | |
gh-code-scanning-compat: true | |
# Force 0 exit code to allow SARIF file generation | |
# This will handover control about PR rejection to the GitHub side | |
max-allowed-issues: 2147483647 | |
# Upload the SARIF file generated in the previous step | |
- name: Upload SARIF results file | |
uses: github/codeql-action/upload-sarif@main | |
with: | |
sarif_file: results.sarif | |
smoke-test: | |
name: Smoke Test | |
runs-on: ubuntu-latest | |
needs: pre-process | |
if: needs.pre-process.outputs.were-only-docs-updated != 'yes' | |
strategy: | |
matrix: | |
node-version: [14.x] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: Smoke Test | |
run: | | |
TZ='Asia/Shanghai'; export TZ | |
mkdir -p g11n-js-client | |
shopt -s extglob | |
mv !(g11n-js-client) g11n-js-client/ | |
mv .npmignore g11n-js-client/ | |
git clone --branch=master https://github.com/vmware/singleton.git service | |
git clone --branch=devops https://github.com/vmware/singleton.git devops | |
mkdir -p service/g11n-ws/vip-manager-i18n/src/main/resources/l10n/bundles/ | |
cp -a devops/autotest/client/jscoresdk/resources/bundles/JSCoreSDKTest service/g11n-ws/vip-manager-i18n/src/main/resources/l10n/bundles/ | |
cd $GITHUB_WORKSPACE/service/g11n-ws && ./gradlew build -x test | |
cp $GITHUB_WORKSPACE/devops/deploy/i18n-service/Dockerfile $GITHUB_WORKSPACE/service/publish/ | |
cd $GITHUB_WORKSPACE/service/publish && mv singleton-[0-9\.]*.jar i18n-service.jar | |
docker build -t singleton . | |
docker run -d -p 8090:8090 -p 8091:8091 --name singleton singleton | |
docker ps | |
cd $GITHUB_WORKSPACE | |
cd g11n-js-client | |
sed -i 's:@singleton-i18n/js-core-sdk-server:@vip/vip-core-sdk-dev:' package.json | |
npm install --registry https://registry.npmjs.org | |
npm link | |
cd $GITHUB_WORKSPACE/devops/autotest/client/jscoresdk | |
npm install --registry https://registry.npmjs.org | |
npm link @vip/vip-core-sdk-dev | |
str=$(printf '=%.0s' {1..50}) | |
echo $str Smoke Test Start $str | |
./node_modules/.bin/jest | |
echo $str Smoke Test End $str |