-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add unit test & build & publish actions (#8)
- Loading branch information
1 parent
b1c394d
commit 7309c47
Showing
23 changed files
with
1,968 additions
and
4,354 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
build/ | ||
**/dist/* | ||
**/node_modules/* | ||
**/coverage/* | ||
**/node_modules/* | ||
pnpm-lock.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
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' | ||
registry-url: 'https://npm.pkg.github.com' | ||
scope: '@agoraio-extensions' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: build | ||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-and-upload-artifact: | ||
runs-on: ubuntu-latest | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
permissions: | ||
contents: read | ||
packages: read | ||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v3 | ||
|
||
- name: Add SSH key to chekout a private repo | ||
uses: webfactory/ssh-agent@v0.7.0 | ||
with: | ||
ssh-private-key: ${{ secrets.REPO_SSH_KEY }} | ||
|
||
- name: Setup 🛠️ | ||
uses: ./.github/actions/setup | ||
|
||
- name: Build 🔧 | ||
|
||
run: | | ||
pnpm install | ||
pnpm run lint | ||
pnpm run test | ||
pnpm run build | ||
MY_PATH=$(ls packages/rtc/dist | awk -F/ '{print $NF}') | ||
echo "MY_PATH=$MY_PATH" >> $GITHUB_ENV | ||
- name: Upload Artifact ⬆️ | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ env.MY_PATH }} | ||
path: ./packages/rtc/dist/${{ env.MY_PATH }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
on: ['pull_request'] | ||
|
||
name: Test PR | ||
|
||
jobs: | ||
build: | ||
name: Test PR | ||
runs-on: ubuntu-latest | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
packages: read | ||
checks: write | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v3 | ||
|
||
- name: Add SSH key to chekout a private repo | ||
uses: webfactory/ssh-agent@v0.7.0 | ||
with: | ||
ssh-private-key: ${{ secrets.REPO_SSH_KEY }} | ||
|
||
- name: Setup 🛠️ | ||
uses: ./.github/actions/setup | ||
|
||
- name: TEST 🔧 | ||
|
||
run: | | ||
pnpm install | ||
pnpm run lint | ||
- name: Report Coverage for iris-web-rtc 🟢 | ||
uses: ArtiomTr/jest-coverage-report-action@v2 | ||
with: | ||
custom-title: Coverage report for iris-web-rtc | ||
package-manager: pnpm | ||
working-directory: './packages/rtc' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
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: false | ||
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 💚 | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
run: | | ||
pnpm install | ||
pnpm run lint | ||
pnpm run build | ||
MY_PATH=$(ls packages/rtc/dist | awk -F/ '{print $NF}') | ||
echo "MY_PATH=$MY_PATH" >> $GITHUB_ENV | ||
- name: Upload Artifact ⬆️ | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: iris-web-rtc | ||
path: ./packages/rtc/dist/${{ env.MY_PATH }} | ||
|
||
- 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 | ||
run: | | ||
pnpm release ${{ inputs.version }} --ci --no-git.tag --no-github.release --npm.allowSameVersion | ||
- name: Release and Publish | ||
run: | | ||
pnpm release ${{ steps.package-info.outputs.version }} --ci --npm.publish=${{ inputs.npm }} --github.update --github.assets=./packages/rtc/dist/${{ env.MY_PATH }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
*.txt | ||
*.pcm | ||
coverage | ||
**/coverage/* | ||
*.log | ||
sdk | ||
tmp | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
**/dist/* | ||
**/coverage/* | ||
**/node_modules/* | ||
pnpm-lock.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# iris-web-rtc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.