Skip to content

Commit a66f104

Browse files
committed
Merge branch 'dev' into feat/1.0.5/deltag
2 parents 1cba6cd + 1a5cdba commit a66f104

File tree

8 files changed

+118
-115
lines changed

8 files changed

+118
-115
lines changed

.github/workflows/build_dev_img.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Build Dev Image
2+
3+
on:
4+
push:
5+
branches: [ "test","dev" ]
6+
7+
8+
jobs:
9+
build:
10+
name: Build and Push
11+
runs-on: [self-hosted,linux]
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
16+
- name: Docker meta
17+
id: meta
18+
uses: docker/metadata-action@v4
19+
with:
20+
images: ${{ secrets.IMG_URL }}/${{ secrets.IMG_NAMESPACE }}/answer
21+
tags: |
22+
type=raw,value=latest
23+
24+
25+
- name: Set up QEMU
26+
uses: docker/setup-qemu-action@v2
27+
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v2
30+
31+
- name: Login to Container Registry
32+
uses: docker/login-action@v2
33+
with:
34+
registry: ${{ secrets.IMG_URL }}
35+
username: ${{ secrets.IMG_USERNAME }}
36+
password: ${{ secrets.IMG_PASSWORD }}
37+
38+
39+
- name: Build and push
40+
uses: docker/build-push-action@v4
41+
with:
42+
context: .
43+
file: ./.github/Dockerfile
44+
platforms: linux/amd64
45+
push: true
46+
tags: ${{ steps.meta.outputs.tags }}
47+
labels: ${{ steps.meta.outputs.labels }}
48+
49+
sync-git:
50+
name: Sync to Git
51+
runs-on: [self-hosted,linux]
52+
needs:
53+
- build
54+
steps:
55+
- name: Sync to Gitlab
56+
uses: aiworklab/git-mirror-action@master
57+
env:
58+
SSH_PRIVATE_KEY: ${{ secrets.GITLAB_RSA_PRIVATE_KEY }}
59+
with:
60+
source-repo: [email protected]:answerdev/answer.git
61+
destination-repo: ${{ secrets.GITLAB_REPO }}
62+

.github/workflows/build_dockerhub_img.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Build DockerHub Image
22

33
on:
44
push:
5-
branches: [ "main","githubaction","test" ]
5+
branches: [ "main"]
66
tags:
77
- v2.*
88
- v1.*

.github/workflows/build_test.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Build Test
2+
3+
on:
4+
push:
5+
branches:
6+
- 'dev'
7+
pull_request:
8+
branches:
9+
- 'dev'
10+
11+
jobs:
12+
node-build-test:
13+
name: Node Build Test
14+
runs-on: [self-hosted, linux]
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
19+
- name: Set up Go
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: 16
23+
24+
- name: Test Build
25+
run: make install-ui-packages ui
26+
27+
go-build-test:
28+
name: Go Build Test
29+
runs-on: [self-hosted, linux]
30+
needs:
31+
- node-build-test
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v3
35+
36+
- name: Set up Go
37+
uses: actions/setup-go@v3
38+
with:
39+
go-version: 1.18
40+
41+
- name: Go Test Build
42+
run: make clean build

.github/workflows/go_build_test.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/workflows/node_build_test.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.gitlab-ci.yml

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,48 +5,8 @@ include:
55
file: ".deploy-helm.yml"
66

77
stages:
8-
- compile-html
9-
- compile-golang
10-
- push
118
- deploy-dev
129

13-
"compile the html and other static files":
14-
image: node:16
15-
stage: compile-html
16-
before_script:
17-
- npm config set registry https://repo.huaweicloud.com/repository/npm/
18-
- make install-ui-packages
19-
script:
20-
- make ui
21-
artifacts:
22-
paths:
23-
- ./build
24-
25-
"compile the golang project":
26-
image: golang:1.18
27-
stage: compile-golang
28-
# before_script:
29-
# - export GOPROXY=https://goproxy.cn,direct
30-
script:
31-
- make build
32-
artifacts:
33-
paths:
34-
- ./answer
35-
36-
"build docker images and push":
37-
stage: push
38-
# before_script:
39-
# - export GOPROXY=https://goproxy.cn,direct
40-
extends: .docker-build-push
41-
only:
42-
- test
43-
variables:
44-
DockerNamespace: sf_app
45-
DockerImage: answer
46-
DockerTag: "$CI_COMMIT_SHORT_SHA latest"
47-
DockerfilePath: .
48-
PushPolicy: qingcloud
49-
5010
"deploy-to-local-develop-environment":
5111
stage: deploy-dev
5212
extends: .deploy-helm

.goreleaser.yaml

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,49 +7,33 @@ env:
77
before:
88
hooks:
99
- go mod tidy
10+
11+
release:
12+
draft: true
13+
1014
builds:
11-
- id: build-amd64
15+
- id: build
1216
main: ./cmd/answer/.
1317
binary: answer
1418
ldflags: -s -w -X main.Version={{.Version}} -X main.Revision={{.ShortCommit}} -X main.Time={{.Date}} -X main.BuildUser=goreleaser
19+
flags: -v
1520
goos:
1621
- linux
22+
- darwin
1723
goarch:
1824
- amd64
19-
- id: build-windows
20-
main: ./cmd/answer/.
21-
binary: answer
22-
ldflags: -s -w -X main.Version={{.Version}} -X main.Revision={{.ShortCommit}} -X main.Time={{.Date}} -X main.BuildUser=goreleaser
23-
goos:
24-
- windows
25-
goarch:
26-
- amd64
27-
- id: build-arm64
28-
main: ./cmd/answer/.
29-
binary: answer
30-
ldflags: -s -w -X main.Version={{.Version}} -X main.Revision={{.ShortCommit}} -X main.Time={{.Date}} -X main.BuildUser=goreleaser
31-
goos:
32-
- linux
33-
goarch:
3425
- arm64
35-
- id: build-darwin-arm64
26+
- id: build-windows
3627
main: ./cmd/answer/.
3728
binary: answer
38-
goos:
39-
- darwin
40-
goarch:
41-
- arm64
4229
ldflags: -s -w -X main.Version={{.Version}} -X main.Revision={{.ShortCommit}} -X main.Time={{.Date}} -X main.BuildUser=goreleaser
4330
flags: -v
44-
- id: build-darwin-amd64
45-
main: ./cmd/answer/.
46-
binary: answer
4731
goos:
48-
- darwin
32+
- windows
4933
goarch:
5034
- amd64
51-
ldflags: -s -w -X main.Version={{.Version}} -X main.Revision={{.ShortCommit}} -X main.Time={{.Date}} -X main.BuildUser=goreleaser
52-
flags: -v
35+
36+
5337

5438

5539
archives:
@@ -70,3 +54,4 @@ changelog:
7054
- '^test:'
7155

7256
# goreleaser release --snapshot --rm-dist
57+

internal/repo/rank/user_rank_repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func (ur *UserRankRepo) checkUserMinRank(ctx context.Context, session *xorm.Sess
7474
isReachStandard bool, err error,
7575
) {
7676
bean := &entity.User{ID: userID}
77-
_, err = session.Select("rank").Get(bean)
77+
_, err = session.Select("`rank`").Get(bean)
7878
if err != nil {
7979
return false, errors.InternalServer(reason.DatabaseError).WithError(err).WithStack()
8080
}

0 commit comments

Comments
 (0)