Skip to content

[feat]:automation task #752

[feat]:automation task

[feat]:automation task #752

Workflow file for this run

name: CI@backend
on:
push:
branches: ["main", "release/**"]
paths:
- 'backend/**'
- '.github/workflows/backend-ci.yaml'
pull_request:
branches: ["main", "release/**"]
paths:
- 'backend/**'
- '.github/workflows/backend-ci.yaml'
workflow_dispatch:
permissions:
contents: read
pull-requests: read
jobs:
golang-lint:
name: Golang CI Lint
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./backend
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.24.0"
- name: Golang Lint
# https://golangci-lint.run/
run: |
# Install golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.2.1
# Add golangci-lint to PATH
export PATH=$PATH:$(go env GOPATH)/bin
# Run golangci-lint
golangci-lint run --config ../.github/.golangci.yaml
build-and-unittest:
name: Build and Unit Test
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./backend
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.24.0"
- name: Build
run: go build -v ./...
- name: Run Unit Tests
run: |
go test -gcflags="all=-N -l" -race -v -coverprofile=coverage.out -coverpkg=./... ./...
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: ./coverage.out
flags: unittests
fail_ci_if_error: false
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}