Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions .github/workflows/build.yml

This file was deleted.

91 changes: 91 additions & 0 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: CI - Build Binary

on:
push:
branches: ["main"] # Main branch commits
tags: ['*.*.*'] # Release tags
pull_request:
paths:
- ".github/workflows/ci-build.yml"
- "**.go"
- "go.mod"
- "go.sum"
- "Makefile"
branches: ["main"] # PRs to main

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-full:
strategy:
fail-fast: false
matrix:
include:
- runner: gpuhealth-ubuntu-22.04-x86
os_name: ubuntu-22.04
arch: amd64

- runner: gpuhealth-ubuntu-22.04-arm
os_name: ubuntu-22.04
arch: arm64

- runner: gpuhealth-rhel-8-x86
os_name: rhel-8
arch: x86_64

- runner: gpuhealth-rhel-8-arm
os_name: rhel-8
arch: aarch64

name: Build (${{ matrix.os_name }}-${{ matrix.arch }})
runs-on: ${{ matrix.runner }}

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install build dependencies (Ubuntu)
if: contains(matrix.os_name, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y build-essential linux-headers-$(uname -r)

- name: Install build dependencies (RHEL)
if: contains(matrix.os_name, 'rhel')
run: |
sudo dnf update -y
sudo dnf groupinstall -y "Development Tools"
sudo dnf install -y gcc gcc-c++ make kernel-headers kernel-devel

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Build binary (native)
run: |
echo "Building gpuhealth binary on ${{ matrix.os_name }}-${{ matrix.arch }}..."
make gpuhealth || go build -o bin/gpuhealth ./cmd/gpuhealth

- name: Test binary
run: |
echo "Testing binary functionality..."
./bin/gpuhealth --version
./bin/gpuhealth --help
file ./bin/gpuhealth
ldd ./bin/gpuhealth || echo "Static binary or different libc"

- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: gpuhealth-binary-${{ matrix.os_name }}-${{ matrix.arch }}
path: bin/gpuhealth
if-no-files-found: warn
retention-days: 7
44 changes: 44 additions & 0 deletions .github/workflows/ci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CI - Lint & Code Quality

on:
push:
branches: ["**"] # Every commit on every branch

permissions:
contents: read
pull-requests: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
name: Lint & Code Quality
runs-on: ubuntu-22.04 # GitHub-hosted runner

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up Go
uses: actions/setup-go@v5
with:
cache: true
go-version-file: go.mod

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
args: --verbose --config=.golangci.yml

- name: Check go mod tidy
run: |
go mod tidy
if ! git diff --exit-code go.mod go.sum; then
echo "go.mod or go.sum is not tidy"
exit 1
fi
114 changes: 114 additions & 0 deletions .github/workflows/ci-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: CI - Package Building

on:
push:
branches: ["main"] # Main branch commits
tags: ['*.*.*'] # Release tags
pull_request:
paths:
- ".github/workflows/ci-packages.yml"
- "**.go"
- "go.mod"
- "go.sum"
- ".goreleaser_*.yaml"
- "deployments/packages/**"
branches: ["main"] # PRs to main

permissions:
contents: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
package:
strategy:
fail-fast: false
matrix:
include:
# Ubuntu DEB packages
- runner: gpuhealth-ubuntu-22.04-x86
os_name: ubuntu-22.04
arch: amd64
package_type: deb
goreleaser_config: .goreleaser_gpuhealth_deb_amd64.yaml

- runner: gpuhealth-ubuntu-22.04-arm
os_name: ubuntu-22.04
arch: arm64
package_type: deb
goreleaser_config: .goreleaser_gpuhealth_deb_arm64.yaml

# RHEL RPM packages
- runner: gpuhealth-rhel-8-x86
os_name: rhel-8
arch: x86_64
package_type: rpm
goreleaser_config: .goreleaser_gpuhealth_rpm_x86_64.yaml

- runner: gpuhealth-rhel-8-arm
os_name: rhel-8
arch: aarch64
package_type: rpm
goreleaser_config: .goreleaser_gpuhealth_rpm_aarch64.yaml

name: Build Package (${{ matrix.package_type }}-${{ matrix.os_name }}-${{ matrix.arch }})
runs-on: ${{ matrix.runner }}

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install build dependencies (Ubuntu)
if: contains(matrix.os_name, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y build-essential linux-headers-$(uname -r)

- name: Install build dependencies (RHEL)
if: contains(matrix.os_name, 'rhel')
run: |
sudo dnf update -y
sudo dnf groupinstall -y "Development Tools"
sudo dnf install -y gcc gcc-c++ make kernel-headers kernel-devel rpm-build

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Install GoReleaser
run: |
go install github.com/goreleaser/goreleaser/v2@latest
goreleaser --version

- name: Validate GoReleaser config
run: |
goreleaser check --config ${{ matrix.goreleaser_config }}

- name: Build package
run: |
echo "Building ${{ matrix.package_type }} package on ${{ matrix.os_name }}-${{ matrix.arch }}..."
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
goreleaser release --config ${{ matrix.goreleaser_config }} --clean
else
goreleaser release --snapshot --config ${{ matrix.goreleaser_config }} --clean # For branches and PRs
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: List generated packages
run: |
echo "Generated packages:"
find dist/ -name "*.deb" -o -name "*.rpm" | head -10

- name: Upload package artifacts
uses: actions/upload-artifact@v4
with:
name: package-${{ matrix.package_type }}-${{ matrix.os_name }}-${{ matrix.arch }}
path: "dist/"
if-no-files-found: warn
retention-days: 7
43 changes: 43 additions & 0 deletions .github/workflows/ci-unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI - Unit Tests

on:
push:
branches: ["**"] # Every commit on every branch

permissions:
contents: read
pull-requests: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
unit-test:
name: Unit Tests
runs-on: ubuntu-22.04

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up Go
uses: actions/setup-go@v5
with:
cache: true
go-version-file: go.mod

- name: Run unit tests
run: |
echo "Running unit tests for dev branch..."
KMSG_FILE_PATH=/dev/null ./scripts/tests-unit.sh

- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage-dev
path: coverage.txt
if-no-files-found: warn
retention-days: 1
41 changes: 0 additions & 41 deletions .github/workflows/golangci-lint.yml

This file was deleted.

Loading
Loading