From 4f4ece413826765018314bd98af764101af7e51e Mon Sep 17 00:00:00 2001 From: blooming <37789413+Bloomingg@users.noreply.github.com> Date: Thu, 23 May 2024 12:09:02 +0800 Subject: [PATCH] ci: auto build test & not lock issue (#546) --- .github/workflows/chatci.yml | 109 ++++++++++++++++++++++------- .github/workflows/lock-issue.yml | 65 ----------------- .github/workflows/scripts-test.yml | 90 ------------------------ .github/workflows/stale.yml | 48 ------------- 4 files changed, 82 insertions(+), 230 deletions(-) delete mode 100644 .github/workflows/lock-issue.yml delete mode 100644 .github/workflows/scripts-test.yml delete mode 100644 .github/workflows/stale.yml diff --git a/.github/workflows/chatci.yml b/.github/workflows/chatci.yml index c54e0821..6f97293e 100644 --- a/.github/workflows/chatci.yml +++ b/.github/workflows/chatci.yml @@ -11,56 +11,111 @@ # 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: OpenIM CI +name: OpenIM CI Auto Build on: push: branches: - main - - develop + - release-* paths-ignore: - "docs/**" - "README.md" - "README_zh-CN.md" + - "**.md" + - "docs/**" - "CONTRIBUTING.md" pull_request: branches: - main - - develop + - release-* paths-ignore: - "README.md" - "README_zh-CN.md" - - "CONTRIBUTING.md" + - "CONTRIBUTING/**" + - "**.md" - "docs/**" - -env: - GO_VERSION: "1.19" - GOLANGCI_VERSION: "v1.50.1" + workflow_dispatch: jobs: - openim: - name: Test with go ${{ matrix.go_version }} on ${{ matrix.os }} - runs-on: ${{ matrix.os }} + + build-linux: + name: Execute OpenIM Script On Linux + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write environment: name: openim - strategy: matrix: - go_version: ["1.21"] - os: [ubuntu-latest] - + arch: [arm64, armv7, amd64] + steps: - - name: Set up Go ${{ matrix.go_version }} - uses: actions/setup-go@v4 - with: - go-version: ${{ matrix.go_version }} - id: go + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.21' + + - name: init + run: sudo bash bootstrap.sh + timeout-minutes: 20 + + - name: Checkout chat repository + uses: actions/checkout@v4 + with: + repository: 'openimsdk/open-im-server' + path: 'server-repo' + + - name: Set up Docker for Linux + run: | + cd ${{ github.workspace }}/server-repo + sudo docker compose up -d + sudo sleep 30 # Increased sleep time for better stability + timeout-minutes: 20 # Increased timeout for Docker setup + + - name: Build and Start IM Serevr Services + run: | + cd ${{ github.workspace }}/server-repo + sudo mage + sudo mage start + sudo mage check + + - name: Build, Start, Check Services and Print Logs for Linux + run: | + sudo mage + sudo mage start + sudo mage check + + + - name: Restart Services and Print Logs + run: | + sudo mage stop + sudo mage start + sudo mage check - - name: Check out code into the Go module directory - uses: actions/checkout@v4 + + + # - name: Checkout e2e repository + # uses: actions/checkout@v4 + # with: + # repository: "openimsdk/test-e2e" + # path: e2e-repo - - name: init - run: | - sudo bash bootstrap.sh - echo "init successfully" + # - name: Set up Python 3.9 + # uses: actions/setup-python@v4 + # with: + # python-version: '3.9' + + # - name: Install dependencies + # run: | + # cd ${{ github.workspace }}/e2e-repo + # pip install PyYAML webdriver_manager selenium pytest + + # - name: Run tests + # run: | + # cd ${{ github.workspace }}/e2e-repo + # pytest main.py + \ No newline at end of file diff --git a/.github/workflows/lock-issue.yml b/.github/workflows/lock-issue.yml deleted file mode 100644 index 6a9aed9b..00000000 --- a/.github/workflows/lock-issue.yml +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright © 2023 OpenIM open source community. 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: 'Lock Threads' - -on: - schedule: - - cron: '0 * * * *' - workflow_dispatch: - -permissions: - issues: write - pull-requests: write - -concurrency: - group: lock - -jobs: - action: - runs-on: ubuntu-latest - steps: - - uses: dessant/lock-threads@v4 - with: - github-token: ${{ secrets.BOT_GITHUB_TOKEN }} - issue-inactive-days: '365' - exclude-issue-created-before: '' - exclude-issue-created-after: '' - exclude-issue-created-between: '' - exclude-issue-closed-before: '' - exclude-issue-closed-after: '' - exclude-issue-closed-between: '' - include-any-issue-labels: '' - include-all-issue-labels: '' - exclude-any-issue-labels: '' - add-issue-labels: '' - remove-issue-labels: '' - issue-comment: '' - issue-lock-reason: 'resolved' - pr-inactive-days: '365' - exclude-pr-created-before: '' - exclude-pr-created-after: '' - exclude-pr-created-between: '' - exclude-pr-closed-before: '' - exclude-pr-closed-after: '' - exclude-pr-closed-between: '' - include-any-pr-labels: '' - include-all-pr-labels: '' - exclude-any-pr-labels: '' - add-pr-labels: '' - remove-pr-labels: '' - pr-comment: '' - pr-lock-reason: 'resolved' - process-only: '' - log-output: false \ No newline at end of file diff --git a/.github/workflows/scripts-test.yml b/.github/workflows/scripts-test.yml deleted file mode 100644 index 7da773ad..00000000 --- a/.github/workflows/scripts-test.yml +++ /dev/null @@ -1,90 +0,0 @@ -# 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: OpenIM Chat Start Execute Scripts - -on: - push: - branches: - - main - paths-ignore: - - "docs/**" - - "README.md" - - "README_zh-CN.md" - - "CONTRIBUTING.md" - pull_request: - branches: - - main - paths-ignore: - - "README.md" - - "README_zh-CN.md" - - "CONTRIBUTING.md" - - "docs/**" - -jobs: - execute-scripts: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest] - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - # - name: Install latest Bash (macOS only) - # if: runner.os == 'macOS' - # run: | - # /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - # brew update - - # brew install bash - # brew install gnu-sed - - # echo "/usr/local/bin" >> $GITHUB_PATH - # echo "$(brew --prefix)/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH - - # brew install --cask docker - # open /Applications/Docker.app - - - name: deploy all services - run: | - git clone https://github.com/openimsdk/open-im-server.git - cd open-im-server - sudo docker compose up -d - sudo sleep 30 - - sudo bash bootstrap.sh - sudo mage - sudo mage start - sudo mage check - - echo "pwd = $(pwd)" - cd .. - ls -al && pwd - shell: bash - continue-on-error: true - - - name: Build Chat - run: | - sudo bash bootstrap.sh - sudo mage - sudo mage start - shell: bash - - - name: Print chat_$(date '+%Y%m%d').log - run: | - ls -al && echo "pwd = $(pwd)" - shell: bash - continue-on-error: true diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml deleted file mode 100644 index ca04d0e2..00000000 --- a/.github/workflows/stale.yml +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright © 2023 OpenIM open source community. 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. - -# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time. -# -# You can adjust the behavior by modifying this file. -# For more information, see: -# https://github.com/actions/stale -name: Mark stale issues and pull requests - -on: - schedule: - - cron: '0 8 * * *' - -jobs: - stale: - - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - - steps: - - uses: actions/stale@v8 - with: - repo-token: ${{ secrets.BOT_GITHUB_TOKEN }} - days-before-stale: 60 - days-before-close: 7 - stale-issue-message: 'This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.' - stale-pr-message: 'This issue is stale because it has been open 60 days with no activity.' - close-issue-message: 'This issue was closed because it has been stalled for 7 days with no activity.' - close-pr-message: 'This PR was closed because it has been stalled for 7 days with no activity. You can reopen it if you want.' - stale-pr-label: lifecycle/stale - stale-issue-label: lifecycle/stale - exempt-issue-labels: 'openim' - exempt-pr-labels: 'openim' - exempt-draft-pr: true