Skip to content

Commit

Permalink
chore(ci): improve golang build workflow on circle ci
Browse files Browse the repository at this point in the history
  • Loading branch information
qwqcode committed Sep 4, 2024
1 parent 19c3317 commit 9fde40d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 20 deletions.
25 changes: 8 additions & 17 deletions .circleci/conditional_config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
version: 2.1

orbs:
node: circleci/[email protected]
codecov: codecov/[email protected]
node: circleci/[email protected]
go: circleci/[email protected]
codecov: codecov/[email protected]

executors:
base:
Expand All @@ -27,25 +28,15 @@ jobs:
## Backend
test_app:
executor: go
working_directory: ~/go/src/github.com/ArtalkJS/Artalk
environment:
GO111MODULE: "on"
working_directory: ~/repo
steps:
- checkout
- run:
name: "Print the Go version"
command: >
go version
- restore_cache:
keys:
- go-mod-1.22.6-{{ checksum "go.sum" }}
- run:
name: Install Dependencies
command: go mod download
- save_cache:
key: go-mod-1.22.6-{{ checksum "go.sum" }}
paths:
- "~/go/pkg/mod"
command: go version
- go/load-cache
- go/mod-download
- go/save-cache
- run:
name: Run tests
command: |
Expand Down
7 changes: 5 additions & 2 deletions server/handler/stat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@ func TestStat(t *testing.T) {

// check if the comments are sorted by created_at
for i := 0; i < len(resp.Data)-1; i++ {
timeA, _ := dateparse.ParseIn(resp.Data[i].Date, time.Local)
timeB, _ := dateparse.ParseIn(resp.Data[i+1].Date, time.Local)
commentA := resp.Data[i]
commentB := resp.Data[i+1]
timeA, _ := dateparse.ParseIn(commentA.Date, time.Local)
timeB, _ := dateparse.ParseIn(commentB.Date, time.Local)
t.Logf("[ID=%v]TimeA: %v, [ID=%v]TimeB: %v", commentA.ID, timeA, commentB.ID, timeB)
assert.True(t, timeA.After(timeB), "Comments should be sorted by created_at")
}
},
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/atk_users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: admin
email: [email protected]
link: https://qwqaq.com
password: 123456
password: "123456"
badge_name: 管理员
badge_color: #fff
last_ip: 10.90.1.1
Expand Down

0 comments on commit 9fde40d

Please sign in to comment.