Skip to content

Commit

Permalink
test: add github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jimouris committed Jun 7, 2024
1 parent 8d2a804 commit 039c6e0
Showing 1 changed file with 133 additions and 0 deletions.
133 changes: 133 additions & 0 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: ci-build

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

setup_venv: &setup_venv
name: Sets up the virtualenv
no_output_timeout: 1h
command: |
python3 -m venv ~/crypten-test
. ~/crypten-test/bin/activate
pip3 install --upgrade pip
pip3 install onnx==1.7.0 tensorboard pandas
pip3 install sklearn --use-pep517
pip3 install torch>=1.7.0 torchvision>=0.8.1
pip3 install tensorflow
pip3 install tf2onnx
pip3 install pyyaml
pip3 install omegaconf
jobs:
rununittests:
docker:
- image: circleci/python:3.7.5-buster
resource_class: 2xlarge+
working_directory: ~/CrypTen
steps:
- checkout
- run:
<<: *setup_venv
- run:
name: Unit tests
no_output_timeout: 3h
command: |
. ~/crypten-test/bin/activate
echo 'for i in $(ls test/test_*.py | grep -Ev "test_(context|benchmark|models)"); do python3 -m unittest $i; (($? != 0)) && exit 1; done; exit 0' > run_tests.sh
bash ./run_tests.sh
- run:
name: Linear svm example
command: |
. ~/crypten-test/bin/activate
PYTHONPATH=. python3 examples/mpc_linear_svm/launcher.py
- run:
name: Linear svm example
command: |
. ~/crypten-test/bin/activate
PYTHONPATH=. python3 examples/mpc_linear_svm/launcher.py --lr 0.1 --epochs 2 --skip_plaintext
- run:
name: Linear svm example multiprocess
command: |
. ~/crypten-test/bin/activate
PYTHONPATH=. python3 examples/mpc_linear_svm/launcher.py --lr 0.1 --world_size 2 --multiprocess
- run:
name: Linear svm example multiprocess
command: |
. ~/crypten-test/bin/activate
PYTHONPATH=. python3 examples/mpc_linear_svm/launcher.py --lr 0.1 --world_size 4 --multiprocess
- run:
name: Linear svm example multiprocess
command: |
. ~/crypten-test/bin/activate
PYTHONPATH=. python3 examples/mpc_linear_svm/launcher.py --multiprocess
- run:
name: TFE benchmarks example
command: |
. ~/crypten-test/bin/activate
PYTHONPATH=. python3 examples/tfe_benchmarks/launcher.py --network A --epochs 2
PYTHONPATH=. python3 examples/tfe_benchmarks/launcher.py --network B --epochs 2
PYTHONPATH=. python3 examples/tfe_benchmarks/launcher.py --network C --epochs 2
- run:
name: TFE benchmarks example
command: |
. ~/crypten-test/bin/activate
PYTHONPATH=. python3 examples/tfe_benchmarks/launcher.py --network A --epochs 1 --multiprocess
PYTHONPATH=. python3 examples/tfe_benchmarks/launcher.py --network B --epochs 1 --multiprocess
PYTHONPATH=. python3 examples/tfe_benchmarks/launcher.py --network C --epochs 1 --multiprocess
- run:
name: TFE benchmarks example
command: |
. ~/crypten-test/bin/activate
PYTHONPATH=. python3 examples/tfe_benchmarks/launcher.py --network A --epochs 3 --multiprocess --world_size 1 --skip-plaintext
PYTHONPATH=. python3 examples/tfe_benchmarks/launcher.py --network B --epochs 3 --multiprocess --world_size 1 --skip-plaintext
PYTHONPATH=. python3 examples/tfe_benchmarks/launcher.py --network C --epochs 3 --multiprocess --world_size 1 --skip-plaintext
- run:
name: TFE benchmarks example
command: |
. ~/crypten-test/bin/activate
PYTHONPATH=. python3 examples/tfe_benchmarks/launcher.py --network A --multiprocess --evaluate --resume examples/tfe_benchmarks/models/tfe_network_a.pth.tar
# These consistently break and need to be debugged
# PYTHONPATH=. python3 examples/tfe_benchmarks/launcher.py --network B --multiprocess --evaluate --resume examples/tfe_benchmarks/models/tfe_network_b.pth.tar
# PYTHONPATH=. python3 examples/tfe_benchmarks/launcher.py --network C --multiprocess --evaluate --resume examples/tfe_benchmarks/models/tfe_network_c.pth.tar
runcifartests0:
docker:
- image: circleci/python:3.7.5-buster
resource_class: 2xlarge+
working_directory: ~/CrypTen
steps:
- checkout
- run:
<<: *setup_venv
- run:
name: CIFAR example
command: |
. ~/crypten-test/bin/activate
PYTHONPATH=. python3 examples/mpc_cifar/launcher.py
# -------------------------------------------------------------------------------------
# Workflows
# -------------------------------------------------------------------------------------
workflows:
version: 2.1
commit:
jobs:
- rununittests:
filters:
branches:
ignore:
- gh-pages
nightly:
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- main
jobs:
- runcifartests0

0 comments on commit 039c6e0

Please sign in to comment.