Skip to content

Commit 5d7c1ec

Browse files
committed
Merge remote-tracking branch 'kong/main'
2 parents 6c2dade + 68773cb commit 5d7c1ec

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

.github/workflows/release.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- '*'
6+
jobs:
7+
build:
8+
runs-on: "ubuntu-latest"
9+
container: "debian:10.3"
10+
strategy:
11+
matrix:
12+
node-version: [14]
13+
steps:
14+
- name: Set up Go 1.18.x
15+
uses: actions/setup-go@v2
16+
with:
17+
go-version: 1.18.x
18+
id: go
19+
20+
- name: Instasll tools
21+
shell: bash
22+
run: "apt update && apt install make curl gcc ca-certificates zip git -y"
23+
24+
- name: Install gox
25+
run: go install github.com/mitchellh/gox@master
26+
27+
- name: Instasll node apt repo
28+
shell: bash
29+
run: "curl -sL https://deb.nodesource.com/setup_14.x | bash -"
30+
31+
- name: Instasll node
32+
shell: bash
33+
run: "apt install nodejs -y"
34+
35+
- name: Step pnpm
36+
uses: pnpm/[email protected]
37+
with:
38+
version: latest
39+
40+
- name: Checkout
41+
uses: actions/checkout@v2
42+
43+
- name: Build frontend
44+
run: make build-frontend
45+
46+
- name: Build go binary
47+
shell: bash
48+
run: gox -osarch='darwin/arm64 darwin/amd64 windows/arm64 windows/amd64 linux/arm64 linux/amd64' -ldflags="
49+
-X main.Version=$(git describe --tags $(git rev-parse HEAD))
50+
-X main.Commit=$(git rev-parse HEAD)" ./
51+
52+
- name: compress go binary
53+
shell: bash
54+
run: for i in edgeRec_*; do zip "$(echo $i | sed 's/\..*//').zip" $i; done
55+
56+
- name: Upload Release
57+
uses: softprops/action-gh-release@v1
58+
with:
59+
files: edgeRec*.zip
60+
draft: true

main.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"context"
55
"embed"
6+
"flag"
67
"github.com/auxten/edgeRec/example/movielens"
78
nn "github.com/auxten/edgeRec/nn/neural_network"
89
rcmd "github.com/auxten/edgeRec/recommend"
@@ -12,7 +13,19 @@ import (
1213
//go:embed frontend/website/*
1314
var f embed.FS
1415

16+
var verFlag = flag.Bool("v", false, "show binary version")
17+
18+
var Version = "unknown-version"
19+
var Commit = "unknown-commit"
20+
1521
func main() {
22+
flag.Parse()
23+
if *verFlag {
24+
log.Println("Version: ", Version)
25+
log.Println("Commit: ", Commit)
26+
return
27+
}
28+
1629
var (
1730
recSys = &movielens.RecSysImpl{
1831
DataPath: "movielens.db",

0 commit comments

Comments
 (0)