Skip to content

Commit

Permalink
Feat/add test scripts (#1341)
Browse files Browse the repository at this point in the history
* kubernetes for kustomize learning

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>

* feat(main): add openim server test cicd

* feat(main): add openim scripts token

---------

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>
  • Loading branch information
cubxxw committed Nov 5, 2023
1 parent a9e5901 commit a0621ae
Show file tree
Hide file tree
Showing 23 changed files with 407 additions and 776 deletions.
77 changes: 44 additions & 33 deletions .github/workflows/auto-gh-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,38 +24,49 @@ on:
types: [created]

jobs:
create-pr:
sync-issue-to-pr:
runs-on: ubuntu-latest
if: github.event.pull_request.base.ref == 'main'
# && github.event.pull_request.merged == true
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Create PR to release branch
run: |
ISSUEID=$(gh pr view ${{ github.event.pull_request.number }} --repo $OWNER/$REPO | grep -oP 'Fixes #\K\d+')
echo "===========> $ISSUEID"
ISSUE=$(gh issue view $ISSUEID --repo $OWNER/$REPO --json labels,assignees,milestone,title)
echo "===========> $ISSUE"
LABELS=$(echo $ISSUE | jq -r '.labels[] | select(.name) | .name' | jq -R -r -s -c 'split("\n")[:-1] | join(",")')
ASSIGNEES=$(echo $ISSUE | jq -r '.assignees[] | select(.login) | .login' | jq -R -s -c 'split("\n")[:-1] | join(",")')
MILESTONE=$(echo $ISSUE | jq -r '.milestone | select(.title) | .title')
TITLE=$(echo $ISSUE | jq -r '.title')
gh pr edit ${{ github.event.pull_request.number }} --repo $OWNER/$REPO --add-label "$LABELS" --add-assignee "$ASSIGNEES" --milestone "$MILESTONE"
# git checkout -b bot/merge-to-release-$ISSUEID
# git push origin bot/merge-to-release-$ISSUEID
# gh pr create --base release --head bot/merge-to-release-$ISSUEID --title "Merge main to release" --body ""
# gh pr create --base main --head feat/auto-release-pr-624 --title "The bug is fixed" --body "$x" --repo openimsdk/open-im-server --reviewer "cubxxw"
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
GH_TOKEN: ${{ github.token }}
ISSUE: ${{ github.event.issue.html_url }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
- name: Checkout code
uses: actions/checkout@v2

- name: Sync Issue to PR
if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main'
run: |
PR_BODY="${{ github.event.pull_request.body }}"
ISSUE_NUMBER=$(echo "$PR_BODY" | grep -oP 'Fixes #\K\d+')
if [[ -z "$ISSUE_NUMBER" ]]; then
echo "No Issue number found."
exit 1
fi
echo "Issue number found: $ISSUE_NUMBER"
# Using GitHub CLI to get issue details
gh issue view "$ISSUE_NUMBER" --repo "${{ github.repository }}" --json labels,assignees,milestone,title > issue_data.json
# Check if jq is installed
if ! command -v jq &> /dev/null; then
echo "Installing jq..."
sudo apt-get install -y jq
fi
# Parse data with jq
LABELS=$(jq -r '.labels | map(.name) | join(",")' issue_data.json)
ASSIGNEES=$(jq -r '.assignees | map(.login) | join(",")' issue_data.json)
MILESTONE=$(jq -r '.milestone.title' issue_data.json)
# Check if any of the fields are empty and set them to None
LABELS=${LABELS:-None}
ASSIGNEES=${ASSIGNEES:-None}
MILESTONE=${MILESTONE:-None}
# Edit the PR with issue details, handling empty fields
gh pr edit "${{ github.event.pull_request.number }}" --repo "${{ github.repository }}" \
${LABELS:+--add-label "$LABELS"} \
${ASSIGNEES:+--add-assignee "$ASSIGNEES"} \
${MILESTONE:+--milestone "$MILESTONE"}
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/auto-invite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
In addition to Slack, we also offer the following ways to get in touch:
+ <a href="https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q" target="_blank"><img src="https://img.shields.io/badge/Slack-OpenIM%2B-blueviolet?logo=slack&amp;logoColor=white"></a> We also have Slack channels for you to communicate and discuss. To join, visit https://slack.com/ and join our [👀 Open-IM-Server slack](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q) team channel.
+ <a href="https://mail.google.com/mail/u/0/?fs=1&tf=cm&to=winxu81@gmail.com" target="_blank"><img src="https://img.shields.io/badge/gmail-%40OOpenIMSDKCore?style=social&logo=gmail"></a> Get in touch with us on [Gmail](https://mail.google.com/mail/u/0/?fs=1&tf=cm&to=winxu81@gmail.com). If you have any questions or issues that need resolving, or any suggestions and feedback for our open source projects, please feel free to contact us via email.
+ <a href="https://mail.google.com/mail/u/0/?fs=1&tf=cm&to=info@openim.io" target="_blank"><img src="https://img.shields.io/badge/gmail-%40OOpenIMSDKCore?style=social&logo=gmail"></a> Get in touch with us on [Gmail](https://mail.google.com/mail/u/0/?fs=1&tf=cm&to=winxu81@gmail.com). If you have any questions or issues that need resolving, or any suggestions and feedback for our open source projects, please feel free to contact us via email.
+ <a href="https://doc.rentsoft.cn/" target="_blank"><img src="https://img.shields.io/badge/%E5%8D%9A%E5%AE%A2-%40OpenIMSDKCore-blue?style=social&logo=Octopus%20Deploy"></a> Read our [blog](https://doc.rentsoft.cn/). Our blog is a great place to stay up-to-date with Open-IM-Server projects and trends. On the blog, we share our latest developments, tech trends, and other interesting information.
+ <a href="https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg" target="_blank"><img src="https://img.shields.io/badge/%E5%BE%AE%E4%BF%A1-OpenIMSDKCore-brightgreen?logo=wechat&style=flat-square"></a> Add [Wechat](https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg) and indicate that you are a user or developer of Open-IM-Server. We will process your request as soon as possible.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/auto-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: Create Tag
name: OpenIM Create Tag

on:
issue_comment:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bot-auto-cherry-pick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: 'Github Rebot for Cherry Pick when PR is merged'
name: Github Rebot for Cherry Pick when PR is merged
on:
pull_request_target:
types:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: Check-Coverage
name: OpenIM Check Coverage

on:
workflow_dispatch:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cla.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: "OpenIM CLA Assistant"
name: OpenIM CLA Assistant
on:
issue_comment:
types: [created]
Expand All @@ -33,7 +33,7 @@ env:
OPEN_IM_SERVER_CLA_DOCUMENT: https://github.com/openim-sigs/cla/blob/main/README.md
OPEN_IM_SERVER_SIGNATURES_PATH: signatures/${{ github.event.repository.name }}/cla.json

OPEN_IM_SERVER_ALLOWLIST: kubbot,bot*
OPEN_IM_SERVER_ALLOWLIST: kubbot,bot*,bot-*,bot/*,bot-/*,bot,*[bot]

jobs:
CLAAssistant:
Expand Down
65 changes: 26 additions & 39 deletions .github/workflows/create_branch_on_tag.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
# Copyright © 2023 OpenIM. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Create Branch on Tag

on:
push:
tags:
- 'v*.*.0'

permissions:
contents: write
actions: write

jobs:
create-branch:
runs-on: ubuntu-latest
Expand All @@ -36,41 +26,38 @@ jobs:
- name: Install git-chglog
run: make install.git-chglog

- name: Create Branch
- name: Create Branch and Push
env:
TAG_NAME: ${{ github.ref_name }}
run: |
TAG_NAME=${GITHUB_REF/refs\/tags\//}
IFS='.' read -ra VERSION_PARTS <<< "$TAG_NAME"
if [[ "${VERSION_PARTS[2]}" = "0" ]]; then
BRANCH_NAME="release-v${VERSION_PARTS[0]}.${VERSION_PARTS[1]}"
echo "Creating branch $BRANCH_NAME"
git checkout -b "$BRANCH_NAME"
git push origin "$BRANCH_NAME"
else
echo "Not a release tag. Skipping branch creation."
fi
continue-on-error: true

- name: Push Changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Auto Commit CHANGELOG"
branch: release-v${VERSION_PARTS[0]}.${VERSION_PARTS[1]}
env:
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}

- name: Create and Push CHANGELOG
- name: Create and Commit CHANGELOG
if: endsWith(github.ref_name, '.0')
run: |
git checkout main
TAG_NAME=${GITHUB_REF/refs\/tags\//}
git fetch --all
TAG_NAME=${GITHUB_REF#refs/tags/}
IFS='.' read -ra VERSION_PARTS <<< "$TAG_NAME"
if [[ "${VERSION_PARTS[2]}" = "0" ]]; then
cd CHANGELOG
git-chglog --tag-filter-pattern "v${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.*" -o "CHANGELOG-${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.md"
git add "CHANGELOG-${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.md"
git commit -m "Update CHANGELOG for $TAG_NAME"
fi
- name: Push Changes
uses: stefanzweifel/git-auto-commit-action@v5
git checkout main
cd CHANGELOG
git-chglog --tag-filter-pattern "v${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.*" -o "CHANGELOG-${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.md"
git add "CHANGELOG-${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.md"
git commit -m "Update CHANGELOG for $TAG_NAME" || echo "No changes to commit."
continue-on-error: true

- name: Push CHANGELOG to Main
if: steps.create-and-commit-changelog.outputs.changes == 'true'
uses: ad-m/github-push-action@v0.6.0
with:
commit_message: "Auto Commit CHANGELOG"
github_token: ${{ secrets.BOT_GITHUB_TOKEN }}
branch: main
env:
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
continue-on-error: true
55 changes: 0 additions & 55 deletions .github/workflows/deploy.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/depsreview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.

name: Dependency Review
name: OpenIM Dependency Review
on: [pull_request]

permissions:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: e2e
name: OpenIM E2E Test

on:
workflow_dispatch:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: first-interaction
name: OpenIM First Interaction

on:
issues:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/issue-robot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: 'issue translator'
name: OpenIM Issue Aotu Translator
on:
issue_comment:
types: [created]
Expand Down
20 changes: 11 additions & 9 deletions .github/workflows/opencommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: 'OpenIM Commit Action'
name: OpenIM OpenCommit Action

on:
push:
branches:
- main
# this list of branches is often enough,
# but you may still ignore other public branches
branches-ignore: [main master dev development release]

jobs:
opencommit:
Expand All @@ -27,26 +28,27 @@ jobs:
permissions: write-all
steps:
- name: Setup Node.js Environment
uses: actions/setup-node@v4
uses: actions/setup-node@v2
with:
node-version: '16'
- uses: actions/checkout@v4
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: di-sukharev/opencommit@github-action-v1.0.4
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}

env:
# set openAI api key in repo actions secrets,
# for openAI keys go to: https://platform.openai.com/account/api-keys
# for repo secret go to: https://github.com/kuebcub/settings/secrets/actions
# for repo secret go to: <your_repo_url>/settings/secrets/actions
OCO_OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

# customization
OCO_OPENAI_MAX_TOKENS: 500
OCO_OPENAI_BASE_PATH: ''
OCO_DESCRIPTION: false
OCO_EMOJI: false
OCO_MODEL: gpt-3.5-turbo
OCO_LANGUAGE: en
OCO_MODEL: gpt-3.5-turbo-16k
OCO_LANGUAGE: en
OCO_PROMPT_MODULE: conventional-commit
Loading

0 comments on commit a0621ae

Please sign in to comment.