Skip to content

Commit abf5bbc

Browse files
pbelevichfacebook-github-bot
authored andcommitted
Add macos unittest (#93)
Summary: Pull Request resolved: #93 This is a port of pytorch/vision#2727 Fixes #56 Test Plan: Imported from OSS Reviewed By: ailzhang Differential Revision: D25413017 Pulled By: pbelevich fbshipit-source-id: df8bd95f03aa612725814b81b4c93c25864d35ea
1 parent 2c92728 commit abf5bbc

File tree

2 files changed

+61
-1
lines changed

2 files changed

+61
-1
lines changed

.circleci/config.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,49 @@ jobs:
394394
- store_test_results:
395395
path: test-results
396396

397+
unittest_macos_cpu:
398+
<<: *binary_common
399+
macos:
400+
xcode: "9.4.1"
401+
resource_class: large
402+
steps:
403+
- checkout
404+
- designate_upload_channel
405+
- run:
406+
name: Install wget
407+
command: HOMEBREW_NO_AUTO_UPDATE=1 brew install wget
408+
# Disable brew auto update which is very slow
409+
- run:
410+
name: Generate cache key
411+
# This will refresh cache on Sundays, nightly build should generate new cache.
412+
command: echo "$(date +"%Y-%U")" > .circleci-weekly
413+
- restore_cache:
414+
415+
keys:
416+
- env-v3-macos-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum ".circleci-weekly" }}
417+
418+
- run:
419+
name: Setup
420+
command: .circleci/unittest/linux/scripts/setup_env.sh
421+
- save_cache:
422+
423+
key: env-v3-macos-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum ".circleci-weekly" }}
424+
425+
paths:
426+
- conda
427+
- env
428+
- run:
429+
name: Install torchcsprng
430+
command: .circleci/unittest/linux/scripts/install.sh
431+
- run:
432+
name: Run tests
433+
command: .circleci/unittest/linux/scripts/run_test.sh
434+
- run:
435+
name: Post process
436+
command: .circleci/unittest/linux/scripts/post_process.sh
437+
- store_test_results:
438+
path: test-results
439+
397440
workflows:
398441
build:
399442
jobs:
@@ -848,6 +891,18 @@ workflows:
848891
cu_version: cu101
849892
name: unittest_windows_gpu_py3.8
850893
python_version: '3.8'
894+
- unittest_macos_cpu:
895+
cu_version: cpu
896+
name: unittest_macos_cpu_py3.6
897+
python_version: '3.6'
898+
- unittest_macos_cpu:
899+
cu_version: cpu
900+
name: unittest_macos_cpu_py3.7
901+
python_version: '3.7'
902+
- unittest_macos_cpu:
903+
cu_version: cpu
904+
name: unittest_macos_cpu_py3.8
905+
python_version: '3.8'
851906
nightly:
852907
jobs:
853908
# - circleci_consistency

.circleci/unittest/linux/scripts/setup_env.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,15 @@ env_dir="${root_dir}/env"
1414

1515
cd "${root_dir}"
1616

17+
case "$(uname -s)" in
18+
Darwin*) os=MacOSX;;
19+
*) os=Linux
20+
esac
21+
1722
# 1. Install conda at ./conda
1823
if [ ! -d "${conda_dir}" ]; then
1924
printf "* Installing conda\n"
20-
wget -O miniconda.sh http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
25+
wget -O miniconda.sh "http://repo.continuum.io/miniconda/Miniconda3-latest-${os}-x86_64.sh"
2126
bash ./miniconda.sh -b -f -p "${conda_dir}"
2227
fi
2328
eval "$(${conda_dir}/bin/conda shell.bash hook)"

0 commit comments

Comments
 (0)