From 3c42ea99bc1974b8735d1f12574bae8d4267abd9 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Tue, 28 Jul 2020 03:25:52 +0800 Subject: [PATCH 1/5] Store artifacts --- .circleci/config.yml | 55 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 408fe92..dc89667 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -113,7 +113,21 @@ jobs: command: pip install -r ./build_configs/linux/requirements.txt - run: name: Build with build.spec - command: pyinstaller ./build_configs/linux/build.spec + command: | + export CIRCLE_SHORT_SHA1=$(eval echo $CIRCLE_SHA1 | cut -c -7) + export BUILD_FILE_NAME=eth2deposit-cli-${CIRCLE_SHORT_SHA1}-linux-amd64; + mkdir ${BUILD_FILE_NAME}; + pyinstaller --distpath ./${BUILD_FILE_NAME} ./build_configs/linux/build.spec; + - run: + name: Compress the file + command: | + export CIRCLE_SHORT_SHA1=$(eval echo $CIRCLE_SHA1 | cut -c -7) + export BUILD_FILE_NAME=eth2deposit-cli-${CIRCLE_SHORT_SHA1}-linux-amd64; + tar -zcvf ${BUILD_FILE_NAME}.tar.gz ./${BUILD_FILE_NAME}; + mkdir /tmp/artifacts; + cp ${BUILD_FILE_NAME}.tar.gz /tmp/artifacts; + - store_artifacts: + path: /tmp/artifacts build-windows: executor: name: win/default @@ -125,10 +139,28 @@ jobs: command: pip install -r ./build_configs/windows/requirements.txt - run: name: Build with build.spec - command: pyinstaller ./build_configs/windows/build.spec + command: | + $CIRCLE_SHORT_SHA1 = $env:CIRCLE_SHA1.substring(0,7) + $BUILD_FILE_NAME = "eth2deposit-cli-" + $CIRCLE_SHORT_SHA1 + "-windows-amd64" + mkdir $BUILD_FILE_NAME + $BUILD_FILE_NAME_PATH = ".\" + $BUILD_FILE_NAME + pyinstaller --distpath $BUILD_FILE_NAME_PATH .\build_configs\windows\build.spec + - run: + name: Compress the file + command: | + $CIRCLE_SHORT_SHA1 = $env:CIRCLE_SHA1.substring(0,7) + $BUILD_FILE_NAME = "eth2deposit-cli-" + $CIRCLE_SHORT_SHA1 + "-windows-amd64" + $BUILD_FILE_NAME_PATH = ".\" + $BUILD_FILE_NAME + $ZIP_FILE_NAME = $BUILD_FILE_NAME + ".zip" + Compress-Archive -Path $BUILD_FILE_NAME_PATH -DestinationPath $ZIP_FILE_NAME + mkdir \tmp\artifacts + copy $ZIP_FILE_NAME \tmp\artifacts\ + - store_artifacts: + path: /tmp/artifacts build-macos: macos: - xcode: 11.3.0 + xcode: 11.3.0 + working_directory: ~/repo steps: - run: xcodebuild -version - run: python3 --version @@ -138,7 +170,22 @@ jobs: command: pip3 install -r ./build_configs/macos/requirements.txt - run: name: Build with build.spec - command: pyinstaller ./build_configs/macos/build.spec + command: | + export CIRCLE_SHORT_SHA1=$(eval echo $CIRCLE_SHA1 | cut -c -7) + export BUILD_FILE_NAME=eth2deposit-cli-${CIRCLE_SHORT_SHA1}-darwin-amd64; + mkdir ${BUILD_FILE_NAME}; + pyinstaller --distpath ./${BUILD_FILE_NAME} ./build_configs/macos/build.spec; + - run: + name: Compress the file + command: | + export CIRCLE_SHORT_SHA1=$(eval echo $CIRCLE_SHA1 | cut -c -7) + export BUILD_FILE_NAME=eth2deposit-cli-${CIRCLE_SHORT_SHA1}-darwin-amd64; + tar -zcvf ${BUILD_FILE_NAME}.tar.gz ./${BUILD_FILE_NAME}; + mkdir /tmp/artifacts; + cp ${BUILD_FILE_NAME}.tar.gz /tmp/artifacts; + - store_artifacts: + path: /tmp/artifacts + workflows: version: 2.1 all_test: From 2572ec27ee04fb5654f4afa5f747001add23053a Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Tue, 28 Jul 2020 12:14:07 +0800 Subject: [PATCH 2/5] Try to use venv to avoid `poetry` dependencies conflict (with Ubuntu image) --- .circleci/config.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index dc89667..160adff 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -110,14 +110,16 @@ jobs: - checkout - run: name: Install building requirements on Linux - command: pip install -r ./build_configs/linux/requirements.txt + command: | + python3 -m venv venv; + ./venv/bin/python -m pip install -r ./build_configs/linux/requirements.txt; - run: name: Build with build.spec command: | export CIRCLE_SHORT_SHA1=$(eval echo $CIRCLE_SHA1 | cut -c -7) export BUILD_FILE_NAME=eth2deposit-cli-${CIRCLE_SHORT_SHA1}-linux-amd64; mkdir ${BUILD_FILE_NAME}; - pyinstaller --distpath ./${BUILD_FILE_NAME} ./build_configs/linux/build.spec; + ./venv/bin/pyinstaller --distpath ./${BUILD_FILE_NAME} ./build_configs/linux/build.spec; - run: name: Compress the file command: | From e31ff99e23a06554dcc4b10c261662f0c7c9503d Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Tue, 28 Jul 2020 12:57:24 +0800 Subject: [PATCH 3/5] Downgrade to `ubuntu-1604:202007-01` image --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 160adff..476a3d2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -103,8 +103,8 @@ jobs: name: Run deposit script on Windows" command: python ./test_deposit_script.py build-linux: - docker: - - image: circleci/python:3.7 + machine: + image: ubuntu-1604:202007-01 working_directory: ~/repo steps: - checkout From d370605cd04c641e5d57c27b3a6041922cec7f88 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Tue, 28 Jul 2020 13:07:07 +0800 Subject: [PATCH 4/5] Rebuild Python with --enable-shared --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 476a3d2..14a9a67 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -111,6 +111,7 @@ jobs: - run: name: Install building requirements on Linux command: | + ./configure --enable-shared --prefix=/opt/python LDFLAGS=-Wl,-rpath=/opt/python/lib; python3 -m venv venv; ./venv/bin/python -m pip install -r ./build_configs/linux/requirements.txt; - run: From 18b7a3c80fd755c6935b6cf54f6ee3e63f94d700 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Tue, 28 Jul 2020 13:24:42 +0800 Subject: [PATCH 5/5] Sadly install 3.7.5 with `--enable-shared` flag --- .circleci/config.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 14a9a67..86cc0cf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -111,16 +111,17 @@ jobs: - run: name: Install building requirements on Linux command: | - ./configure --enable-shared --prefix=/opt/python LDFLAGS=-Wl,-rpath=/opt/python/lib; - python3 -m venv venv; - ./venv/bin/python -m pip install -r ./build_configs/linux/requirements.txt; + env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.7.5; + pyenv global 3.7.5; + pip install -r ./build_configs/linux/requirements.txt; - run: name: Build with build.spec command: | export CIRCLE_SHORT_SHA1=$(eval echo $CIRCLE_SHA1 | cut -c -7) export BUILD_FILE_NAME=eth2deposit-cli-${CIRCLE_SHORT_SHA1}-linux-amd64; mkdir ${BUILD_FILE_NAME}; - ./venv/bin/pyinstaller --distpath ./${BUILD_FILE_NAME} ./build_configs/linux/build.spec; + pyenv global 3.7.5; + pyinstaller --distpath ./${BUILD_FILE_NAME} ./build_configs/linux/build.spec; - run: name: Compress the file command: |