Skip to content

Commit

Permalink
feat: support 4.4.0 (#1197)
Browse files Browse the repository at this point in the history
  • Loading branch information
guoxianzhe authored Aug 29, 2024
1 parent 9dba6b9 commit 490192f
Show file tree
Hide file tree
Showing 61 changed files with 4,373 additions and 2,798 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"root": true,
"env": {
"es6": true,
"es2020": true,
"node": true,
"shared-node-browser": true
},
Expand Down
18 changes: 6 additions & 12 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Setup
description: Setup Node.js and install dependencies
inputs:
skip_install:
required: false
default: 'false'

runs:
using: composite
Expand All @@ -10,26 +14,16 @@ runs:
node-version-file: .nvmrc

- name: Setup Yarn
run:
npm i -g [email protected]
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
with:
path: |
**/node_modules
key: ${{ runner.os }}-yarn-ng-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-ng
- name: Install dependencies
if: ${{ inputs.skip_install == 'false' }}
run: |
yarn config set agora-electron-sdk-pre-built 0
yarn install --frozen-lockfile
Expand Down
46 changes: 24 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ on:
- demo
- sdk
release:
types: [ published ]
types: [published]
pull_request:
types: [labeled, synchronize]

Expand All @@ -42,7 +42,7 @@ jobs:
if: ${{ inputs.type == 'demo' || contains(github.event.pull_request.labels.*.name, 'ci:dep-update') }}
strategy:
matrix:
arch: [ ia32, x64 ]
arch: [ia32, x64]
runs-on: windows-latest
env:
npm_config_arch: ${{ matrix.arch }}
Expand All @@ -54,19 +54,16 @@ jobs:

- name: Setup
uses: ./.github/actions/setup
with:
skip_install: true

- name: Build SDK
- name: Prepare Build Example
run: |
yarn totalBuild
yarn zipBuild
yarn link
yarn
- 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
Expand All @@ -78,39 +75,44 @@ jobs:

build-mac:
if: ${{ inputs.type == 'demo' || contains(github.event.pull_request.labels.*.name, 'ci:dep-update') }}
strategy:
matrix:
arch: [arm64, x64]
runs-on: macos-latest
env:
npm_config_arch: ${{ matrix.arch }}
npm_config_agora_electron_arch: ${{ matrix.arch }}
npm_config_agora_electron_sdk_arch: ${{ matrix.arch }}
steps:
- uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup
with:
skip_install: true

- name: Build SDK
- name: Prepare Build Example
run: |
yarn totalBuild
yarn zipBuild
yarn link
yarn
env:
USE_HARD_LINKS: false

- name: Build Example
run: |
yarn install
yarn link agora-electron-sdk
node scripts/build-example-prepare.js
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
name: AgoraRtcNgExample-mac-${{ matrix.arch }}
path: |
example/dist/Agora-Electron-API-Example-*-mac.zip
if-no-files-found: error

notification:
runs-on: ubuntu-latest
needs: [ build-windows, build-mac ]
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 }}"}}'
42 changes: 0 additions & 42 deletions .github/workflows/doc.yml

This file was deleted.

34 changes: 5 additions & 29 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,9 @@ on:
description: 'Do not touch or write anything, but show the commands'
default: true
type: boolean
publish-npm:
description: 'publish npm'
default: true
type: boolean

jobs:
release-it:
if: ${{ inputs.publish-npm }}
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
Expand Down Expand Up @@ -48,38 +43,19 @@ jobs:
git config --global user.name "${{ secrets.GIT_USERNAME }}"
yarn release ${{ inputs.increment }} --ci --no-git.tag --no-github.release --npm.allowSameVersion
update-example:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}

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

- name: Get Package Info
if: ${{ !inputs.dry-run }}
id: package-info
run: |
name=$(node -p "require('./package.json').name")
version=$(node -p "require('./package.json').version")
echo "name=${name}" >> "$GITHUB_OUTPUT"
echo "version=${version}" >> "$GITHUB_OUTPUT"
- name: Update Example
if: ${{ !inputs.dry-run }}
id: package-info
run: |
git config --global user.email "${{ secrets.GIT_EMAIL }}"
git config --global user.name "${{ secrets.GIT_USERNAME }}"
yarn example add ${{steps.package-info.outputs.name}}@${{steps.package-info.outputs.version}}
sed "s/\"agora-electron-sdk\": \"\(.*\)\"/\"agora-electron-sdk\": \"${{ inputs.increment }}\"/g" package.json > tmp
mv tmp package.json
working-directory: example

- name: Commit Example
if: ${{ !inputs.dry-run }}
run: |
git add example
git commit -m "chore(example): update example to install ${{steps.package-info.outputs.name}}@${{steps.package-info.outputs.version}}"
git commit -m "chore(example): update example to install agora-electron-sdk@${{ inputs.increment }}"
- name: Release
if: ${{ !inputs.dry-run }}
Expand Down
1 change: 1 addition & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

yarn-path "scripts/bootstrap.js"
registry "https://registry.npmjs.org/"
network-timeout 600000
1 change: 0 additions & 1 deletion example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,3 @@ dist/
node_modules/
thumbs.db
.idea/
appId.*
4 changes: 0 additions & 4 deletions example/.npmrc

This file was deleted.

4 changes: 2 additions & 2 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@
},
"devDependencies": {
"@babel/preset-react": "^7.16.7",
"@electron/rebuild": "^3.2.10",
"@electron/rebuild": "^3.6.0",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.6",
"@teamsupercell/typings-for-css-modules-loader": "^2.5.1",
"@types/download": "^8.0.2",
"@types/react": "^16.9.44",
"@types/react": "^18.1.0",
"@types/react-color": "^3.0.6",
"@types/react-dom": "^18.0.3",
"@types/react-router-dom": "^5.1.6",
Expand Down
39 changes: 39 additions & 0 deletions example/scripts/build-example-prepare.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const fs = require('fs');
const path = require('path');

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

const packageJsonPath = path.join(__dirname, '../package.json');
const electron_version = pkg.agora_electron?.electron_version;
const arch = process.env.npm_config_agora_electron_sdk_arch;

//When you set agora_electron.electron_version,
//the script will automatically download the specially compiled version of Electron by Agora when installing agora-electron-sdk.
//It will be moved to node_modules/electron/dist.
//If you want to use the Agora compiled Electron version during Electron packaging as well,
//please configure this script in your project.
//It can help you compile based on the content configured in (electronDist)[https://www.electron.build/configuration/configuration] during packaging.
if (process.platform !== 'darwin') {
return;
}
if (electron_version) {
console.log('electron_version is set in agora_electron:', electron_version);
const version = electron_version.match(/^([^-]+)/)[1];
const version_suffix = electron_version.match(/-(.+)/)[1];
console.log('version_suffix is:', version_suffix);
pkg.devDependencies.electron = version;
console.log('change example electron version to:', version);
let electron_dist_path = path.join(require.resolve('electron'), `../dist`);
pkg.build.electronDist = electron_dist_path;
console.log('change electronDist to:', pkg.build.electronDist);
}

console.log('change arch to:', arch);
pkg.build.mac.target = [
{
target: 'zip',
arch: [arch],
},
];

fs.writeFileSync(packageJsonPath, JSON.stringify(pkg, null, 2) + '\n');
21 changes: 21 additions & 0 deletions example/src/renderer/App.global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,24 @@ body {
overflow: hidden;
max-height: 100%;
}

.status-bar {
padding: 4px;
min-width: 120px;
p {
margin: 0;
}
}

.video-view-container {
position: relative;
.status-bar {
position: absolute;
left: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.6);
p {
color: #ffffff;
}
}
}
8 changes: 1 addition & 7 deletions example/src/renderer/config/agora.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
let localAppId = '';
try {
localAppId = require('./appID').default;
console.log('appID', localAppId);
} catch (error) {
console.warn(error);
}
let localAppId = window.localStorage.getItem('appId') || '';

const config = {
enableSDKLogging: true,
Expand Down
Loading

0 comments on commit 490192f

Please sign in to comment.