Skip to content

Commit

Permalink
fix(ci): 完善ci
Browse files Browse the repository at this point in the history
1. 修复ci test 报错
  • Loading branch information
wastill committed Dec 14, 2023
1 parent 7add28d commit eb13851
Showing 1 changed file with 10 additions and 65 deletions.
75 changes: 10 additions & 65 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
workflow_dispatch: # 允许手动触发工作流
push: # 当有代码推送事件发生时
branches:
- main # 只有推送到 main 分支时才触发
- '*' # 只有推送到 main 分支时才触发
tags:
- '*'
pull_request:
Expand All @@ -14,7 +14,7 @@ on:
# 定义工作流的任务
jobs:
build:
# 定义运行此任务的环境:最新版本的 ubuntu
name: Set up Build
runs-on: ubuntu-latest

# 定义任务中的步骤
Expand All @@ -32,7 +32,7 @@ jobs:
- name: Set up Build
uses: docker/setup-buildx-action@v2
- run: |
make build
ls -l
linting:
name: Lint Code Base
Expand Down Expand Up @@ -119,83 +119,28 @@ jobs:
fetch-depth: 0
- name: Go Test
run: |
docker ps -a
go test -v ./...
env:
# The hostname used to communicate with the PostgreSQL service container
PG_DB_HOST: "postgres"
PG_DB_HOST: "localhost"
PG_DB_PORT: "5432"
PG_DB_SSLMODE: "false"
PG_DB_USERNAME: "postgres"
PG_DB_PASSWORD: "postgres"

# The hostname used to communicate with the Redis service container
REDIS_ADDR: "redis:6379"
REDIS_ADDR: "localhost:6379"

# The hostname used to communicate with the Mysql service container
MYSQL_DB_HOST: "mysql"
MYSQL_DB_PORT: "3306"
MYSQL_DB_HOST: "localhost"
MYSQL_DB_PORT: "33306"
MYSQL_DB_SSLMODE: "false"
MYSQL_DB_USERNAME: "mysql"
MYSQL_DB_PASSWORD: "mysql"

# The hostname used to communicate with the Minio service container
MINIO_ENDPOINT: "minio:9000"
MINIO_ENDPOINT: "localhost:9000"
MINIO_ACCESS_KEY: "accesskey"
MINIO_SECRET_KEY: "password"
MINIO_SSL: "false"


main:
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'zncdata-labs/zncdata-stack-operator'
runs-on: ubuntu-latest
needs:
- build
- linting

steps:
# 检出代码。只检出最新的1次提交
- uses: actions/checkout@v3
with:
fetch-depth: 1

# 登录到 QUAY Hub
- name: Login to quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }} # 使用存储在 GitHub Secrets 中的 QUAY 用户名
password: ${{ secrets.QUAY_PASSWORD }} # 使用存储在 GitHub Secrets 中的 QUAY 密码

- name: Build and push Docker image
run: |
make docker-buildx
make bundle
make bundle-buildx
tags:
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && github.repository == 'zncdata-labs/zncdata-stack-operator'
runs-on: ubuntu-latest
needs:
- build
- linting

steps:
# 检出代码。只检出最新的1次提交
- uses: actions/checkout@v3
with:
fetch-depth: 1

# 登录到 QUAY Hub
- name: Login to quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }} # 使用存储在 GitHub Secrets 中的 QUAY 用户名
password: ${{ secrets.QUAY_PASSWORD }} # 使用存储在 GitHub Secrets 中的 QUAY 密码

- name: Build and push Docker image
run: |
export VERSION=$GITHUB_REF_NAME
make docker-buildx
make bundle
make bundle-buildx
MINIO_SSL: "false"

0 comments on commit eb13851

Please sign in to comment.