3 Commits

Author SHA1 Message Date
t
da4699fe08 updated gitignore and ci/cd pipeline
All checks were successful
Build and Release Core / Test and Build (push) Successful in 3m34s
2026-04-02 14:36:04 -04:00
t
d881051f3e updated to streamline build
Some checks failed
Build and Release Core / Test and Build (push) Failing after 3m19s
2026-04-02 14:28:40 -04:00
t
b14072ddb2 removed test data
Some checks failed
Build and Release Core / Test and Build (push) Has been cancelled
2026-04-02 14:19:17 -04:00
3 changed files with 54 additions and 12 deletions

View File

@@ -2,15 +2,16 @@ name: Build and Release Core
on: on:
push: push:
branches: [ main ]
tags: tags:
- 'v*' # Only trigger when you push a version tag (e.g., v1.0.0) - 'v*'
pull_request: pull_request:
branches: [ main ] # Run tests on PRs, but don't build release binaries branches: [ main ]
jobs: jobs:
build: build:
name: Test and Build name: Test and Build
runs-on: ubuntu-latest # This runs on your Gitea act_runner runs-on: ubuntu-latest
steps: steps:
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -18,20 +19,27 @@ jobs:
- name: Setup Go - name: Setup Go
uses: actions/setup-go@v4 uses: actions/setup-go@v4
with: with:
go-version: '1.26' # Update to match your go.mod if different go-version: '1.26.x'
- name: Cache Go Modules and Build Cache
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run Tests - name: Run Tests
run: go test ./... -v run: go test ./... -v
- name: Build Binaries - name: Build Binaries
# Only run the build steps if this was triggered by a tag push
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
run: | run: |
VERSION=${GITHUB_REF_NAME} VERSION=${GITHUB_REF_NAME}
COMMIT=$(echo ${GITHUB_SHA} | cut -c1-7) COMMIT=$(echo ${GITHUB_SHA} | cut -c1-7)
LDFLAGS="-X 'main.BuildVersion=$VERSION' -X 'main.BuildCommit=$COMMIT'" LDFLAGS="-X 'main.BuildVersion=$VERSION' -X 'main.BuildCommit=$COMMIT'"
mkdir -p bin mkdir -p bin
@@ -45,9 +53,12 @@ jobs:
echo "Building Windows (amd64)..." echo "Building Windows (amd64)..."
GOOS=windows GOARCH=amd64 go build -ldflags="$LDFLAGS" -o bin/rr-windows-amd64.exe ./cmd/rr/main.go GOOS=windows GOARCH=amd64 go build -ldflags="$LDFLAGS" -o bin/rr-windows-amd64.exe ./cmd/rr/main.go
- name: Upload Artifacts - name: Create Release and Upload Binaries
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v4 uses: softprops/action-gh-release@v1
with: with:
name: riskrancher-core-binaries files: bin/*
path: bin/ name: Release ${{ github.ref_name }}
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}

1
.gitignore vendored
View File

@@ -16,7 +16,6 @@ vendor/
# RiskRancher Compiled Binaries # RiskRancher Compiled Binaries
# ========================= # =========================
# Ignore the local builds so you don't accidentally push a 20MB executable # Ignore the local builds so you don't accidentally push a 20MB executable
rr
rr.exe rr.exe
# ========================= # =========================

32
cmd/rr/main.go Normal file
View File

@@ -0,0 +1,32 @@
package main
import (
"log"
"net/http"
"epigas.gitea.cloud/RiskRancher/core/pkg/datastore"
"epigas.gitea.cloud/RiskRancher/core/pkg/server"
"epigas.gitea.cloud/RiskRancher/core/ui"
)
var (
BuildVersion = "dev"
BuildCommit = "none"
)
func main() {
ui.SetVersionInfo(BuildVersion, BuildCommit)
db := datastore.InitDB("./data/RiskRancher.db")
defer db.Close()
store := datastore.NewSQLiteStore(db)
app := server.NewApp(store)
server.RegisterRoutes(app)
log.Println("🤠 RiskRancher Core Server running on http://localhost:8080")
log.Fatal(http.ListenAndServe(":8080", app.Router))
}