Gaea 2.4.2 Synchronization #2
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
# | |
# Licensed to the Apache Software Foundation (ASF) under one | |
# or more contributor license agreements. See the NOTICE file | |
# distributed with this work for additional information | |
# regarding copyright ownership. The ASF licenses this file | |
# to you 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: Go | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
code_check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.16' | |
- name: Run code check | |
run: | | |
# 执行所有检查 | |
for check in EOF spelling; do | |
./hack/verify-$check.sh | |
done | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.16' | |
- name: Check Go code formatting | |
run: | | |
go fmt ./... # 格式化所有 Go 文件 | |
git status # 查看 Git 状态 | |
# 检查是否有未提交的更改 | |
if [[ -n `git status -s` ]]; then | |
echo "Go files are not formatted correctly. Please run 'go fmt'." | |
exit 1 | |
fi | |
parser_build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.16' | |
- name: Build parser | |
run: | | |
cd parser && make | |
unit_tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.16' | |
- name: Set timezone | |
run: | | |
sudo ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime | |
ls -l /etc/localtime | |
- name: Run unit tests | |
run: | | |
make test | |
echo "sql parser test" | |
cd parser && make test | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.16' | |
- name: Build the project | |
run: | | |
make build | |
e2e_test_mysql5: | |
runs-on: ubuntu-latest # 使用 GitHub 提供的 Ubuntu 虚拟环境 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Pull Docker image | |
run: | | |
docker pull fieelina/test # 拉取指定的 Docker 镜像 | |
- name: Run Mysql5 E2E tests | |
run: | | |
docker run --rm \ | |
-v $(pwd):/workspace \ # 将当前目录挂载到容器中 | |
-w /workspace \ # 设置工作目录 | |
fieelina/test \ # 使用拉取的镜像 | |
make e2e-test # 在容器中运行 E2E 测试 | |
e2e_test_mysql8: | |
runs-on: ubuntu-latest # 使用 GitHub 提供的 Ubuntu 虚拟环境 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Pull Docker image | |
run: | | |
docker pull fieelina/test # 拉取指定的 Docker 镜像 | |
- name: Run Mysql8 E2E tests | |
run: | | |
docker run --rm \ | |
-v $(pwd):/workspace \ # 将当前目录挂载到容器中 | |
-w /workspace \ # 设置工作目录 | |
fieelina/test \ # 使用拉取的镜像 | |
make e2e-test-mysql8 # 在容器中运行 E2E 测试 |