make output/build artifact

This commit is contained in:
Jeffrey Paul 2019-10-24 08:23:29 -07:00
parent 8a029686d8
commit cf51968fb9
4 changed files with 25 additions and 10 deletions

View File

@ -5,6 +5,6 @@ jobs:
steps:
- checkout
- run: |
make test
# - store_artifacts:
# path: output
make dist
- store_artifacts:
path: output

1
.gitignore vendored
View File

@ -1 +1,2 @@
fediverse-archive
output/

View File

@ -1,9 +1,13 @@
VERSION := $(shell git rev-parse --short HEAD)
BUILDTIME := $(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
BUILDTIMEFILENAME := $(shell date -u '+%Y%m%d-%H%M%SZ')
BUILDUSER := $(shell whoami)
BUILDHOST := $(shell hostname -s)
BUILDARCH := $(shell uname -m)
FN := fediverse-archive
IMAGENAME := sneak/$(FN)
GOLDFLAGS += -X main.Version=$(VERSION)
GOLDFLAGS += -X main.Buildtime=$(BUILDTIME)
GOLDFLAGS += -X main.Builduser=$(BUILDUSER)@$(BUILDHOST)
@ -13,18 +17,25 @@ GOFLAGS = -ldflags "$(GOLDFLAGS)"
default: rundebug
rundebug: build
./fediverse-archive -debug
./$(FN) -debug
run: build
./fediverse-archvie
./$(FN)
build: ./fediverse-archive
build: ./$(FN)
./fediverse-archive: *.go
./$(FN): *.go
go build -o $@ $(GOFLAGS) .
fmt:
go fmt *.go
test:
docker build -t sneak/fediverse-archive .
test: build-docker-image
build-docker-image:
docker build -t $(IMAGENAME) .
dist: build-docker-image
-mkdir -p ./output
docker run --rm --entrypoint cat $(IMAGENAME) /bin/$(FN) > output/$(FN)
docker save $(IMAGENAME) | bzip2 > output/$(BUILDTIMEFILENAME).$(FN).tbz2

View File

@ -12,6 +12,9 @@ const mastodonIndexUrl = "https://instances.social/list.json?q%5Busers%5D=&q%5Bs
var foreverago = time.Now().Add((-1 * 86400 * 365 * 100) * time.Second)
// check with indices only hourly
var INDEX_CHECK_INTERVAL = time.Second * 60 * 60
// thank fuck for https://mholt.github.io/json-to-go/ otherwise
// this would have been a giant pain in the dick
type MastodonIndexResponse struct {
@ -105,7 +108,7 @@ func (i *InstanceLocator) Locate() {
log.Debug().Str("lastpleromaupdate", i.pleromaIndexLastRefresh.Format(time.RFC3339)).Send()
i.locateMastodon()
i.locatePleroma()
time.Sleep(30 * time.Second)
time.Sleep(120 * time.Second)
i.instanceReport()
}