diff options
author | Matt Clay <matt@mystile.com> | 2024-09-10 00:06:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-10 00:06:36 +0200 |
commit | 31d73b06455a30ee397303f97920384fe0f17536 (patch) | |
tree | d8ef1dcc5ca6db247bac10ee7facfa0e1d228483 | |
parent | ansible-test - Update base/default containers (#83930) (diff) | |
download | ansible-31d73b06455a30ee397303f97920384fe0f17536.tar.xz ansible-31d73b06455a30ee397303f97920384fe0f17536.zip |
Replace binary_modules Makefile with Python script (#83925)
Also update the platform list:
* Remove linux ppc64le
* Add darwin arm64
-rw-r--r-- | test/integration/targets/binary_modules/Makefile | 18 | ||||
-rwxr-xr-x | test/integration/targets/binary_modules/build.py | 41 |
2 files changed, 41 insertions, 18 deletions
diff --git a/test/integration/targets/binary_modules/Makefile b/test/integration/targets/binary_modules/Makefile deleted file mode 100644 index 4f485a2de6..0000000000 --- a/test/integration/targets/binary_modules/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -.PHONY: all clean - -all: - # Compiled versions of these binary modules are available at the url below. - # This avoids a dependency on go and keeps the binaries out of our git repository. - # https://ci-files.testing.ansible.com/test/integration/roles/test_binary_modules/ - cd library; \ - GOOS=linux GOARCH=amd64 go build -o helloworld_linux_x86_64 helloworld.go; \ - GOOS=linux GOARCH=arm64 go build -o helloworld_linux_aarch64 helloworld.go; \ - GOOS=linux GOARCH=ppc64le go build -o helloworld_linux_ppc64le helloworld.go; \ - GOOS=windows GOARCH=amd64 go build -o helloworld_win32nt_64-bit.exe helloworld.go; \ - GOOS=darwin GOARCH=amd64 go build -o helloworld_darwin_x86_64 helloworld.go; \ - GOOS=freebsd GOARCH=amd64 go build -o helloworld_freebsd_amd64 helloworld.go; \ - GOOS=freebsd GOARCH=arm64 go build -o helloworld_freebsd_arm64 helloworld.go; \ - echo done - -clean: - rm -f library/helloworld_* diff --git a/test/integration/targets/binary_modules/build.py b/test/integration/targets/binary_modules/build.py new file mode 100755 index 0000000000..7cb1ae7091 --- /dev/null +++ b/test/integration/targets/binary_modules/build.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python +""" +Compile binary modules for this test for access from S3 at: +https://ci-files.testing.ansible.com/test/integration/roles/test_binary_modules/ +This avoids a test dependency on go and keeps the binaries out of the git repository. +""" + +from __future__ import annotations + +import os +import pathlib +import shlex +import subprocess + + +def main() -> None: + library = pathlib.Path(__file__).parent / 'library' + + # NOTE: The value of `NAME` must be `ansible_architecture` for the target system, plus any required extension. + builds = ( + dict(GOOS='linux', GOARCH='amd64', NAME='linux_x86_64'), + dict(GOOS='linux', GOARCH='arm64', NAME='linux_aarch64'), + dict(GOOS='windows', GOARCH='amd64', NAME='win32nt_64-bit.exe'), + dict(GOOS='darwin', GOARCH='amd64', NAME='darwin_x86_64'), + dict(GOOS='darwin', GOARCH='arm64', NAME='darwin_arm64'), + dict(GOOS='freebsd', GOARCH='amd64', NAME='freebsd_amd64'), + dict(GOOS='freebsd', GOARCH='arm64', NAME='freebsd_arm64'), + ) + + for build in builds: + name = build.pop('NAME') + cmd = ['go', 'build', '-o', f'helloworld_{name}', 'helloworld.go'] + env = os.environ.copy() + env.update(build) + + print(f'==> {shlex.join(f"{k}={v}" for k, v in build.items())} {shlex.join(cmd)}') + subprocess.run(cmd, env=env, cwd=library, check=True, text=True) + + +if __name__ == '__main__': + main() |