From 9d11d9b7acec703de035ee27f9c1bbd1a2b29025 Mon Sep 17 00:00:00 2001 From: akwizgran <michael@briarproject.org> Date: Tue, 31 Dec 2024 14:38:04 +0000 Subject: [PATCH] Update CI config, remove trailing space from ldflags. --- .gitlab-ci.yml | 25 +++++-------------------- build-binary.py | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2b58127..0ec0d84 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,27 +21,14 @@ build: - docker build -t ${TEST_IMAGE} . - docker push $TEST_IMAGE -test_obfs4proxy: +test_lyrebird: stage: test script: - - docker run -v `pwd`/output:/opt/go-reproducer/output ${TEST_IMAGE} /bin/bash -c "./build-binary.py obfs4proxy && ./verify-binary.py obfs4proxy" + - docker run -v `pwd`/output:/opt/go-reproducer/output ${TEST_IMAGE} /bin/bash -c "./build-binary.py lyrebird && ./verify-binary.py lyrebird" allow_failure: true artifacts: paths: - - output/obfs4proxy - expire_in: 1 week - when: always - except: - - tags - -test_snowflake: - stage: test - script: - - docker run -v `pwd`/output:/opt/go-reproducer/output ${TEST_IMAGE} /bin/bash -c "./build-binary.py snowflake && ./verify-binary.py snowflake" - allow_failure: true - artifacts: - paths: - - output/snowflake + - output/lyrebird expire_in: 1 week when: always except: @@ -50,12 +37,10 @@ test_snowflake: test_tag: stage: test script: - - docker run -v `pwd`/output:/opt/go-reproducer/output ${TEST_IMAGE} /bin/bash -c "./verify-binary.py obfs4proxy ${CI_COMMIT_REF_NAME}" - - docker run -v `pwd`/output:/opt/go-reproducer/output ${TEST_IMAGE} /bin/bash -c "./verify-binary.py snowflake ${CI_COMMIT_REF_NAME}" + - docker run -v `pwd`/output:/opt/go-reproducer/output ${TEST_IMAGE} /bin/bash -c "./verify-binary.py lyrebird ${CI_COMMIT_REF_NAME}" artifacts: paths: - - output/obfs4proxy - - output/snowflake + - output/lyrebird expire_in: 1 week when: always only: diff --git a/build-binary.py b/build-binary.py index 3df8c54..ff714ab 100755 --- a/build-binary.py +++ b/build-binary.py @@ -122,7 +122,12 @@ def build_android_arch(tool, versions, env, clang_arch, ndk_arch, abi): output_file = os.path.abspath(os.path.join(os.path.curdir, tool)) go_flags = ['-asmflags', '-trimpath', '-o', output_file] - ld_flags = ["-ldflags=-w -s -extldflags=-pie %s" % get_ld_flags(versions)] + base_ld_flags = '-w -s -extldflags=-pie' + config_ld_flags = get_ld_flags(versions) + if config_ld_flags: + ld_flags = ['-ldflags', "%s %s" % (base_ld_flags, config_ld_flags)] + else: + ld_flags = ['-ldflags', base_ld_flags] repo_dir = get_repo_dir(versions) ex(['go', 'build', '-buildmode=pie'] + ld_flags + go_flags + [os.path.join('.', versions['build_path'])], env=env, cwd=repo_dir) @@ -166,7 +171,12 @@ def build_desktop_arch(tool, versions, platform, arch, goarch, goarm=None, outpu output_file = os.path.abspath(os.path.join(os.path.curdir, tool)) go_flags = ['-asmflags', '-trimpath', '-o', output_file] - ld_flags = ["-ldflags=-w -s %s" % get_ld_flags(versions)] + base_ld_flags = '-w -s' + config_ld_flags = get_ld_flags(versions) + if config_ld_flags: + ld_flags = ['-ldflags', "%s %s" % (base_ld_flags, config_ld_flags)] + else: + ld_flags = ['-ldflags', base_ld_flags] repo_dir = get_repo_dir(versions) ex(['go', 'build'] + ld_flags + go_flags + [build_path], env=env, cwd=repo_dir) shutil.copy(output_file, tool_path) -- GitLab