mirror of https://github.com/nucypher/nucypher.git
Initial port of circleCI to GH actions
parent
919d6b45c2
commit
8d8e022e09
|
@ -1,900 +0,0 @@
|
|||
version: 2.1
|
||||
workflows:
|
||||
version: 2
|
||||
test_build_deploy:
|
||||
jobs:
|
||||
- pip_install_37:
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
- integration:
|
||||
context: "NuCypher Tests"
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- pip_install_37
|
||||
- unit:
|
||||
context: "NuCypher Tests"
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- pip_install_37
|
||||
- contracts:
|
||||
context: "NuCypher Tests"
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- pip_install_37
|
||||
- interfaces:
|
||||
context: "NuCypher Tests"
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- unit
|
||||
- integration
|
||||
- characters:
|
||||
context: "NuCypher Tests"
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- unit
|
||||
- integration
|
||||
- agents:
|
||||
context: "NuCypher Tests"
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- unit
|
||||
- integration
|
||||
- actors:
|
||||
context: "NuCypher Tests"
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- unit
|
||||
- integration
|
||||
- deployers:
|
||||
context: "NuCypher Tests"
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- unit
|
||||
- integration
|
||||
- cli:
|
||||
context: "NuCypher Tests"
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- unit
|
||||
- integration
|
||||
- utilities:
|
||||
context: "NuCypher Tests"
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- unit
|
||||
- integration
|
||||
- tests_ok:
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- actors
|
||||
- agents
|
||||
- interfaces
|
||||
- characters
|
||||
- cli
|
||||
- deployers
|
||||
- utilities
|
||||
- build_dev_docker_images:
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
- finnegans_wake_demo:
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- build_dev_docker_images
|
||||
# - heartbeat_demo:
|
||||
# filters:
|
||||
# tags:
|
||||
# only: /.*/
|
||||
# requires:
|
||||
# - build_dev_docker_images
|
||||
- build_docs:
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
- test_build:
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- tests_ok
|
||||
- build_docker:
|
||||
filters:
|
||||
tags:
|
||||
only: /v[0-9]+.*/
|
||||
branches:
|
||||
only: main
|
||||
requires:
|
||||
- test_build
|
||||
- publish_docker_experimental:
|
||||
context: "NuCypher Docker"
|
||||
requires:
|
||||
- build_docker
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
branches:
|
||||
only:
|
||||
- main
|
||||
- development
|
||||
- request_publication_approval:
|
||||
type: approval
|
||||
requires:
|
||||
- build_docker
|
||||
filters:
|
||||
tags:
|
||||
only: /v[0-9]+.*/
|
||||
branches:
|
||||
ignore: /.*/
|
||||
- publish_pypi:
|
||||
context: "NuCypher PyPI"
|
||||
requires:
|
||||
- request_publication_approval
|
||||
filters:
|
||||
tags:
|
||||
only: /v[0-9]+.*/
|
||||
branches:
|
||||
ignore: /.*/
|
||||
- publish_docker:
|
||||
context: "NuCypher Docker"
|
||||
requires:
|
||||
- request_publication_approval
|
||||
filters:
|
||||
tags:
|
||||
only: /v[0-9]+.*/
|
||||
branches:
|
||||
ignore: /.*/
|
||||
nightly:
|
||||
triggers:
|
||||
- schedule:
|
||||
cron: "0 6 * * *" # Scheduled for 0600 UTC (0800 CEST, 2300 PDT)
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- main
|
||||
- development
|
||||
jobs:
|
||||
- validate_reqs_files:
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
- pipenv_install_36:
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
- pip_install_36:
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
- pipenv_install_37:
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
- pip_install_37:
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
- pipenv_install_38:
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
- pip_install_38:
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
- pipenv_install_39:
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
- pip_install_39:
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
- statistical_tests:
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- pip_install_37
|
||||
- contracts:
|
||||
context: "Nightly"
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- pip_install_37
|
||||
- interfaces:
|
||||
context: "Nightly"
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- pip_install_37
|
||||
- characters:
|
||||
context: "Nightly"
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- pip_install_37
|
||||
- agents:
|
||||
context: "Nightly"
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- pip_install_37
|
||||
- actors:
|
||||
context: "Nightly"
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- pip_install_37
|
||||
- deployers:
|
||||
context: "Nightly"
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- pip_install_37
|
||||
- cli:
|
||||
context: "Nightly"
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- pip_install_37
|
||||
- utilities:
|
||||
context: "Nightly"
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- pip_install_37
|
||||
- tests_ok:
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- actors
|
||||
- agents
|
||||
- interfaces
|
||||
- characters
|
||||
- cli
|
||||
- deployers
|
||||
- utilities
|
||||
- build_dev_docker_images:
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- tests_ok
|
||||
- finnegans_wake_demo:
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- build_dev_docker_images
|
||||
# - heartbeat_demo:
|
||||
# filters:
|
||||
# tags:
|
||||
# only: /.*/
|
||||
# requires:
|
||||
# - build_dev_docker_images
|
||||
- build_docs:
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- tests_ok
|
||||
- test_build:
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- build_docs
|
||||
# - heartbeat_demo
|
||||
- finnegans_wake_demo
|
||||
- build_docker:
|
||||
filters:
|
||||
tags:
|
||||
only: /v[0-9]+.*/
|
||||
branches:
|
||||
only: main
|
||||
requires:
|
||||
- test_build
|
||||
|
||||
|
||||
python_36_base: &python_36_base
|
||||
parallelism: 1
|
||||
working_directory: ~/nucypher
|
||||
docker:
|
||||
- image: nucypher/rust-python:3.6.9
|
||||
user: circleci
|
||||
|
||||
python_37_base: &python_37_base
|
||||
parallelism: 1
|
||||
working_directory: ~/nucypher
|
||||
docker:
|
||||
- image: nucypher/rust-python:3.7.9
|
||||
user: circleci
|
||||
|
||||
python_38_base: &python_38_base
|
||||
parallelism: 1
|
||||
working_directory: ~/nucypher
|
||||
docker:
|
||||
- image: nucypher/rust-python:3.8.9
|
||||
user: circleci
|
||||
|
||||
python_39_base: &python_39_base
|
||||
parallelism: 1
|
||||
working_directory: ~/nucypher
|
||||
docker:
|
||||
- image: nucypher/rust-python:3.9.9
|
||||
user: circleci
|
||||
|
||||
commands:
|
||||
|
||||
pipenv_install:
|
||||
description: "Install Python dependencies with Pipenv"
|
||||
parameters:
|
||||
python_version:
|
||||
type: string
|
||||
default: "3.7"
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Install Python Dependencies with Pipenv
|
||||
command: |
|
||||
sudo apt update -y && sudo apt install python3-dev -y
|
||||
pipenv sync --python << parameters.python_version >> --dev
|
||||
- run:
|
||||
name: Install Solidity Compiler (Pipenv Entrypoint)
|
||||
command: pipenv run install-solc
|
||||
- run:
|
||||
name: Check NuCypher Python API Entrypoint
|
||||
command: pipenv run python3 -c "import nucypher; print(nucypher.__version__)"
|
||||
|
||||
check_nucypher_entrypoints:
|
||||
description: "Ensure both the python API and CLI entrypoints are usable"
|
||||
steps:
|
||||
- run:
|
||||
name: Check NuCypher Python API Entrypoint
|
||||
command: python3 -c "import nucypher; print(nucypher.__version__)"
|
||||
- run:
|
||||
name: Check NuCypher CLI Entrypoint
|
||||
command: |
|
||||
export PATH=~/.local/bin:$PATH
|
||||
source ~/.bashrc
|
||||
nucypher --help
|
||||
|
||||
chown_system_paths:
|
||||
description: "Set ownership of system binaries and site-packages"
|
||||
steps:
|
||||
- run:
|
||||
name: Chown system site-packages
|
||||
command: sudo chown circleci:circleci -R /usr/local/lib/python3.7/site-packages/
|
||||
- run:
|
||||
name: Chown system binaries
|
||||
command: sudo chown circleci:circleci -R /usr/local/bin
|
||||
|
||||
chown_user_paths:
|
||||
steps:
|
||||
- run:
|
||||
name: Set user-local permissions of site-packages and binaries
|
||||
command: |
|
||||
sudo chown -R circleci:circleci ~/.local/bin
|
||||
sudo chown -R circleci:circleci ~/.local/lib/python3.7/site-packages
|
||||
|
||||
pip_install:
|
||||
description: "Install NuCypher with Pip"
|
||||
steps:
|
||||
- chown_system_paths
|
||||
- run:
|
||||
name: Install Python Development Dependencies with Pip
|
||||
command: python3 -m pip install --user -e .[dev]
|
||||
- run:
|
||||
name: Check that pip installed package is importable
|
||||
command: python3 -c "import nucypher"
|
||||
- run:
|
||||
name: Install Solidity Compiler
|
||||
command: python3 ./scripts/installation/install_solc.py
|
||||
- check_nucypher_entrypoints
|
||||
|
||||
save_dependency_cache:
|
||||
description: "Cache python installation files"
|
||||
steps:
|
||||
- chown_user_paths
|
||||
- save_cache:
|
||||
key: pip-v3-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
|
||||
paths:
|
||||
- "~/.local/bin"
|
||||
- "~/.local/lib/python3.7/site-packages"
|
||||
- save_cache:
|
||||
key: solc-v2-{{ checksum "nucypher/blockchain/eth/sol/__conf__.py" }}
|
||||
paths:
|
||||
- "~/.solcx/"
|
||||
|
||||
restore_dependency_cache:
|
||||
description: "Restore cached python installation files"
|
||||
steps:
|
||||
- restore_cache: # ensure this step occurs *before* installing dependencies
|
||||
key: pip-v3-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
|
||||
- restore_cache:
|
||||
key: solc-v2-{{ checksum "nucypher/blockchain/eth/sol/__conf__.py" }}
|
||||
|
||||
prepare_environment:
|
||||
description: "Checkout application code and Attach the Workspace"
|
||||
steps:
|
||||
- checkout
|
||||
- restore_dependency_cache
|
||||
- run:
|
||||
name: "Create directory for test reports"
|
||||
command: mkdir reports
|
||||
|
||||
run_test_suite:
|
||||
description: "Runs a group of tests, specified by name and contained in a file"
|
||||
steps:
|
||||
- run:
|
||||
name: Running Test Suite
|
||||
command: |
|
||||
cat test-names.tmp | tr '\n' ' ' > test-names.txt
|
||||
python3 -m pytest -c .circleci/pytest.ini `cat test-names.txt`
|
||||
|
||||
prepare_dev_docker:
|
||||
description: "access pre-build docker image"
|
||||
steps:
|
||||
- setup_remote_docker
|
||||
- attach_workspace:
|
||||
at: ~/docker-dev
|
||||
- run:
|
||||
name: "load docker"
|
||||
command: docker load < ~/docker-dev/dev-docker-build.tar
|
||||
|
||||
capture_test_results:
|
||||
description: "Store and Upload test results; Follow-up step for tests"
|
||||
steps:
|
||||
- store_test_results:
|
||||
path: reports
|
||||
- store_artifacts:
|
||||
path: ~/.cache/nucypher/log/nucypher.log
|
||||
destination: logs
|
||||
- store_artifacts:
|
||||
path: test-names.txt
|
||||
destination: tests
|
||||
|
||||
build_and_save_test_docker:
|
||||
description: "Build dev docker image for running tests against docker"
|
||||
steps:
|
||||
- checkout
|
||||
- setup_remote_docker
|
||||
- run:
|
||||
name: Build Docker Image
|
||||
command: docker-compose -f ./scripts/circle/docker-compose.yml build nucypher-circle-dev
|
||||
- run:
|
||||
name: mkdir
|
||||
command: mkdir ~/docker-dev
|
||||
- run:
|
||||
name: save Docker Image
|
||||
command: docker save circle:nucypher -o ~/docker-dev/dev-docker-build.tar
|
||||
- persist_to_workspace:
|
||||
root: ~/docker-dev
|
||||
paths:
|
||||
- "*.tar"
|
||||
|
||||
|
||||
jobs:
|
||||
|
||||
# Python 3.6
|
||||
pip_install_36:
|
||||
<<: *python_36_base
|
||||
steps:
|
||||
- checkout
|
||||
- pip_install
|
||||
|
||||
pipenv_install_36:
|
||||
<<: *python_36_base
|
||||
steps:
|
||||
- pipenv_install:
|
||||
python_version: "3.6"
|
||||
|
||||
# Python 3.7
|
||||
# Note: Use the chown command to grant CircleCI access to dependency locations.
|
||||
pip_install_37:
|
||||
<<: *python_37_base
|
||||
steps:
|
||||
- checkout
|
||||
- pip_install
|
||||
- save_dependency_cache
|
||||
|
||||
pipenv_install_37:
|
||||
<<: *python_37_base
|
||||
steps:
|
||||
- pipenv_install:
|
||||
python_version: "3.7"
|
||||
|
||||
# Python 3.8
|
||||
pip_install_38:
|
||||
<<: *python_38_base
|
||||
steps:
|
||||
- checkout
|
||||
- pip_install
|
||||
|
||||
pipenv_install_38:
|
||||
<<: *python_38_base
|
||||
steps:
|
||||
- pipenv_install:
|
||||
python_version: "3.8"
|
||||
|
||||
# Python 3.9
|
||||
pip_install_39:
|
||||
<<: *python_39_base
|
||||
steps:
|
||||
- checkout
|
||||
- pip_install
|
||||
|
||||
pipenv_install_39:
|
||||
<<: *python_39_base
|
||||
steps:
|
||||
- pipenv_install:
|
||||
python_version: "3.9"
|
||||
|
||||
integration:
|
||||
<<: *python_37_base
|
||||
parallelism: 2
|
||||
steps:
|
||||
- prepare_environment
|
||||
- run:
|
||||
name: Preparing Integration Test Suite
|
||||
command: |
|
||||
circleci tests glob "tests/integration/**/test_*.py" | circleci tests split --split-by=timings | tee test-names.tmp
|
||||
- run_test_suite
|
||||
- capture_test_results
|
||||
|
||||
unit:
|
||||
<<: *python_37_base
|
||||
parallelism: 1
|
||||
steps:
|
||||
- prepare_environment
|
||||
- run:
|
||||
name: Preparing Unit Test Suite
|
||||
command: |
|
||||
circleci tests glob "tests/unit/**/test_*.py" | circleci tests split --split-by=timings | tee test-names.tmp
|
||||
- run_test_suite
|
||||
- capture_test_results
|
||||
|
||||
agents:
|
||||
<<: *python_37_base
|
||||
parallelism: 4
|
||||
steps:
|
||||
- prepare_environment
|
||||
- run:
|
||||
name: Preparing Blockchain Agent Tests
|
||||
command: |
|
||||
circleci tests glob "tests/acceptance/blockchain/agents/**/test_*.py" | circleci tests split --split-by=timings | tee test-names.tmp
|
||||
- run_test_suite
|
||||
- capture_test_results
|
||||
|
||||
actors:
|
||||
<<: *python_37_base
|
||||
parallelism: 2
|
||||
steps:
|
||||
- prepare_environment
|
||||
- run:
|
||||
name: Preparing Blockchain Actor Tests
|
||||
command: |
|
||||
circleci tests glob "tests/acceptance/blockchain/actors/**/test_*.py" | circleci tests split --split-by=timings | tee test-names.tmp
|
||||
- run_test_suite
|
||||
- capture_test_results
|
||||
|
||||
deployers:
|
||||
<<: *python_37_base
|
||||
parallelism: 2
|
||||
steps:
|
||||
- prepare_environment
|
||||
- run:
|
||||
name: Preparing Contract Deployer Tests
|
||||
command: |
|
||||
circleci tests glob "tests/acceptance/blockchain/deployers/**/test_*.py" | circleci tests split --split-by=timings | tee test-names.tmp
|
||||
- run_test_suite
|
||||
- capture_test_results
|
||||
|
||||
contracts:
|
||||
<<: *python_37_base
|
||||
parallelism: 4
|
||||
steps:
|
||||
- prepare_environment
|
||||
- run:
|
||||
name: Preparing Ethereum Contract Unit Tests
|
||||
command: |
|
||||
circleci tests glob "tests/contracts/**/test_*.py" | circleci tests split --split-by=timings | tee test-names.tmp
|
||||
- run_test_suite
|
||||
- capture_test_results
|
||||
|
||||
interfaces:
|
||||
<<: *python_37_base
|
||||
parallelism: 1
|
||||
steps:
|
||||
- prepare_environment
|
||||
- run:
|
||||
name: Preparing Tests for Blockchain interfaces and Ethereum clients
|
||||
command: |
|
||||
circleci tests glob "tests/acceptance/blockchain/interfaces/**/test_*.py" "tests/acceptance/blockchain/clients/**/test_*.py" | tee test-names.tmp
|
||||
- run_test_suite
|
||||
- capture_test_results
|
||||
|
||||
characters:
|
||||
<<: *python_37_base
|
||||
parallelism: 4
|
||||
steps:
|
||||
- prepare_environment
|
||||
- run:
|
||||
name: Preparing Character, Discovery Loop (aka "Learning") and Network Tests
|
||||
command: |
|
||||
circleci tests glob "tests/acceptance/characters/**/test_*.py" "tests/acceptance/learning/**/test_*.py" "tests/acceptance/network/**/test_*.py" | circleci tests split --split-by=timings | tee test-names.tmp
|
||||
- run_test_suite
|
||||
- capture_test_results
|
||||
|
||||
cli:
|
||||
<<: *python_37_base
|
||||
parallelism: 6
|
||||
steps:
|
||||
- prepare_environment
|
||||
- run:
|
||||
name: Preparing Nucypher CLI Tests
|
||||
command: |
|
||||
circleci tests glob "tests/acceptance/cli/**/test_*.py" | circleci tests split --split-by=timings | tee test-names.tmp
|
||||
- run_test_suite
|
||||
- capture_test_results
|
||||
|
||||
utilities:
|
||||
<<: *python_37_base
|
||||
parallelism: 1
|
||||
steps:
|
||||
- prepare_environment
|
||||
- run:
|
||||
name: Preparing Nucypher Utilities Tests
|
||||
command: |
|
||||
circleci tests glob "tests/acceptance/utilities/**/test_*.py" | circleci tests split --split-by=timings | tee test-names.tmp
|
||||
- run_test_suite
|
||||
- capture_test_results
|
||||
|
||||
tests_ok:
|
||||
<<: *python_37_base
|
||||
steps:
|
||||
- run:
|
||||
name: Nucypher CLI Tests
|
||||
command: echo "Test modules succeeded"
|
||||
|
||||
build_dev_docker_images:
|
||||
<<: *python_37_base
|
||||
steps:
|
||||
- build_and_save_test_docker
|
||||
|
||||
# heartbeat_demo:
|
||||
# <<: *python_37_base
|
||||
# steps:
|
||||
# - checkout
|
||||
# - prepare_dev_docker
|
||||
# - run:
|
||||
# name: Run demo Ursula fleet, Alicia and the Doctor
|
||||
# command: ./scripts/circle/run_heartbeat_demo_docker-circle.sh
|
||||
# - store_artifacts:
|
||||
# path: /tmp/ursulas-logs
|
||||
|
||||
finnegans_wake_demo:
|
||||
working_directory: ~/nucypher
|
||||
<<: *python_37_base
|
||||
steps:
|
||||
- checkout
|
||||
- prepare_dev_docker
|
||||
- run:
|
||||
name: Run demo Ursula fleet, Finnegans wake Demo code
|
||||
command: ./scripts/circle/run_finnegans_wake_demo_docker-circle.sh
|
||||
- store_artifacts:
|
||||
path: /tmp/ursulas-logs
|
||||
|
||||
validate_reqs_files:
|
||||
working_directory: ~/nucypher
|
||||
<<: *python_37_base
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Run Requirements comparison
|
||||
command: ./scripts/circle/compare_reqs.sh
|
||||
- run:
|
||||
name: Prepare Requirement Files for Storage as Artifacts
|
||||
command: |
|
||||
mkdir -p /tmp/reqs
|
||||
cp *requirements.txt /tmp/reqs
|
||||
when: on_fail
|
||||
- store_artifacts:
|
||||
path: /tmp/reqs
|
||||
destination: reqs
|
||||
|
||||
estimate_gas:
|
||||
<<: *python_37_base
|
||||
steps:
|
||||
- prepare_environment
|
||||
- chown_system_paths
|
||||
- run:
|
||||
name: Install Nucypher
|
||||
command: python3 -m pip install --user -e .[benchmark]
|
||||
- run:
|
||||
name: Estimate Gas
|
||||
command: python3 tests/metrics/estimate_gas.py
|
||||
- store_artifacts:
|
||||
path: tests/metrics/results/
|
||||
|
||||
build_docs:
|
||||
<<: *python_37_base
|
||||
steps:
|
||||
- prepare_environment
|
||||
- chown_system_paths
|
||||
- run:
|
||||
name: Install Documentation Build Dependencies
|
||||
command: python3 -m pip install --user -r docs-requirements.txt
|
||||
- run:
|
||||
name: Build Sphinx Documentation
|
||||
command: make docs
|
||||
- store_artifacts:
|
||||
path: docs/build
|
||||
|
||||
test_build:
|
||||
<<: *python_37_base
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Install Build Dependencies
|
||||
command: python3 -m pip install --user .[deploy]
|
||||
- run:
|
||||
name: Build Python Distribution
|
||||
command: make dist
|
||||
|
||||
build_docker:
|
||||
working_directory: ~/nucypher
|
||||
docker:
|
||||
- image: cimg/python:3.8.6
|
||||
steps:
|
||||
- checkout
|
||||
- setup_remote_docker
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v2-{{ .Branch }}-{{ arch }}
|
||||
paths:
|
||||
- ~/docker/nucypher.tar
|
||||
- run:
|
||||
name: Load Docker Image Layer Cache
|
||||
command: |
|
||||
set +o pipefail
|
||||
docker load -i ~/docker/nucypher.tar | true
|
||||
- run:
|
||||
name: Build Docker Image
|
||||
command: |
|
||||
docker build -f deploy/docker/Dockerfile --cache-from=nucypher -t nucypher/nucypher:circle .
|
||||
- run:
|
||||
name: Save Docker Image Layer Cache
|
||||
command: |
|
||||
mkdir -p ~/docker
|
||||
docker save -o ~/docker/nucypher.tar nucypher/nucypher:circle
|
||||
- save_cache:
|
||||
key: v2-{{ .Branch }}-{{ arch }}-{{ epoch }}
|
||||
paths:
|
||||
- ~/docker/nucypher.tar
|
||||
|
||||
publish_pypi:
|
||||
<<: *python_37_base
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Install Twine and Wheel
|
||||
command: pip3 install twine wheel
|
||||
- run:
|
||||
name: Verify git tag == __version__
|
||||
command: python3 setup.py verify
|
||||
- run:
|
||||
name: Initialize .pypirc
|
||||
command: |
|
||||
echo -e "[distutils]" >> ~/.pypirc
|
||||
echo -e "index-servers = " >> ~/.pypirc
|
||||
echo -e " pypi" >> ~/.pypirc
|
||||
echo -e "" >> ~/.pypirc
|
||||
echo -e "[pypi]" >> ~/.pypirc
|
||||
echo -e "username = $PYPI_USERNAME" >> ~/.pypirc
|
||||
echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc
|
||||
- run:
|
||||
name: Build Python Wheel
|
||||
command: make dist
|
||||
- deploy:
|
||||
name: Upload to PyPI
|
||||
command: python3 -m twine upload dist/* --verbose
|
||||
|
||||
publish_docker_experimental:
|
||||
working_directory: ~/nucypher
|
||||
docker:
|
||||
- image: cimg/python:3.8.6
|
||||
steps:
|
||||
- checkout
|
||||
- setup_remote_docker
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v2-{{ .Branch }}-{{ arch }}
|
||||
paths:
|
||||
- ~/docker/nucypher.tar
|
||||
- run:
|
||||
name: Load Docker Image Layer Cache
|
||||
command: |
|
||||
set +o pipefail
|
||||
docker load -i ~/docker/nucypher.tar | true
|
||||
- deploy:
|
||||
name: Push Latest NuCypher Docker Image
|
||||
command: |
|
||||
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
|
||||
docker tag nucypher/nucypher:circle nucypher/nucypher:experimental
|
||||
docker push nucypher/nucypher:experimental
|
||||
|
||||
publish_docker:
|
||||
working_directory: ~/nucypher
|
||||
docker:
|
||||
- image: cimg/python:3.8.6
|
||||
steps:
|
||||
- checkout
|
||||
- setup_remote_docker
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v2-{{ .Branch }}-{{ arch }}
|
||||
paths:
|
||||
- ~/docker/nucypher.tar
|
||||
- run:
|
||||
name: Load Docker Image Layer Cache
|
||||
command: |
|
||||
set +o pipefail
|
||||
docker load -i ~/docker/nucypher.tar | true
|
||||
- deploy:
|
||||
name: Push Tagged NuCypher Docker Images
|
||||
command: |
|
||||
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
|
||||
docker tag nucypher/nucypher:circle nucypher/nucypher:$CIRCLE_TAG
|
||||
docker tag nucypher/nucypher:circle nucypher/nucypher:latest
|
||||
docker push nucypher/nucypher:$CIRCLE_TAG
|
||||
docker push nucypher/nucypher:latest
|
||||
|
||||
statistical_tests:
|
||||
<<: *python_37_base
|
||||
parallelism: 1
|
||||
steps:
|
||||
- prepare_environment
|
||||
- run:
|
||||
name: Statistical tests (e.g., sampling)
|
||||
command: |
|
||||
pytest -c .circleci/pytest.ini --run-nightly --no-cov tests/acceptance/blockchain/agents/test_sampling_distribution.py
|
||||
- store_test_results:
|
||||
path: reports
|
||||
- store_artifacts:
|
||||
path: ~/.cache/nucypher/log/nucypher.log
|
||||
destination: logs
|
|
@ -1,35 +0,0 @@
|
|||
FROM rust:slim-buster
|
||||
|
||||
# prepare container
|
||||
RUN apt-get update -y
|
||||
|
||||
# install python build dependencies
|
||||
RUN apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
|
||||
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
|
||||
xz-utils tk-dev libffi-dev liblzma-dev git docker-compose
|
||||
|
||||
# get python
|
||||
ARG VERSION
|
||||
RUN echo "Building python version $VERSION"
|
||||
RUN wget https://www.python.org/ftp/python/$VERSION/Python-$VERSION.tgz
|
||||
RUN tar xzvf Python-$VERSION.tgz
|
||||
|
||||
# build python
|
||||
WORKDIR Python-$VERSION
|
||||
RUN ./configure --enable-optimizations
|
||||
RUN make
|
||||
RUN make install
|
||||
|
||||
# setup python
|
||||
RUN cp python /bin
|
||||
RUN apt-get install -y python3-openssl python3-dev
|
||||
|
||||
# setup rust
|
||||
ENV CARGO_ROOT /usr/local/cargo
|
||||
ENV PATH $CARGO_ROOT/bin:$PATH
|
||||
|
||||
# echo python and rust versions
|
||||
RUN python3 --version && \
|
||||
cargo --version && \
|
||||
rustup --version && \
|
||||
rustc --version
|
|
@ -1,26 +0,0 @@
|
|||
# Rust-Python CircleCI Container
|
||||
|
||||
|
||||
### Setup
|
||||
```bash
|
||||
# the default username in the container
|
||||
# circle ci expects the user "circleci"
|
||||
export DOCKER_USER=<USERNAME>
|
||||
|
||||
# the version of python to build
|
||||
export PYTHON_VERSION=<VERSION>
|
||||
```
|
||||
|
||||
### Build
|
||||
```bash
|
||||
# pass local env vars as build args USER and VERSION
|
||||
docker build -t nucypher/rust-python:$PYTHON_VERSION . \
|
||||
--build-arg VERSION=${PYTHON_VERSION} \
|
||||
--build-arg USER=${DOCKER_USER}
|
||||
```
|
||||
|
||||
### Push
|
||||
```bash
|
||||
# docker login or authentication required
|
||||
docker push nucypher/rust-python:$PYTHON_VERSION
|
||||
```
|
|
@ -1,58 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Install the CircleCI CLI tool.
|
||||
# https://github.com/CircleCI-Public/circleci-cli
|
||||
#
|
||||
# Dependencies: curl, cut
|
||||
#
|
||||
# The version to install and the binary location can be passed in via VERSION and DESTDIR respectively.
|
||||
#
|
||||
|
||||
set -o errexit
|
||||
|
||||
echo "Starting installation."
|
||||
|
||||
# GitHub's URL for the latest release, will redirect.
|
||||
LATEST_URL="https://github.com/CircleCI-Public/circleci-cli/releases/latest/"
|
||||
DESTDIR="${DESTDIR:-$HOME/.local/bin/}"
|
||||
|
||||
if [ -z "$VERSION" ]; then
|
||||
VERSION=$(curl -sLI -o /dev/null -w '%{url_effective}' $LATEST_URL | cut -d "v" -f 2)
|
||||
fi
|
||||
|
||||
echo "Installing CircleCI CLI v${VERSION}"
|
||||
|
||||
# Run the script in a temporary directory that we know is empty.
|
||||
SCRATCH=$(mktemp -d || mktemp -d -t 'tmp')
|
||||
cd "$SCRATCH"
|
||||
|
||||
function error {
|
||||
echo "An error occured installing the tool."
|
||||
echo "The contents of the directory $SCRATCH have been left in place to help to debug the issue."
|
||||
}
|
||||
|
||||
trap error ERR
|
||||
|
||||
# Determine release filename. This can be expanded with CPU arch in the future.
|
||||
if [ "$(uname)" == "Linux" ]; then
|
||||
OS="linux"
|
||||
elif [ "$(uname)" == "Darwin" ]; then
|
||||
OS="darwin"
|
||||
else
|
||||
echo "This operating system is not supported."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
RELEASE_URL="https://github.com/CircleCI-Public/circleci-cli/releases/download/v${VERSION}/circleci-cli_${VERSION}_${OS}_amd64.tar.gz"
|
||||
|
||||
# Download & unpack the release tarball.
|
||||
curl -sL --retry 3 "${RELEASE_URL}" | tar zx --strip 1
|
||||
|
||||
echo "Installing to $DESTDIR"
|
||||
mv circleci "$DESTDIR"
|
||||
chmod +x "$DESTDIR/circleci"
|
||||
|
||||
command -v circleci
|
||||
|
||||
# Delete the working directory when the install was successful.
|
||||
rm -r "$SCRATCH"
|
|
@ -1,3 +0,0 @@
|
|||
[pytest]
|
||||
addopts = -s -v --junitxml=./reports/pytest-results.xml --strict-markers --durations=0 --cov=nucypher --cov-report xml:reports/coverage.xml --timeout 580
|
||||
junit_family = xunit1
|
|
@ -1,9 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
curl --user ${CIRCLE_API_TOKEN}: \
|
||||
--request POST \
|
||||
--form build_parameters[CIRCLE_JOB]=${JOB_NAME} \
|
||||
--form build_parameters[CIRCLE_REPOSITORY_URL]=${CIRCLE_GIT_URL} \
|
||||
--form config=@config.yml \
|
||||
--form notify=false \
|
||||
https://circleci.com/api/v1.1/project/github/nucypher/nucypher/
|
|
@ -1,11 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# The following line is needed by the CircleCI Local Build Tool (due to Docker interactivity)
|
||||
exec < /dev/tty
|
||||
|
||||
# If validation fails, tell Git to stop and provide error message. Otherwise, continue.
|
||||
if ! eMSG=$(circleci config validate -c .circleci/config.yml); then
|
||||
echo "CircleCI Configuration Failed Validation."
|
||||
echo $eMSG
|
||||
exit 1
|
||||
fi
|
|
@ -0,0 +1,71 @@
|
|||
name: 'Run Tests'
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- development
|
||||
tags-ignore:
|
||||
- '*.*' # ignore releases
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- development
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ["3.7", "3.8", "3.9", "3.10"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install .[dev]
|
||||
- name: Unit Tests
|
||||
run: |
|
||||
pytest tests/unit
|
||||
- name: Integration Tests
|
||||
run: |
|
||||
pytest tests/integration
|
||||
- name: Agents Tests
|
||||
run: |
|
||||
pytest tests/acceptance/blockchain/agents
|
||||
- name: Actors Tests
|
||||
run: |
|
||||
pytest tests/acceptance/blockchain/actors
|
||||
- name: Agents Tests
|
||||
run: |
|
||||
pytest tests/acceptance/blockchain/agents
|
||||
- name: Deployer Tests
|
||||
run: |
|
||||
pytest tests/acceptance/blockchain/deployers
|
||||
- name: Interfaces Tests
|
||||
run: |
|
||||
pytest tests/acceptance/blockchain/interfaces
|
||||
- name: Conditions Tests
|
||||
run: |
|
||||
pytest tests/acceptance/blockchain/interfaces
|
||||
- name: Characters Tests
|
||||
run: |
|
||||
pytest tests/acceptance/characters
|
||||
- name: CLI Tests
|
||||
run: |
|
||||
pytest tests/acceptance/characters
|
||||
- name: Node Discovery Tests
|
||||
run: |
|
||||
pytest tests/acceptance/learning
|
||||
- name: Network Tests
|
||||
run: |
|
||||
pytest tests/acceptance/network
|
||||
- name: Utility Tests
|
||||
run: |
|
||||
pytest tests/acceptance/utilities
|
Loading…
Reference in New Issue