Skip to content

Commit

Permalink
chore: ci
Browse files Browse the repository at this point in the history
  • Loading branch information
guoxianzhe committed Oct 11, 2023
1 parent 902f2f5 commit 53287ee
Show file tree
Hide file tree
Showing 21 changed files with 261 additions and 65 deletions.
5 changes: 3 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
build/
**/dist/*
**/node_modules/*
**/coverage/*
**/node_modules/*
pnpm-lock.yaml
16 changes: 16 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Setup
description: Setup Node.js and pnpm

runs:
using: composite
steps:
- name: Install pnpm 🤏🏻
uses: pnpm/action-setup@v2.2.4
with:
version: latest

- name: Setup Node 💚
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'pnpm'
32 changes: 32 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: build
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
environment: github-pages
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Setup 🛠️
uses: ./.github/actions/setup

- name: Build 🔧
env:
AGORA_APPID: ${{ secrets.AGORA_APPID }}
run: |
pnpm install
pnpm run lint
pnpm run test
pnpm run build
MY_PATH=$(ls packages/rtc/dist | awk -F/ '{print $NF}')
echo "::set-output name=dist_path::${MY_PATH}"
- name: Upload Artifact ⬆️
uses: actions/upload-artifact@v3
with:
name: agora-rtc-react-docs.zip
path: ${{steps.dist.outputs.dist_path}}
19 changes: 19 additions & 0 deletions .github/workflows/gitleak.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: gitleaks
on:
pull_request:
push:
workflow_dispatch:

jobs:
scan:
name: gitleaks
runs-on: ubuntu-latest
if: github.actor != 'dependabot[bot]'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}
37 changes: 37 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
on: ['pull_request']

name: Build and Test PR

jobs:
build:
name: Build
runs-on: ubuntu-latest

permissions:
contents: read
pull-requests: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Setup 🛠️
uses: ./.github/actions/setup

- name: Build 🔧
run: |
pnpm install
pnpm run lint
pnpm run test
pnpm run build
- name: Report Coverage for agora-rtc-react 🟢
if: always() # Also generate the report if tests are failing
uses: ArtiomTr/jest-coverage-report-action@v2
with:
custom-title: Coverage report for iris-web-rtc
package-manager: pnpm
working-directory: './packages/rtc'
86 changes: 86 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Publish

on:
workflow_dispatch:
inputs:
package:
type: choice
description: choose package
default: 'iris-web-rtc'
required: true
options:
- iris-web-rtc
- iris-web-rtm
version:
description: x.x.x-semver.x, semver: dev,build
required: true
default: 'patch'
type: string
releases:
description: create Releases, choose false if specify version
default: true
type: boolean
cdn:
description: upload to cdn
default: true
type: boolean
release_type:
description: The release type of CDN
default: 'staging'
type: string
npm:
description: upload to npm
default: false
type: boolean

jobs:
release-it:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup
uses: ./.github/actions/setup

- name: Setup Dependencies 💚
run: |
pnpm install
- name: CDN Publish
if: ${{ inputs.cdn }}
run: |
UPLOAD_CDN_INTERNAL_JENKINS_HOOK=${{ inputs.upload_cdn_internal_jenkins_hook }}
UPLOAD_URL=${{ inputs.url }}
RELEASE_TYPE=${{ inputs.release_type }}
curl -X POST ${UPLOAD_CDN_INTERNAL_JENKINS_HOOK} \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d "{ \"release\": { \"assets\": [ { \"browser_download_url\": \"${UPLOAD_URL}\", \"release_type\": \"${RELEASE_TYPE}\" } ] }}"
shell: bash

- name: Setup NPM auth token
if: ${{ inputs.npm }}
run: |
npm set "//registry.npmjs.org/:_authToken" ${{ secrets.NPM_TOKEN }}
- name: Config Git
if: ${{ inputs.npm }}
run: |
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git config --global user.name "${{ github.actor }}"
- name: Update CHANGELOG.md
if: ${{ inputs.npm }}
run: |
pnpm release ${{ inputs.version }} --ci --no-git.tag --no-github.release --npm.allowSameVersion
- name: NPM Publish
if: ${{ inputs.npm }}
run: |
pnpm -F ${{ inputs.package }} release ${{ inputs.version }} --ci --github.release=${{ inputs.releases }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*.txt
*.pcm
coverage
**/coverage/*
*.log
sdk
tmp
Expand Down
6 changes: 6 additions & 0 deletions .gitleaks.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# ----- BEGIN Agora AppId -----
[[rules]]
id = "agora-appid"
description = "Agora AppId"
regex = '''"[0-9a-f]{32}"'''
# ----- END Agora AppId -----
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/dist/*
**/coverage/*
**/node_modules/*
pnpm-lock.yaml
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# iris-web-rtc
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@ project srouce: [project/iris](/project/iris)
## build

### Build for production

Run [build.sh](build.sh)

### Build for local dev

Run [build_local_dev.sh](build_local_dev.sh)

Then add the `http://localhost:8080/lib-iris-web.js` to your html `srcipt`, e.g.,

```html
<script src="http://localhost:8080/lib-iris-web.js" type="application/javascript"></script>
<script
src="http://localhost:8080/lib-iris-web.js"
type="application/javascript"
></script>
```


14 changes: 0 additions & 14 deletions build.sh

This file was deleted.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"private": true,
"description": "iris web",
"scripts": {
"build": "pnpm -r run build",
"test": "pnpm -r run test",
"build": "pnpm -F iris-web-rtc run build",
"test": "pnpm -F iris-web-rtc run test",
"lint": "eslint --ext .ts,.tsx . && prettier --check .",
"lint:fix": "eslint --fix --ext .ts,.tsx . && prettier --write .",
"terra": "pnpm -F terra-generate run terra",
"start": "sh ./build_local_dev.sh"
"start": "sh ./scripts/build_local_dev.sh"
},
"pnpm": {
"peerDependencyRules": {
Expand Down
2 changes: 1 addition & 1 deletion packages/rtc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iris-web-rtc",
"version": "0.1.0",
"version": "0.1.1-dev.1",
"description": "wait",
"main": "./src/index.ts",
"scripts": {
Expand Down
3 changes: 0 additions & 3 deletions packages/rtc/src/engine/IrisRtcEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import { IrisElement } from '../helper/DomHelper';
import { ImplHelper } from '../helper/ImplHelper';
import { TrackHelper } from '../helper/TrackHelper';
import { IrisGlobalState } from '../state/IrisGlobalState';
import { AgoraActionQueue } from '../util/AgoraActionQueue';
import { AgoraConsole } from '../util/AgoraConsole';
import IrisRtcErrorHandler from '../util/ErrorHandler';

Expand Down Expand Up @@ -74,7 +73,6 @@ export class IrisRtcEngine implements ApiInterceptor {

public globalState: IrisGlobalState = null;
public agoraEventHandler: IrisAgoraEventHandler = null;
public actionQueue: AgoraActionQueue = null;
public executor: CallApiExecutor = null;
public irisEventHandlerManager: IrisEventHandlerManager = null;
public irisElement: IrisElement = null;
Expand Down Expand Up @@ -111,7 +109,6 @@ export class IrisRtcEngine implements ApiInterceptor {
this.implDispatchesMap.set(key, value)
);

this.actionQueue = new AgoraActionQueue();
this.rtcEngineEventHandler = new IRtcEngineEventHandlerEx(this);
this.globalState = new IrisGlobalState();
this.irisElement = new IrisElement();
Expand Down
35 changes: 0 additions & 35 deletions packages/rtc/src/util/AgoraActionQueue.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/rtc/src/util/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './AgoraActionQueue';
export * from './AgoraConsole';
export * from './AgoraTool';
export * from './AgoraTranslate';
4 changes: 3 additions & 1 deletion packages/rtc/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');

const pkg = require('./package.json');

const environment = process.env.NODE_ENV;

config = {
Expand All @@ -11,7 +13,7 @@ config = {
output: {
path: path.resolve(__dirname, 'dist'),
libraryTarget: 'this',
filename: 'iris-web-rtc.js',
filename: `iris-web-rtc_${pkg.version}.js`,
environment: {
arrowFunction: false,
},
Expand Down
File renamed without changes.
Loading

0 comments on commit 53287ee

Please sign in to comment.