Reduce number of build targets

This commit is contained in:
Gabriel Augendre 2021-08-19 11:09:04 +02:00
parent 883658acf3
commit c921213b4f

View file

@ -4,38 +4,15 @@ from pathlib import Path
from invoke import Context, task
TARGETS = [
"aix/ppc64",
"darwin/amd64",
"dragonfly/amd64",
"freebsd/386",
"freebsd/amd64",
"freebsd/arm",
"freebsd/arm64",
"illumos/amd64",
"linux/386",
"linux/amd64",
"linux/arm",
"linux/arm64",
"linux/ppc64",
"linux/ppc64le",
"linux/mips",
"linux/mipsle",
"linux/mips64",
"linux/mips64le",
"linux/riscv64",
"linux/s390x",
"netbsd/386",
"netbsd/amd64",
"netbsd/arm",
"netbsd/arm64",
"openbsd/386",
"openbsd/amd64",
"openbsd/arm",
"openbsd/arm64",
"plan9/386",
"plan9/amd64",
"plan9/arm",
"solaris/amd64",
"windows/386",
"windows/amd64",
"windows/arm",
@ -51,13 +28,20 @@ def tag(context, tag):
@task
def build(context):
def build(context, version_name):
"""Cross-platform build"""
with ThreadPoolExecutor() as pool:
for target in TARGETS:
os, arch = target.split("/")
binary_name = f"insee-{os}-{arch}"
binary_name = f"insee-{version_name}-{os}-{arch}"
if os == "windows":
binary_name += ".exe"
binary_path = Path(__file__).resolve(strict=True).parent / "dist" / binary_name
pool.submit(context.run, f"go build -o {binary_path}", env={"GOOS": os, "GOARCH": arch}, echo=True)
binary_path = (
Path(__file__).resolve(strict=True).parent / "dist" / binary_name
)
pool.submit(
context.run,
f"go build -o {binary_path}",
env={"GOOS": os, "GOARCH": arch},
echo=True,
)