Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Setup
description: Setup Environment

runs:
using: composite
steps:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.16.0

- name: Setup Yarn
run: npm i -g yarn@1.22.19
shell: bash

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

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.203
59 changes: 59 additions & 0 deletions .github/workflows/terra.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Generate codes and create pull request

on:
workflow_dispatch:
inputs:
rtc_version:
description: 'verison (rtc_4.3.2, rtm_2.2.4 like)'
required: true
type: string

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/setup

- name: Replace rtc version
run: sh terra/replace_rtc_version.sh ${{ inputs.rtc_version }}

- name: Generate code and comment by terra
uses: AgoraIO-Extensions/actions/.github/actions/generate@main
with:
working-directory: "terra"
github-token: ${{ secrets.GH_TOKEN }}
generate-code: true
generate-comment: false
generate-code-command: |
sh prepare.sh
sh rtc.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: terra-update/${{ inputs.rtc_version }}
pull-request-title: |
[AUTO] Generate codes by terra(${{ inputs.rtc_version }})
add-paths: .

- name: Check csharp codes compile
run: |
cd Agora-C_Sharp_RTC-SDK_UT
dotnet restore Agora_C_Sharp_SDK_UT.sln
dotnet build Agora_C_Sharp_SDK_UT.sln --configuration Release
if [ $? -ne 0 ]; then
echo "csharp codes compile error"
exit 1
else
echo "csharp codes compile success"
fi
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ Agora-C_Sharp-RTC-SDK/Code/**/*.meta
Agora-C_Sharp-RTC-SDK/Resources/**/*.meta
.DS_Store
.publish
.yarn
.terra
node_modules
CSharp-API_Example/binx86
Expand Down
893 changes: 893 additions & 0 deletions terra/.yarn/releases/yarn-4.0.2.cjs

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion terra/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
nodeLinker: node-modules
httpsProxy: 'http://127.0.0.1:7890'
yarnPath: .yarn/releases/yarn-4.0.2.cjs
7 changes: 3 additions & 4 deletions terra/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ set -x
MY_PATH=$(realpath $(dirname "$0"))
PROJECT_ROOT=$(realpath ${MY_PATH}/..)

pushd ${MY_PATH}
cd ${MY_PATH}

rm -rf .terra
rm -rf node_modules
rm -rf package-lock.json
rm -rf yarn.lock
yarn

popd
export YARN_ENABLE_IMMUTABLE_INSTALLS=false
yarn install
49 changes: 49 additions & 0 deletions terra/replace_rtc_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/sh

# Check if parameter is provided
if [ $# -eq 0 ]; then
echo "Error: Please provide version number parameter"
echo "Usage: $0 rtc_x.x.x or $0 rtc_x.x.x.x"
exit 1
fi

# Get version number parameter
new_version=$1

# Check version number format using grep
if ! echo "$new_version" | grep -qE '^rtc_[0-9]+(\.[0-9]+)+$'; then
echo "Error: Invalid version number format"
echo "Correct format should be: rtc_x.x.x or rtc_x.x.x.x"
exit 1
fi

# Get script directory and yaml file path
script_dir="$(cd "$(dirname "$0")" && pwd)"
yaml_file="$script_dir/rtc.yaml"

# Check if yaml file exists
if [ ! -f "$yaml_file" ]; then
echo "Error: rtc.yaml file not found at $yaml_file"
exit 1
fi

echo "Found rtc.yaml at: $yaml_file"
echo "Current content of rtc.yaml:"

# Extract version number without 'rtc_' prefix for path replacement
version_number=$(echo "$new_version" | sed 's/^rtc_//')
echo "Version number to replace with: $version_number"

# Replace version numbers in paths and headers_version
echo "Running perl command..."
perl -pi -e "s/rtc_[0-9]+(\.[0-9]+)+/rtc_${version_number}/g" "$yaml_file"

# Check if replacement was successful
if [ $? -eq 0 ]; then
echo "Version number successfully updated to: $new_version"
echo "Updated content of rtc.yaml:"
cat "$yaml_file"
else
echo "Error: Failed to update version number"
exit 1
fi
4 changes: 1 addition & 3 deletions terra/rtc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ PROJECT_ROOT=$(realpath ${MY_PATH}/..)
echo "MY_PATH: ${MY_PATH}"
echo "PROJECT_ROOT: ${PROJECT_ROOT}"

pushd ${MY_PATH}
cd ${MY_PATH}

# rtc
npm exec terra -- run \
Expand All @@ -17,5 +17,3 @@ npm exec terra -- run \

dotnet format ${PROJECT_ROOT}/Agora-C_Sharp_RTC-SDK_UT/Agora_C_Sharp_SDK_UT.sln
yarn doc

popd
1 change: 1 addition & 0 deletions terra/rtc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ parsers:
- '@agoraio-extensions/terra_shared_configs:headers/rtc_4.5.1/include/time_utils.h'
- '@agoraio-extensions/terra_shared_configs:headers/rtc_4.5.1/include/IAgoraMediaComponentFactory.h'
- '@agoraio-extensions/terra_shared_configs:headers/rtc_4.5.1/include/AgoraOptional.h'
- '@agoraio-extensions/terra_shared_configs:headers/rtc_4.5.1/include/AgoraRefPtr.h'
- '@agoraio-extensions/terra_shared_configs:headers/rtc_4.5.1/include/rte_*.h'

- name: IrisApiIdParser
Expand Down
Loading