2021-01-30 14:59:28 +08:00
|
|
|
name: build
|
|
|
|
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest]
|
2024-10-26 13:33:58 +08:00
|
|
|
go-version: [1.22.x, 1.23.x]
|
2021-01-30 14:59:28 +08:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
services:
|
|
|
|
redis:
|
2023-12-07 15:55:41 +08:00
|
|
|
image: redis:7
|
2021-01-30 14:59:28 +08:00
|
|
|
ports:
|
|
|
|
- 6379:6379
|
|
|
|
steps:
|
2023-12-07 15:55:41 +08:00
|
|
|
- uses: actions/checkout@v4
|
2021-01-30 14:59:28 +08:00
|
|
|
|
|
|
|
- name: Set up Go
|
2024-10-26 13:33:58 +08:00
|
|
|
uses: actions/setup-go@v5
|
2021-01-30 14:59:28 +08:00
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go-version }}
|
2023-12-07 15:55:41 +08:00
|
|
|
cache: false
|
2021-01-30 14:59:28 +08:00
|
|
|
|
2022-02-01 22:32:26 +08:00
|
|
|
- name: Build core module
|
2021-01-30 14:59:28 +08:00
|
|
|
run: go build -v ./...
|
|
|
|
|
2022-02-01 22:32:26 +08:00
|
|
|
- name: Build x module
|
|
|
|
run: cd x && go build -v ./... && cd ..
|
|
|
|
|
|
|
|
- name: Test core module
|
2021-01-30 14:59:28 +08:00
|
|
|
run: go test -race -v -coverprofile=coverage.txt -covermode=atomic ./...
|
|
|
|
|
2022-02-01 22:32:26 +08:00
|
|
|
- name: Test x module
|
|
|
|
run: cd x && go test -race -v ./... && cd ..
|
|
|
|
|
2021-01-30 14:59:28 +08:00
|
|
|
- name: Benchmark Test
|
|
|
|
run: go test -run=^$ -bench=. -loglevel=debug ./...
|
|
|
|
|
|
|
|
- name: Upload coverage to Codecov
|
|
|
|
uses: codecov/codecov-action@v1
|
2022-06-03 10:23:06 +08:00
|
|
|
|
|
|
|
build-tool:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest]
|
2024-10-26 13:33:58 +08:00
|
|
|
go-version: [1.22.x, 1.23.x]
|
2022-06-03 10:23:06 +08:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
services:
|
|
|
|
redis:
|
2023-12-07 15:55:41 +08:00
|
|
|
image: redis:7
|
2022-06-03 10:23:06 +08:00
|
|
|
ports:
|
|
|
|
- 6379:6379
|
|
|
|
steps:
|
2023-12-07 15:55:41 +08:00
|
|
|
- uses: actions/checkout@v4
|
2022-06-03 10:23:06 +08:00
|
|
|
|
|
|
|
- name: Set up Go
|
2024-10-26 13:33:58 +08:00
|
|
|
uses: actions/setup-go@v5
|
2022-06-03 10:23:06 +08:00
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go-version }}
|
2023-12-07 15:55:41 +08:00
|
|
|
cache: false
|
2022-06-03 10:23:06 +08:00
|
|
|
|
|
|
|
- name: Build tools module
|
|
|
|
run: cd tools && go build -v ./... && cd ..
|
|
|
|
|
|
|
|
- name: Test tools module
|
|
|
|
run: cd tools && go test -race -v ./... && cd ..
|
|
|
|
|
2024-10-26 13:48:12 +08:00
|
|
|
golangci:
|
|
|
|
name: lint
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- uses: actions/setup-go@v5
|
|
|
|
with:
|
|
|
|
go-version: stable
|
|
|
|
|
|
|
|
- name: golangci-lint
|
|
|
|
uses: golangci/golangci-lint-action@v6
|
|
|
|
with:
|
|
|
|
version: v1.61
|