mirror of
https://github.com/ultravioletrs/cocos.git
synced 2026-06-23 04:10:25 +00:00
ccab296b62
CI / lint (push) Has been cancelled
CI / test (agent) (push) Has been cancelled
CI / test (cli) (push) Has been cancelled
CI / test (cmd) (push) Has been cancelled
CI / test (internal) (push) Has been cancelled
CI / test (manager, true) (push) Has been cancelled
CI / test (pkg) (push) Has been cancelled
CI / upload-coverage (push) Has been cancelled
* Update Go version to 1.24.x in CI workflows and fix supermq version in go.mod Signed-off-by: Sammy Oina <sammyoina@gmail.com> * Refactor CI workflow to separate linting and testing jobs, and streamline test execution for multiple modules Signed-off-by: Sammy Oina <sammyoina@gmail.com> * Downgrade Go version from 1.23.10 to 1.23.8 in go.mod Signed-off-by: Sammy Oina <sammyoina@gmail.com> --------- Signed-off-by: Sammy Oina <sammyoina@gmail.com>
89 lines
2.1 KiB
YAML
89 lines
2.1 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: 1.24.x
|
|
|
|
- name: golangci-lint
|
|
uses: golangci/golangci-lint-action@v7
|
|
with:
|
|
version: v2.0.2
|
|
|
|
- name: Build
|
|
run: make
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
needs: lint
|
|
strategy:
|
|
matrix:
|
|
module: [agent, cli, cmd, internal, pkg, manager]
|
|
include:
|
|
- module: manager
|
|
sudo: true
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: 1.24.x
|
|
|
|
- name: Create coverage directory
|
|
run: mkdir -p coverage
|
|
|
|
- name: Run tests for ${{ matrix.module }}
|
|
run: |
|
|
if [[ "${{ matrix.module }}" == "manager" ]]; then
|
|
sudo go test -v --race -covermode=atomic -coverprofile coverage/${{ matrix.module }}.out ./${{ matrix.module }}/...
|
|
else
|
|
go test -v --race -covermode=atomic -coverprofile coverage/${{ matrix.module }}.out ./${{ matrix.module }}/...
|
|
fi
|
|
|
|
- name: Upload coverage artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: coverage-${{ matrix.module }}
|
|
path: coverage/${{ matrix.module }}.out
|
|
retention-days: 1
|
|
|
|
upload-coverage:
|
|
runs-on: ubuntu-latest
|
|
needs: test
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Download all coverage artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
pattern: coverage-*
|
|
path: coverage/
|
|
merge-multiple: true
|
|
|
|
- name: Upload results to Codecov
|
|
uses: codecov/codecov-action@v4
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
files: ./coverage/*.out
|
|
codecov_yml_path: codecov.yml
|
|
verbose: true
|