Compare commits
1 Commits
de88b2773c
...
v0.1.0
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0e3a14d69c |
103
.gitea/workflows/build.yml
Normal file
103
.gitea/workflows/build.yml
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
name: Build Quasar SPA and Go Backend for lightController
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: windows
|
||||||
|
arch: amd64
|
||||||
|
ext: .exe
|
||||||
|
- os: linux
|
||||||
|
arch: amd64
|
||||||
|
ext: ""
|
||||||
|
- os: linux
|
||||||
|
arch: arm64
|
||||||
|
ext: ""
|
||||||
|
- os: linux
|
||||||
|
arch: arm
|
||||||
|
arm_version: 6
|
||||||
|
ext: ""
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set ip Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '20'
|
||||||
|
|
||||||
|
- name: Install dependecies
|
||||||
|
run: npm install
|
||||||
|
|
||||||
|
- name: Install Quasar CLI
|
||||||
|
run: npm install -g @quasar/cli
|
||||||
|
|
||||||
|
- name: Build Quasar SPA
|
||||||
|
run: quasar build
|
||||||
|
|
||||||
|
- name: Ensure latest Go is installed in /data/go
|
||||||
|
run: |
|
||||||
|
export GOROOT=/data/go/go
|
||||||
|
export PATH=$GOROOT/bin:$PATH
|
||||||
|
export GOCACHE=/data/gocache
|
||||||
|
export GOMODCACHE=/data/gomodcache
|
||||||
|
mkdir -p $GOCACHE $GOMODCACHE
|
||||||
|
|
||||||
|
if [ ! -x "$GOROOT/bin/go" ]; then
|
||||||
|
echo "Go not found in $GOROOT, downloading latest stable..."
|
||||||
|
|
||||||
|
GO_VERSION=$(curl -s https://go.dev/VERSION?m=text | head -n1)
|
||||||
|
echo "Latest version is $GO_VERSION"
|
||||||
|
|
||||||
|
mkdir -p /data/go
|
||||||
|
curl -sSL "https://go.dev/dl/${GO_VERSION}.linux-amd64.tar.gz" -o /tmp/go.tar.gz
|
||||||
|
tar -C /data/go -xzf /tmp/go.tar.gz
|
||||||
|
else
|
||||||
|
echo "Using cached Go from $GOROOT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
go version
|
||||||
|
|
||||||
|
- name: Go Mod Tidy & Download
|
||||||
|
working-directory: ./backend
|
||||||
|
run: |
|
||||||
|
export GOROOT=/data/go/go
|
||||||
|
export PATH=$GOROOT/bin:$PATH
|
||||||
|
export GOCACHE=/data/gocache
|
||||||
|
export GOMODCACHE=/data/gomodcache
|
||||||
|
mkdir -p $GOCACHE $GOMODCACHE
|
||||||
|
go mod tidy -v
|
||||||
|
go mod download
|
||||||
|
|
||||||
|
- name: Build go backend binary
|
||||||
|
working-directory: ./backend
|
||||||
|
run: |
|
||||||
|
export GOROOT=/data/go/go
|
||||||
|
export PATH=$GOROOT/bin:$PATH
|
||||||
|
export GOCACHE=/data/gocache
|
||||||
|
export GOMODCACHE=/data/gomodcache
|
||||||
|
mkdir -p $GOCACHE $GOMODCACHE
|
||||||
|
|
||||||
|
OUTPUT="../server-${{ matrix.goos }}-${{ matrix.goarch }}"
|
||||||
|
if [ "${{ matrix.goos }}" == "windows" ]; then
|
||||||
|
OUTPUT="${OUTPUT}.exe"
|
||||||
|
fi
|
||||||
|
|
||||||
|
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags="-s -w" -trimpath -o "$OUTPUT" main.go
|
||||||
|
|
||||||
|
- name: Upload build artifacts
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: lightcontroller-${{ matrix.goos }}-${{ matrix.goarch }}
|
||||||
|
path: |
|
||||||
|
./dist/spa
|
||||||
|
server-${{ matrix.goos }}-${{ matrix.goarch }}${{ (matrix.goos == 'windows' && '.exe') || '' }}
|
71
.github/workflows/build.yml
vendored
71
.github/workflows/build.yml
vendored
@@ -1,71 +0,0 @@
|
|||||||
name: Build Quasar SPA and Go Backend for lightController
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
goos: [linux, windows]
|
|
||||||
goarch: [amd64, arm, arm64]
|
|
||||||
exclude:
|
|
||||||
- goos: windows
|
|
||||||
goarch: arm
|
|
||||||
- goos: windows
|
|
||||||
goarch: arm64
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set ip Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: '20'
|
|
||||||
|
|
||||||
- name: Install dependecies
|
|
||||||
run: npm install
|
|
||||||
|
|
||||||
- name: Install Quasar CLI
|
|
||||||
run: npm install -g @quasar/cli
|
|
||||||
|
|
||||||
- name: Build Quasar SPA
|
|
||||||
run: quasar build
|
|
||||||
|
|
||||||
- name: Set up Go
|
|
||||||
uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: '1.24.0'
|
|
||||||
cache-dependency-path: backend/go.sum
|
|
||||||
|
|
||||||
- name: Set up Git credentials for private modules
|
|
||||||
run: |
|
|
||||||
git config --global url."https://oauth2:${{ secrets.GH_PAT }}@github.com".insteadOf "https://github.com"
|
|
||||||
env:
|
|
||||||
GH_PAT_FOR_MODULES: ${{ secrets.GH_PAT }}
|
|
||||||
|
|
||||||
- name: Go Mod Tidy & Download
|
|
||||||
working-directory: ./backend
|
|
||||||
run: go mod tidy -v
|
|
||||||
|
|
||||||
- name: Build go backend binary
|
|
||||||
working-directory: ./backend
|
|
||||||
run: |
|
|
||||||
if [ "${{ matrix.goos }}" == "windows" ]; then
|
|
||||||
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags="-s -w" -trimpath -o ../server-${{ matrix.goos }}-${{ matrix.goarch }}.exe main.go
|
|
||||||
else
|
|
||||||
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags="-s -w" -trimpath -o ../server-${{ matrix.goos }}-${{ matrix.goarch }} main.go
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Upload build artifacts
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: lightcontroller-${{ matrix.goos }}-${{ matrix.goarch }}
|
|
||||||
path: |
|
|
||||||
./dist/spa
|
|
||||||
server-${{ matrix.goos }}-${{ matrix.goarch }}${{ (matrix.goos == 'windows' && '.exe') || '' }}
|
|
Reference in New Issue
Block a user