Files
cc-connect/.github/workflows/ci.yml
T
Deeka WongandDeeka Wong 0095b0e9ff feat(telegram): add audio reply support for telegram (#225)
* feat(telegram): add audio reply support

* ci: lint only newly introduced issues

* fix(telegram): improve SendAudio error reporting

* ci: guard lint fallback for first commit

---------

Co-authored-by: Deeka Wong <8337659+huangdijia@users.noreply.github.com>
2026-03-21 14:39:42 +08:00

129 lines
3.2 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
release:
types: [published]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- name: Lint code
run: |
set -euo pipefail
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62.0
LINT_BIN="$(go env GOPATH)/bin/golangci-lint"
if [ "${{ github.event_name }}" = "pull_request" ]; then
git fetch --no-tags origin "${{ github.base_ref }}"
"$LINT_BIN" run --new-from-rev "origin/${{ github.base_ref }}" ./...
elif [ "${{ github.event_name }}" = "push" ] && [ "${{ github.event.before }}" != "0000000000000000000000000000000000000000" ]; then
"$LINT_BIN" run --new-from-rev "${{ github.event.before }}" ./...
elif git rev-parse --verify HEAD^ >/dev/null 2>&1; then
"$LINT_BIN" run --new-from-rev "$(git rev-parse HEAD^)" ./...
else
"$LINT_BIN" run ./...
fi
- name: Lint GitHub workflows
run: |
go install github.com/rhysd/actionlint/cmd/actionlint@v1.7.8
"$(go env GOPATH)/bin/actionlint" -color
unit-test:
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- name: Download dependencies
run: go mod download
env:
GOPROXY: https://proxy.golang.org,direct
GOSUMDB: sum.golang.org
- name: Build
run: go build ./...
- name: Run tests
run: go test ./... -v -race
- name: Run tests with coverage
run: go test ./... -coverprofile=coverage.out -covermode=atomic
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: github.event_name == 'push'
with:
files: ./coverage.out
fail_ci_if_error: false
smoke-test:
runs-on: ubuntu-latest
needs: unit-test
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- name: Run smoke tests
run: go test -v -tags=smoke ./tests/e2e/...
regression-test:
runs-on: ubuntu-latest
needs: smoke-test
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- name: Run regression tests
run: go test -v -tags=regression ./tests/e2e/...
performance-test:
runs-on: ubuntu-latest
needs: regression-test
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- name: Run performance benchmarks
run: go test -bench=. -benchmem -tags=performance ./tests/performance/...