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 from invoke import Context, task
TARGETS = [ TARGETS = [
"aix/ppc64",
"darwin/amd64", "darwin/amd64",
"dragonfly/amd64",
"freebsd/386", "freebsd/386",
"freebsd/amd64", "freebsd/amd64",
"freebsd/arm", "freebsd/arm",
"freebsd/arm64", "freebsd/arm64",
"illumos/amd64",
"linux/386", "linux/386",
"linux/amd64", "linux/amd64",
"linux/arm", "linux/arm",
"linux/arm64", "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/386",
"windows/amd64", "windows/amd64",
"windows/arm", "windows/arm",
@ -51,13 +28,20 @@ def tag(context, tag):
@task @task
def build(context): def build(context, version_name):
"""Cross-platform build""" """Cross-platform build"""
with ThreadPoolExecutor() as pool: with ThreadPoolExecutor() as pool:
for target in TARGETS: for target in TARGETS:
os, arch = target.split("/") os, arch = target.split("/")
binary_name = f"insee-{os}-{arch}" binary_name = f"insee-{version_name}-{os}-{arch}"
if os == "windows": if os == "windows":
binary_name += ".exe" binary_name += ".exe"
binary_path = Path(__file__).resolve(strict=True).parent / "dist" / binary_name binary_path = (
pool.submit(context.run, f"go build -o {binary_path}", env={"GOOS": os, "GOARCH": arch}, echo=True) 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,
)