Files
Nexus-Guard-Suite/.gitea/workflows/ci.yml
T
datadunia 3b5cec80af
NexusGuard CI/CD / server-core-test (push) Failing after 44s
NexusGuard CI/CD / server-core-build (push) Has been skipped
NexusGuard CI/CD / device-agent-test (push) Failing after 38s
NexusGuard CI/CD / device-agent-cross-build (amd64, linux) (push) Has been skipped
NexusGuard CI/CD / device-agent-cross-build (amd64, windows) (push) Has been skipped
NexusGuard CI/CD / device-agent-cross-build (arm64, linux) (push) Has been skipped
NexusGuard CI/CD / dashboard-test (push) Failing after 36s
NexusGuard CI/CD / dashboard-dist (push) Has been skipped
NexusGuard CI/CD / release (push) Has been skipped
ci: add GITEA_TOKEN for checkout authentication
2026-05-29 20:42:13 +07:00

178 lines
5.4 KiB
YAML

name: NexusGuard CI/CD
on:
push:
tags:
- 'v*'
- 'dev-*'
env:
BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }}
jobs:
# ──────────────────────────────────────────────
# TEST — all 3 components in parallel
# ──────────────────────────────────────────────
server-core-test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: apps/server-core
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
token: ${{ secrets.BUILD_TOKEN }}
# Tambahkan ini jika menggunakan self-hosted Gitea runner:
persist-credentials: true
- uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Test
run: go test ./... -tags dev -cover
device-agent-test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: apps/device-agent
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
token: ${{ secrets.BUILD_TOKEN }}
# Tambahkan ini jika menggunakan self-hosted Gitea runner:
persist-credentials: true
- uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Test
run: go test ./... -cover
dashboard-test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: apps/dashboard-ui
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
token: ${{ secrets.BUILD_TOKEN }}
# Tambahkan ini jika menggunakan self-hosted Gitea runner:
persist-credentials: true
- uses: actions/setup-node@v4
with:
node-version: '24'
- name: Install
run: npm ci || npm install
- name: Build
run: npm run build
# ──────────────────────────────────────────────
# BUILD — binaries + frontend dist
# ──────────────────────────────────────────────
server-core-build:
runs-on: ubuntu-latest
needs: server-core-test
defaults:
run:
working-directory: apps/server-core
steps:
- uses: actions/checkout@v4
with:
submodules: true
token: ${{ secrets.BUILD_TOKEN }}
# Tambahkan ini jika menggunakan self-hosted Gitea runner:
persist-credentials: true
- uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Build
run: go build -o bin/server-core .
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: server-core-linux-amd64
path: apps/server-core/bin/server-core
device-agent-cross-build:
runs-on: ubuntu-latest
needs: device-agent-test
strategy:
matrix:
goos: [linux, windows]
goarch: [amd64, arm64]
exclude:
- goos: windows
goarch: arm64
defaults:
run:
working-directory: apps/device-agent
steps:
- uses: actions/checkout@v4
with:
submodules: true
token: ${{ secrets.BUILD_TOKEN }}
# Tambahkan ini jika menggunakan self-hosted Gitea runner:
persist-credentials: true
- uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Build
env:
CGO_ENABLED: 0
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
EXT=""
if [ "${{ matrix.goos }}" = "windows" ]; then EXT=".exe"; fi
go build -o bin/nexus-device-agent-${{ matrix.goos }}-${{ matrix.goarch }}${EXT} .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: nexus-device-agent-${{ matrix.goos }}-${{ matrix.goarch }}
path: apps/device-agent/bin/nexus-device-agent-*
dashboard-dist:
runs-on: ubuntu-latest
needs: dashboard-test
defaults:
run:
working-directory: apps/dashboard-ui
steps:
- uses: actions/checkout@v4
with:
submodules: true
token: ${{ secrets.BUILD_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version: '24'
- name: Install
run: npm ci || npm install
- name: Build
run: npm run build
- name: Upload dist
uses: actions/upload-artifact@v4
with:
name: dashboard-ui-dist
path: apps/dashboard-ui/dist/
# ──────────────────────────────────────────────
# RELEASE — tag v* only
# ──────────────────────────────────────────────
release:
runs-on: ubuntu-latest
needs: [server-core-build, device-agent-cross-build, dashboard-dist]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.BUILD_TOKEN }}
- name: Echo release step
run: echo "Release step for Gitea"