Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
LichKing-2234 committed Nov 24, 2023
1 parent e533050 commit 20b2e1e
Show file tree
Hide file tree
Showing 13 changed files with 149 additions and 46 deletions.
24 changes: 15 additions & 9 deletions .github/actions/doc/action.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
name: Doc
description: Generate comments
description: Generate comments.

inputs:
target-path:
description: The path to generate comments, if set, will skip clone & pr
default: ""
github-token:
description: The github token
description: >
GITHUB_TOKEN (permissions contents: write and pull-requests: write) or a repo scoped Personal Access Token (PAT).
required: true

target-repo:
description: Relative path under GITHUB_WORKSPACE to the repository.

target-branch:
description: Sets the pull request base branch.

runs:
using: composite
steps:
- name: Generate comments
uses: AgoraIO-Extensions/actions/.github/actions/doc@main
with:
target-repo: ${{ github.repository }}
target-branch: ${{ github.ref_name }}
target-path: ${{ inputs.target-path }}
github-token: ${{ inputs.github-token }}
target-repo: ${{ inputs.target-repo }}
target-branch: ${{ inputs.target-branch }}
config: fmt_config/fmt_ts.yaml
language: ts
base-template-url: https://github.com/AgoraIO/agora_doc_source/releases/download/master-build/electron_ng_json_template_en.json
export-file-path: ts/AgoraSdk.ts
github-token: ${{ inputs.github-token }}
pre-pr-command: |
rm -rf iris-doc
yarn lint --fix
10 changes: 10 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ runs:
with:
node-version-file: .nvmrc

- name: Setup Yarn
run:
npm i -g [email protected]
shell: bash

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11.5

- name: Cache dependencies
id: yarn-cache
uses: actions/cache@v3
Expand Down
90 changes: 86 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Build API Example / Addon

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
workflow_call:
inputs:
Expand All @@ -20,15 +24,93 @@ on:
- sdk
release:
types: [ published ]
pull_request:
types: [labeled, synchronize]

jobs:
build:
build-jenkins:
if: ${{ inputs.type == 'sdk' || (github.event_name == 'release' && github.event.action == 'published') }}
runs-on: ubuntu-latest
steps:
- name: Build
run: |
type=${{inputs.type}}
type=${type:-"sdk"}
curl -X POST -sS -D- -o/dev/null ${{secrets.JENKINS_BUILD_URL}} \
-H 'Content-Type: application/json' \
-d "{\"branch\": \"${{github.ref_name}}\", \"type\": \"${type}\"}"
-d "{\"branch\": \"${{github.ref_name}}\", \"type\": \"sdk\"}"
build-windows:
if: ${{ inputs.type == 'demo' || contains(github.event.pull_request.labels.*.name, 'ci:dep-update') }}
strategy:
matrix:
arch: [ ia32, x64 ]
runs-on: windows-latest
env:
npm_config_arch: ${{ matrix.arch }}
npm_config_agora_electron_arch: ${{ matrix.arch }}
npm_config_agora_electron_sdk_arch: ${{ matrix.arch }}
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Build SDK
run: |
yarn totalBuild
yarn zipBuild
yarn link
- name: Build Example
run: |
yarn install
yarn link agora-electron-sdk
yarn dist:win --${{ matrix.arch }}
yarn unlink agora-electron-sdk
working-directory: example

- uses: actions/upload-artifact@v3
with:
name: AgoraRtcNgExample-win-${{ matrix.arch }}
path: |
example/dist/Agora-Electron-API-Example-*-win.zip
if-no-files-found: error

build-mac:
if: ${{ inputs.type == 'demo' || contains(github.event.pull_request.labels.*.name, 'ci:dep-update') }}
runs-on: macos-latest
steps:
- uses: actions/checkout@v4

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

- name: Build SDK
run: |
yarn totalBuild
yarn zipBuild
yarn link
- name: Build Example
run: |
yarn install
yarn link agora-electron-sdk
yarn dist:mac
yarn unlink agora-electron-sdk
env:
USE_HARD_LINKS: false
working-directory: example

- uses: actions/upload-artifact@v3
with:
name: AgoraRtcNgExample-mac
path: |
example/dist/Agora-Electron-API-Example-*-mac.zip
if-no-files-found: error

notification:
runs-on: ubuntu-latest
needs: [ build-windows, build-mac ]
steps:
- run: |
curl -X POST "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=${{ secrets.WECHAT_KEY }}" -d '{"msgtype":"text","text":{"content":"Electron Example:\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\nDownload Link:\nhttps://nightly.link/${{ github.repository }}/actions/runs/${{ github.run_id }}"}}'
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup
Expand All @@ -35,7 +35,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup
Expand All @@ -47,7 +47,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup
Expand All @@ -65,7 +65,7 @@ jobs:
runs-on: ${{ matrix.runner }}-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

uses: actions/checkout@v4

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

- name: Generate comments
uses: ./.github/actions/doc
with:
github-token: ${{ secrets.GH_TOKEN }}
target-branch: ${{ github.ref_name }}
2 changes: 1 addition & 1 deletion .github/workflows/gitleaks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: gitleaks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: gitleaks/gitleaks-action@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}
Expand Down
21 changes: 12 additions & 9 deletions .github/workflows/terra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

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

- name: Generate codes
id: terra
uses: AgoraIO-Extensions/actions/.github/actions/terra@main
env:
LLVM_DOWNLOAD_URL: |
https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz
with:
github-token: ${{ secrets.GH_TOKEN }}
terra-ref: ${{ inputs.terra-ref }}
target-path: ${{ github.workspace }}
config: ci/config/terra_config.yaml
output-dir: ts/Private
export-file-path: ts/AgoraSdk.ts
github-token: ${{ secrets.GH_TOKEN }}

- name: Format codes
run: |
Expand All @@ -38,22 +38,25 @@ jobs:
- name: Generate ts interface
run: |
yarn ts_interface_builder
yarn build:ts-interface
- name: Generate comments
uses: ./.github/actions/doc
with:
target-path: ${{ github.workspace }}
github-token: ${{ secrets.GH_TOKEN }}
target-path: ${{ github.workspace }}

- name: Create pull request
uses: AgoraIO-Extensions/actions/.github/actions/pr@main
with:
github-token: ${{ secrets.GH_TOKEN }}
target-repo: ${{ github.workspace }}
target-branch: ${{ github.ref_name }}
target-branch-name-surffix: |
terra-update
target-branch-name-surffix: terra-update
pull-request-title: |
[AUTO] Generate code by terra
[AUTO] Generate codes by terra
pull-request-body: |
Terra configuration:
${{ steps.terra.outputs.configuration }}
add-paths: ts
github-token: ${{ secrets.GH_TOKEN }}
6 changes: 3 additions & 3 deletions ci/electron-sdk-build-mac-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ npm config set ELECTRON_MIRROR http://npm.taobao.org/mirrors/electron/
rm -rf node_modules
rm -rf sdk
rm -rf tmp
# npm install --verbose
# npm install
#
# Example 2
npm config set agora_electron_sdk_pre_built false
npm install --verbose
npm run totalBuild --verbose
npm install
npm run totalBuild
npm run zipBuild
npm config delete agora_electron_sdk_pre_built
#
Expand Down
8 changes: 4 additions & 4 deletions ci/electron-sdk-build-windows-release.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ call npm config list
call npm config set agora_electron_sdk_pre_built false
if %1 == ia32 (
echo sdk_ia32
call npm install --verbose --agora_electron_sdk_arch=ia32
call npm run totalBuild --verbose --agora_electron_sdk_arch=ia32
call npm install --agora_electron_sdk_arch=ia32
call npm run totalBuild --agora_electron_sdk_arch=ia32
)
if %1 == x64 (
echo sdk_x64
call npm install --verbose --agora_electron_sdk_arch=x64
call npm run totalBuild --verbose --agora_electron_sdk_arch=x64
call npm install --agora_electron_sdk_arch=x64
call npm run totalBuild --agora_electron_sdk_arch=x64
)
call npm config delete agora_electron_sdk_pre_built

Expand Down
4 changes: 1 addition & 3 deletions ci/packager-mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ packExample() {
export USE_HARD_LINKS=false
yarn dist:mac

pushd dist/mac
zip -ry $(pwd)/../../../${outterZipName} Agora-Electron-API-Example.app
popd
cp -f dist/Agora-Electron-API-Example-*.zip ../${outterZipName}
popd
}

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
"install": "cross-env-shell gulp NPM_Install \\\"--INIT_CWD=$INIT_CWD\\\"",
"release": "release-it",
"example": "yarn --cwd example",
"bootstrap": "yarn config set agora-electron-sdk-pre-built 0 && yarn example && yarn install && yarn patch-package && yarn ts_interface_builder && yarn totalBuild && yarn link && yarn example link agora-electron-sdk && yarn config delete agora-electron-sdk-pre-built",
"ts_interface_builder": "ts-interface-builder ts/Private/*.ts -o ts/Private/ti/"
"bootstrap": "yarn config set agora-electron-sdk-pre-built 0 && yarn example && yarn install && yarn patch-package && yarn build:ts-interface && yarn totalBuild && yarn link && yarn example link agora-electron-sdk && yarn config delete agora-electron-sdk-pre-built",
"build:ts-interface": "ts-interface-builder ts/Private/*.ts -o ts/Private/ti/"
},
"keywords": [
"electron",
Expand Down
8 changes: 4 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"forceConsistentCasingInFileNames": true,
"jsx": "react",
"lib": [
"esnext",
"dom"
"ESNext",
"DOM"
],
"module": "commonjs",
"moduleResolution": "node",
"module": "CommonJS",
"moduleResolution": "Node",
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noImplicitUseStrict": false,
Expand Down

0 comments on commit 20b2e1e

Please sign in to comment.