diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2b5812702a7b6f6e1e75c0ac79d2dfc2f63cdceb..0ec0d84dabf3d83f02056318bcd11afd7a3c2642 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 3df8c54b7173ceb4c817f88a4adc953bcb061014..ff714ab02486ce48c8f6312f4fb75adcbdbf5e0b 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)