version: 2.1 tox_common: &tox_common working_directory: ~/repo steps: - checkout - restore_cache: key: tox-deps3-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}-{{ checksum "Makefile" }} - run: name: install dependencies command: pip install --user tox - run: name: run tox command: ~/.local/bin/tox - save_cache: paths: - .tox - ./eggs key: tox-deps3-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}-{{ checksum "Makefile" }} orbs: win: circleci/windows@2.2.0 # The Windows orb give you everything you need to start using the Windows executor. jobs: # Job(s) with Linux OS venv_build: docker: - image: circleci/python:3.8 working_directory: ~/repo steps: - checkout - restore_cache: key: venv-deps2-{{ arch }}-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}-{{ checksum "Makefile" }} - run: name: Install requirements in venv command: make venv_build_test - save_cache: key: venv-deps2-{{ arch }}-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}-{{ checksum "Makefile" }} paths: - ./venv venv_pytest: docker: - image: circleci/python:3.8 working_directory: ~/repo steps: - checkout - restore_cache: key: venv-deps2-{{ arch }}-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}-{{ checksum "Makefile" }} - run: name: Run tests with venv command: make venv_test - store_artifacts: path: test-reports/ destination: tr1 - store_test_results: path: test-reports/ venv_lint: docker: - image: circleci/python:3.8 working_directory: ~/repo steps: - checkout - restore_cache: key: venv-deps2-{{ arch }}-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}-{{ checksum "Makefile" }} - run: name: Run linter with venv command: make venv_lint tox-py37-core: <<: *tox_common docker: - image: circleci/python:3.7 environment: TOXENV: py37-core tox-py38-core: <<: *tox_common docker: - image: circleci/python:3.8 environment: TOXENV: py38-core tox-py37-script: <<: *tox_common docker: - image: circleci/python:3.7 environment: TOXENV: py37-script tox-py38-script: <<: *tox_common docker: - image: circleci/python:3.8 environment: TOXENV: py38-script # Job(s) with Windows OS win-py37-script: executor: name: win/default shell: powershell.exe steps: - checkout - run: name: Install testing requirements on Windows command: python -m pip install -r requirements_test.txt - run: name: Run deposit script on Windows" command: python ./test_deposit_script.py build-linux-amd64: machine: image: ubuntu-1604:202007-01 working_directory: ~/repo steps: - checkout - run: name: Install building requirements on Linux command: | 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 PYTHONHASHSEED=42 export CIRCLE_SHORT_SHA1=$(eval echo $CIRCLE_SHA1 | cut -c -7) export BUILD_FILE_NAME=staking_deposit-cli-${CIRCLE_SHORT_SHA1}-linux-amd64; mkdir ${BUILD_FILE_NAME}; pyenv global 3.7.5; pyinstaller --distpath ./${BUILD_FILE_NAME} ./build_configs/linux/build.spec; - run: name: Test executable binaries command: | export PYTHONHASHSEED=42 export CIRCLE_SHORT_SHA1=$(eval echo $CIRCLE_SHA1 | cut -c -7) export BUILD_FILE_NAME=staking_deposit-cli-${CIRCLE_SHORT_SHA1}-linux-amd64; export TEST_FOLDER_NAME=TMP_TEST_FOLDER mkdir ${TEST_FOLDER_NAME} cp -r ${BUILD_FILE_NAME} ${TEST_FOLDER_NAME} cp test_binary_script.py ${TEST_FOLDER_NAME} cd ${TEST_FOLDER_NAME} python test_binary_script.py ./${BUILD_FILE_NAME}; - run: name: Compress the file command: | export PYTHONHASHSEED=42 export CIRCLE_SHORT_SHA1=$(eval echo $CIRCLE_SHA1 | cut -c -7) export BUILD_FILE_NAME=staking_deposit-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; sha256sum ${BUILD_FILE_NAME}.tar.gz | head -c 64 > /tmp/artifacts/${BUILD_FILE_NAME}.sha256 - store_artifacts: path: /tmp/artifacts build-linux-arm64: machine: image: ubuntu-2004:202101-01 resource_class: arm.medium working_directory: ~/repo steps: - checkout - run: name: Install building requirements on Linux ARM64 command: | 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 PYTHONHASHSEED=42 export CIRCLE_SHORT_SHA1=$(eval echo $CIRCLE_SHA1 | cut -c -7) export BUILD_FILE_NAME=staking_deposit-cli-${CIRCLE_SHORT_SHA1}-linux-arm64; mkdir ${BUILD_FILE_NAME}; pyenv global 3.7.5; pyinstaller --distpath ./${BUILD_FILE_NAME} ./build_configs/linux/build.spec; - run: name: Test executable binaries command: | export PYTHONHASHSEED=42 export CIRCLE_SHORT_SHA1=$(eval echo $CIRCLE_SHA1 | cut -c -7) export BUILD_FILE_NAME=staking_deposit-cli-${CIRCLE_SHORT_SHA1}-linux-arm64; export TEST_FOLDER_NAME=TMP_TEST_FOLDER mkdir ${TEST_FOLDER_NAME} cp -r ${BUILD_FILE_NAME} ${TEST_FOLDER_NAME} cp test_binary_script.py ${TEST_FOLDER_NAME} cd ${TEST_FOLDER_NAME} python test_binary_script.py ./${BUILD_FILE_NAME}; - run: name: Compress the file command: | export CIRCLE_SHORT_SHA1=$(eval echo $CIRCLE_SHA1 | cut -c -7) export BUILD_FILE_NAME=staking_deposit-cli-${CIRCLE_SHORT_SHA1}-linux-arm64; tar -zcvf ${BUILD_FILE_NAME}.tar.gz ./${BUILD_FILE_NAME}; mkdir /tmp/artifacts; cp ${BUILD_FILE_NAME}.tar.gz /tmp/artifacts; sha256sum ${BUILD_FILE_NAME}.tar.gz | head -c 64 > /tmp/artifacts/${BUILD_FILE_NAME}.sha256 - store_artifacts: path: /tmp/artifacts build-windows: executor: name: win/default shell: powershell.exe steps: - checkout - run: name: Install building requirements on Windows command: pip install -r ./build_configs/windows/requirements.txt - run: name: Build with build.spec command: | $PYTHONHASHSEED = 42 $CIRCLE_SHORT_SHA1 = $env:CIRCLE_SHA1.substring(0,7) $BUILD_FILE_NAME = "staking_deposit-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: Test executable binaries command: | $PYTHONHASHSEED = 42 $CIRCLE_SHORT_SHA1 = $env:CIRCLE_SHA1.substring(0,7) $BUILD_FILE_NAME = "staking_deposit-cli-" + $CIRCLE_SHORT_SHA1 + "-windows-amd64" $TEST_FOLDER_NAME = "TMP_TEST_FOLDER" mkdir ${TEST_FOLDER_NAME} Copy-item ${BUILD_FILE_NAME} -destination ${TEST_FOLDER_NAME} -recurse copy test_binary_script.py ${TEST_FOLDER_NAME} cd ${TEST_FOLDER_NAME} python test_binary_script.py ${BUILD_FILE_NAME} - run: name: Compress the file command: | $PYTHONHASHSEED = 42 $CIRCLE_SHORT_SHA1 = $env:CIRCLE_SHA1.substring(0,7) $BUILD_FILE_NAME = "staking_deposit-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\ $CHECKSUM_FILE_NAME_PASH = "\tmp\artifacts\" + $BUILD_FILE_NAME + ".sha256" certUtil -hashfile $ZIP_FILE_NAME SHA256 | findstr /i /v "SHA256" | findstr /i /v "CertUtil" > $CHECKSUM_FILE_NAME_PASH - store_artifacts: path: /tmp/artifacts build-macos: macos: xcode: 12.4.0 working_directory: ~/repo steps: - run: xcodebuild -version - run: python3 --version - checkout - run: name: Install building requirements on MacOS command: pip3 install -r ./build_configs/macos/requirements.txt - run: name: Build with build.spec command: | export PYTHONHASHSEED=42 export CIRCLE_SHORT_SHA1=$(eval echo $CIRCLE_SHA1 | cut -c -7) export BUILD_FILE_NAME=staking_deposit-cli-${CIRCLE_SHORT_SHA1}-darwin-amd64; mkdir ${BUILD_FILE_NAME}; pyinstaller --distpath ./${BUILD_FILE_NAME} ./build_configs/macos/build.spec; - run: name: Test executable binaries command: | export PYTHONHASHSEED=42 export CIRCLE_SHORT_SHA1=$(eval echo $CIRCLE_SHA1 | cut -c -7) export BUILD_FILE_NAME=staking_deposit-cli-${CIRCLE_SHORT_SHA1}-darwin-amd64; export TEST_FOLDER_NAME=TMP_TEST_FOLDER mkdir ${TEST_FOLDER_NAME} cp -r ${BUILD_FILE_NAME} ${TEST_FOLDER_NAME} cp test_binary_script.py ${TEST_FOLDER_NAME} cd ${TEST_FOLDER_NAME} python3 test_binary_script.py ./${BUILD_FILE_NAME}; - run: name: Compress the file command: | export PYTHONHASHSEED=42 export CIRCLE_SHORT_SHA1=$(eval echo $CIRCLE_SHA1 | cut -c -7) export BUILD_FILE_NAME=staking_deposit-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; shasum -a 256 ${BUILD_FILE_NAME}.tar.gz | head -c 64 > /tmp/artifacts/${BUILD_FILE_NAME}.sha256 - store_artifacts: path: /tmp/artifacts workflows: version: 2.1 all_test: jobs: - venv_build - venv_pytest: requires: - venv_build - venv_lint: requires: - venv_build - tox-py37-core - tox-py38-core - tox-py37-script - tox-py38-script - win-py37-script build_linux: jobs: - build-linux-amd64 - build-linux-arm64 build_windows: jobs: - build-windows build_macos: jobs: - build-macos