Skip to content

Commit

Permalink
chore: adapt to new terra
Browse files Browse the repository at this point in the history
  • Loading branch information
guoxianzhe committed Dec 8, 2023
1 parent 246f5b0 commit df2b45a
Show file tree
Hide file tree
Showing 17 changed files with 4,826 additions and 82 deletions.
31 changes: 0 additions & 31 deletions .github/actions/doc/action.yml

This file was deleted.

25 changes: 23 additions & 2 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,33 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

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

- name: Generate comments
uses: ./.github/actions/doc
- name: Generate comment by terra
uses: AgoraIO-Extensions/actions/.github/actions/generate@main
with:
github-token: ${{ secrets.GH_TOKEN }}
generate-code: false
generate-comment: true
generate-comment-command: |
sh generate-comment.sh
- 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: doc-update
pull-request-title: |
[AUTO] Generate comments by iris-doc
pull-request-body: |
Doc source:
https://github.com/AgoraIO/agora_doc_source/releases/download/master-build/electron_ng_json_template_en.json
add-paths: ts
45 changes: 11 additions & 34 deletions .github/workflows/terra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,30 @@ name: Generate codes

on:
workflow_dispatch:
inputs:
terra-ref:
description: The terra repo ref
required: true
default: "main"

jobs:
generate-codes:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- 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
- name: Generate code and comment by terra
uses: AgoraIO-Extensions/actions/.github/actions/generate@main
with:
github-token: ${{ secrets.GH_TOKEN }}
terra-ref: ${{ inputs.terra-ref }}
config: ci/config/terra_config.yaml
output-dir: ts/Private
export-file-path: ts/AgoraSdk.ts

- name: Format codes
run: |
rm -rf terra
yarn lint --fix
- name: Generate ts interface
run: |
yarn build:ts-interface
- name: Generate comments
uses: ./.github/actions/doc
with:
github-token: ${{ secrets.GH_TOKEN }}
target-path: ${{ github.workspace }}
generate-code: true
generate-comment: true
generate-code-command: |
sh generate-code.sh
generate-comment-command: |
sh generate-comment.sh
- name: Create pull request
uses: AgoraIO-Extensions/actions/.github/actions/pr@main
Expand All @@ -55,8 +36,4 @@ jobs:
target-branch-name-surffix: terra-update
pull-request-title: |
[AUTO] Generate codes by terra
pull-request-body: |
Terra configuration:
${{ steps.terra.outputs.configuration }}
add-paths: ts
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
### VisualStudioCode template
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.vscode
*.code-workspace

# Local History for Visual Studio Code
Expand Down
8 changes: 8 additions & 0 deletions .gitleaks.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
[allowlist]
description = "file allow lists"
paths = [
'''gitleaks.toml''',
'''plugin-(.*?)-tool.cjs''',
'''yarn-(.*?)(.cjs)''',
]

# ----- BEGIN Agora AppId -----
[[rules]]
id = "agora-appid"
Expand Down
10 changes: 0 additions & 10 deletions ci/config/terra_config.yaml

This file was deleted.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"ts",
"types",
"scripts",
"!scripts/terra",
"gulpfile.js",
"CHANGELOG.md",
"!**/__tests__"
Expand Down
10 changes: 10 additions & 0 deletions scripts/terra/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.terra
node_modules

# Yarn
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
1 change: 1 addition & 0 deletions scripts/terra/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18
893 changes: 893 additions & 0 deletions scripts/terra/.yarn/releases/yarn-4.0.1.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions scripts/terra/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.0.1.cjs
26 changes: 26 additions & 0 deletions scripts/terra/code_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
parsers:
- name: LegacyCXXParser
package: '@agoraio-extensions/terra-legacy-cxx-parser'
args:
includeHeaderDirs:
- '@agoraio-extensions/terra_shared_configs:headers/rtc_4.2.6/include'
parseFiles:
include:
- '@agoraio-extensions/terra_shared_configs:headers/rtc_4.2.6/include/*.h'
exclude:
- '@agoraio-extensions/terra_shared_configs:headers/rtc_4.2.6/include/AgoraRefPtr.h'
- '@agoraio-extensions/terra_shared_configs:headers/rtc_4.2.6/include/time_utils.h'
- '@agoraio-extensions/terra_shared_configs:headers/rtc_4.2.6/include/AgoraOptional.h'
- '@agoraio-extensions/terra_shared_configs:headers/rtc_4.2.6/include/AgoraRefPtr.h'
- '@agoraio-extensions/terra_shared_configs:headers/rtc_4.2.6/include/IAgoraH265Transcoder.h'
- '@agoraio-extensions/terra_shared_configs:headers/rtc_4.2.6/include/IAgoraMediaComponentFactory.h'
- '@agoraio-extensions/terra_shared_configs:headers/rtc_4.2.6/include/IAgoraParameter.h'
customHeaders:
- '@agoraio-extensions/terra_shared_configs:headers/rtc_4.2.6/custom_headers/*.h'
language: ts
definesMacros:
- __ELECTRON__
legacyRenders:
- TsInterfaceRender
- TsImplRender

8 changes: 8 additions & 0 deletions scripts/terra/comment_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
renderers:
- name: IrisDocRenderer
package: '@agoraio-extensions/terra_shared_configs'
args:
language: ts
fmtConfig: fmt_ts.yaml
exportFilePath: ../../ts/AgoraSdk.ts
templateUrl: https://github.com/AgoraIO/agora_doc_source/releases/download/master-build/electron_ng_json_template_en.json
16 changes: 16 additions & 0 deletions scripts/terra/generate-code.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -e
set -x

MY_PATH=$(realpath $(dirname "$0"))
PROJECT_ROOT=$(realpath ${MY_PATH}/../..)

npm exec terra -- run \
--config ${PROJECT_ROOT}/scripts/terra/code_config.yaml \
--output-dir=${PROJECT_ROOT}/ts/Private

cd ${PROJECT_ROOT}

npm run build:ts-interface

npm run lint -- --fix
14 changes: 14 additions & 0 deletions scripts/terra/generate-comment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -e
set -x

MY_PATH=$(realpath $(dirname "$0"))
PROJECT_ROOT=$(realpath ${MY_PATH}/../..)

npm exec terra -- run \
--config ${PROJECT_ROOT}/scripts/terra/comment_config.yaml \
--output-dir=${PROJECT_ROOT}/ts/Private

cd ${PROJECT_ROOT}

npm run lint -- --fix
23 changes: 23 additions & 0 deletions scripts/terra/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "terra",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "MIT",
"devDependencies": {
"@types/node": "^20.6.0"
},
"dependencies": {
"@agoraio-extensions/terra": "[email protected]:AgoraIO-Extensions/terra.git#commit=5dd8149d5ab9f3b472b7715916b6217f9745f066&workspace=terra",
"@agoraio-extensions/terra-core": "[email protected]:AgoraIO-Extensions/terra.git#commit=5dd8149d5ab9f3b472b7715916b6217f9745f066&workspace=terra-core",
"@agoraio-extensions/terra-legacy-cxx-parser": "[email protected]:AgoraIO-Extensions/terra-legacy-cxx-parser.git#commit=5455afd2c5e29013d9a3cb8d06150c162450a5ed",
"@agoraio-extensions/terra_shared_configs": "[email protected]:AgoraIO-Extensions/terra_shared_configs.git#commit=ea5b0574dace3a434ad87dbeac2d43a5b62ef636",
"ts-node": "^10.9.1",
"typescript": "^5.1.6"
},
"packageManager": "[email protected]"
}
Loading

0 comments on commit df2b45a

Please sign in to comment.