Skip to content

Commit

Permalink
✨ justify versioning stuff a bit to match arctic's scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaNecron committed Mar 23, 2024
1 parent 3a1ff64 commit bff3081
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ HASH = $(shell git rev-parse --short HEAD)
DATE = $(shell date +%s)
TAG = $(shell git describe --tags --always --abbrev=0 --match="v[0-9]*.[0-9]*.[0-9]*" 2> /dev/null)
VERSION = $(shell echo "${TAG}" | sed 's/^.//')
VARIANT = local

DEFAULT_ENV = GOOS=linux

Expand Down
24 changes: 17 additions & 7 deletions build/build.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
package build

import "strconv"
import (
"fmt"
"runtime"
"strconv"
"time"
)

var (
Version = "dev"
Hash = "unknown"
_date = "0"
Date = 0
Variant = "unknown"
Version = "n/a"
Hash = "n/a"
_date = "0"
Date int64 = 0
Tag = "dev"
)

func init() {
d, e := strconv.Atoi(_date)
if e != nil {
return
}
Date = d
Date = int64(d)
Version = Tag
if Tag == "dev" {
Version = fmt.Sprintf("%s#%s@%s", Tag, Hash, time.Unix(Date, 0).Format(time.RFC3339))
}
Version = fmt.Sprintf("%s with %s", Version, runtime.Version())
}
3 changes: 1 addition & 2 deletions worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"cmp"
"context"
"errors"
"fmt"
"github.com/ArcticOJ/igloo/v0/build"
"github.com/ArcticOJ/igloo/v0/config"
"github.com/ArcticOJ/igloo/v0/logger"
Expand Down Expand Up @@ -82,7 +81,7 @@ func (w *JudgeWorker) Connect() {
Os: sys.OS,
Memory: sys.Memory,
Parallelism: uint32(config.Config.Parallelism),
Version: fmt.Sprintf("%s/%s", build.Version, build.Variant),
Version: build.Version,
}
for name, rt := range Runtimes {
j.Runtimes = append(j.Runtimes, &pb.Judge_Runtime{
Expand Down

0 comments on commit bff3081

Please sign in to comment.