-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathTaskfile.yml
More file actions
71 lines (62 loc) · 2.29 KB
/
Taskfile.yml
File metadata and controls
71 lines (62 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Copyright AGNTCY Contributors (https://github.com/agntcy)
# SPDX-License-Identifier: Apache-2.0
version: "3"
tasks:
default:
cmd: echo "Run the main Taskfile instead of this one."
server:compile:
desc: Compile Directory server binaries
dir: ./server
vars:
GOOS: "{{ .GOOS | default OS }}"
GOARCH: "{{ .GOARCH | default ARCH }}"
BINARY_NAME: '{{ .BINARY_NAME | default "dir-apiserver" }}'
OUT_BINARY: '{{ .ROOT_DIR }}/.bin/{{ .BINARY_NAME }}'
LDFLAGS: "-s -w -extldflags -static {{ .VERSION_LDFLAGS }}"
cmds:
- CGO_ENABLED=0 GOOS={{.GOOS}} GOARCH={{.GOARCH}} go build -ldflags="{{ .LDFLAGS }}" -o "{{.OUT_BINARY}}" ./cmd/main.go
server:compile:all:
desc: Compile Directory server binaries for multiple platforms
cmds:
- for:
matrix:
OS: ["linux", "darwin"]
ARCH: ["amd64", "arm64"]
cmd: |
GOOS={{.ITEM.OS}} GOARCH={{.ITEM.ARCH}} BINARY_NAME=dir-apiserver-{{.ITEM.OS}}-{{.ITEM.ARCH}} task server:compile
server:build:
desc: Build Directory server image
cmds:
# NOTE: Always build the image locally to include changes which are not commited
- |
# NOTE: CI env var is set by default on GitHub Actions
if [ "${CI}" == "true" && docker image inspect {{.IMAGE_REPO}}/dir-apiserver:{{.IMAGE_TAG}} > /dev/null 2>&1 ];
then
echo "Image {{.IMAGE_REPO}}/dir-apiserver:{{.IMAGE_TAG}} already exists locally. Skipping build."
else
{{.BAKE_ENV}} docker buildx bake {{.IMAGE_BAKE_OPTS}} dir-apiserver
fi
server:start:
desc: Start local Directory server stack
dir: ./install/docker
env:
DIRECTORY_SERVER_PUBLICATION_SCHEDULER_INTERVAL: 1s
cmds:
- docker compose up -d --build --wait
server:start:debug:
desc: Start local Directory server stack in debug mode
dir: ./install/docker
env:
DIRECTORY_SERVER_PUBLICATION_SCHEDULER_INTERVAL: 1s
cmds:
- docker compose -f docker-compose.yml -f docker-compose.debug.yml up -d --build --wait
server:stop:
desc: Stop local Directory server stack
dir: ./install/docker
cmds:
- docker compose down
server:bench:
desc: Benchmark Directory server code
dir: ./server
cmds:
- go -C . test -run=^$ -bench=. ./...