You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Open-IM-Server/.github/workflows/e2e-test.bak

160 lines
4.7 KiB

# 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 E2E And API Test
on:
workflow_dispatch:
pull_request:
push:
schedule:
# run e2e test every 4 hours
- cron: 0 */4 * * *
env:
CALLBACK_ENABLE: true
jobs:
build:
name: Test
runs-on: ubuntu-latest
env:
GO111MODULE: on
steps:
- name: Set up Go 1.21
uses: actions/setup-go@v5
with:
go-version: 1.21
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Create e2e test
run: |
echo "...test e2e"
execute-linux-systemd-scripts:
name: Execute OpenIM script on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
environment:
name: openim
strategy:
matrix:
go_version: ["1.20"]
os: ["ubuntu-latest"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go ${{ matrix.go_version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go_version }}
id: go
- name: Install Task
uses: arduino/setup-task@v1
with:
version: '3.x' # If available, use the latest major version that's compatible
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Docker Operations
run: |
sudo docker compose up -d
sudo bash bootstrap.sh
sudo mage
sudo sleep 20
- name: Module Operations
run: |
echo "===========> Verifying go-gitlint is installed"
if [ ! -f ./_output/tools/go-gitlint ]; then
export GOBIN=$(pwd)/_output/tools
echo "===========> Installing The default installation path is /home/ubuntu/DF/open-im-server/_output/tools/go-gitlint"
sudo go install github.com/marmotedu/go-gitlint/cmd/go-gitlint@latest
echo "===========> go-gitlint is installed in /home/ubuntu/DF/open-im-server/_output/tools/go-gitlint"
fi
- name: Build, Start(make build && make start)
run: |
sudo ./scripts/install/install.sh -i
- name: Exec OpenIM System Status Chack
run: |
sudo ./scripts/install/install.sh -s
# - name: Exec OpenIM API test (make test-api)
- name: Exec OpenIM test (make test)
run: |
mkdir -p ./tmp
touch ./tmp/test.md
echo "# OpenIM Test" >> ./tmp/test.md
echo "## OpenIM API Test" >> ./tmp/test.md
echo "<details><summary>Command Output for OpenIM API Test</summary>" >> ./tmp/test.md
echo "<pre><code>" >> ./tmp/test.md
echo "===========> Run api test"
./scripts/install/test.sh
echo "===========> Run api test" >> ./tmp/test.md
./scripts/install/test.sh >> ./tmp/test.md
echo "</code></pre>" >> ./tmp/test.md
echo "</details>" >> ./tmp/test.md
echo "===========> Run api test"
./scripts/install/test.sh
# - name: Exec OpenIM E2E Test (make test-e2e)
# run: |
# echo "" >> ./tmp/test.md
# echo "## OpenIM E2E Test" >> ./tmp/test.md
# echo "<details><summary>Command Output for OpenIM E2E Test</summary>" >> ./tmp/test.md
# echo "<pre><code>" >> ./tmp/test.md
# sudo make test-e2e | tee -a ./tmp/test.md
# echo "</code></pre>" >> ./tmp/test.md
# echo "</details>" >> ./tmp/test.md
# sudo make test-e2e
- name: Comment PR with file
uses: thollander/actions-comment-pull-request@v2
with:
filePath: ./tmp/test.md
comment_tag: nrt_file
reactions: eyes, rocket
mode: recreate
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
continue-on-error: true
- name: Check outputs
run: |
echo "id : ${{ steps.nrt_message.outputs.id }}"
echo "body : ${{ steps.nrt_message.outputs.body }}"
echo "html_url : ${{ steps.nrt_message.outputs.html_url }}"
- name: Exec OpenIM System uninstall
run: |
sudo ./scripts/install/install.sh -u
- name: gobenchdata publish
uses: bobheadxi/gobenchdata@v1
with:
PRUNE_COUNT: 30
GO_TEST_FLAGS: -cpu 1,2
PUBLISH: true
PUBLISH_BRANCH: gh-pages
env:
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
continue-on-error: true