refactor(docs): Move README and license files from the root to docs dir #42
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: KSM Dev CI/CD Pipeline | |
on: | |
pull_request: | |
branches: | |
- alpha | |
- "beta/*" | |
- dev | |
push: | |
branches: | |
- alpha | |
- "beta/*" | |
- dev | |
jobs: | |
build-and-test: | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- ubuntu | |
- macOS | |
go: | |
- 21 | |
- 22 | |
- 23 | |
runs-on: ${{ matrix.platform }}-latest | |
name: Build and Test on ${{ matrix.platform }} with Go 1.${{ matrix.go }}.x | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 # Fetch the last two commits for better context | |
- name: Cache Go modules | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/go-build | |
key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('**/go.mod', '**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go-${{ matrix.go }}- | |
- name: Set up Go environment | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.${{ matrix.go }}.x # Specify Go version based on the matrix | |
- name: Install dependencies | |
run: go mod tidy # Ensure dependencies are tidy | |
- name: Lint code | |
uses: golangci/[email protected] | |
with: | |
args: "--timeout=5m" | |
- name: Run unit tests | |
run: | | |
go test -v ./... | tee tests.log | |
continue-on-error: true # Continue to report coverage even if tests fail | |
- name: Generate Coverage Report | |
run: | | |
go test -coverprofile=coverage.out ./... | |
go tool cover -func=coverage.out | |
continue-on-error: false # Fail the job if coverage generation fails | |
- name: Upload Coverage Report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-report | |
path: coverage.out | |
- name: Upload Test Results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-results | |
path: tests.log |