-
Notifications
You must be signed in to change notification settings - Fork 7.1k
add macOS unittest to GHA #7376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
beed393
cdb2697
3b89814
773412d
5da3f42
19402ef
5e2253d
5fb92ff
03ba33b
6a10cc6
8925969
94db606
8b8bc87
90210c1
893df7b
f76c795
da828de
914a1e0
c46fb06
140f383
b265117
4145d70
68049f0
5b32e26
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -7,6 +7,32 @@ CONDA_PATH=$(which conda) | |||||||||||||||
eval "$(${CONDA_PATH} shell.bash hook)" | ||||||||||||||||
conda config --set channel_priority strict | ||||||||||||||||
|
||||||||||||||||
# Setup the OS_TYPE environment variable that should be used for conditions involving the OS below. | ||||||||||||||||
case $(uname) in | ||||||||||||||||
Linux) | ||||||||||||||||
OS_TYPE=linux | ||||||||||||||||
;; | ||||||||||||||||
Darwin) | ||||||||||||||||
OS_TYPE=macos | ||||||||||||||||
;; | ||||||||||||||||
*) | ||||||||||||||||
echo "Unknown OS type:" $(uname) | ||||||||||||||||
exit 1 | ||||||||||||||||
;; | ||||||||||||||||
esac | ||||||||||||||||
|
||||||||||||||||
echo '::group::Uninstall system JPEG libraries on macOS' | ||||||||||||||||
# The x86 macOS runners, e.g. the GitHub Actions native "macos-12" runner, has some JPEG libraries installed by default | ||||||||||||||||
# that interfere with our build. We uninstall them here and use the one from conda below. | ||||||||||||||||
if [[ "${OS_TYPE}" == "macos" && $(uname -m) == x86_64 ]]; then | ||||||||||||||||
JPEG_LIBS=$(brew list | grep jpeg) | ||||||||||||||||
echo $JPEG_LIBS | ||||||||||||||||
for lib in $JPEG_LIBS; do | ||||||||||||||||
brew uninstall --ignore-dependencies --force $lib || true | ||||||||||||||||
done | ||||||||||||||||
fi | ||||||||||||||||
Comment on lines
+25
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are doing the same for the macOS wheel workflows: vision/packaging/pre_build_script.sh Lines 3 to 9 in 0e62c34
|
||||||||||||||||
echo '::endgroup::' | ||||||||||||||||
|
||||||||||||||||
echo '::group::Set PyTorch conda channel and wheel index' | ||||||||||||||||
# TODO: Can we maybe have this as environment variable in the job template? For example, `IS_RELEASE`. | ||||||||||||||||
if [[ (${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then | ||||||||||||||||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Unit-tests on macOS | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- nightly | ||
- main | ||
- release/* | ||
workflow_dispatch: | ||
|
||
jobs: | ||
tests: | ||
strategy: | ||
matrix: | ||
python-version: | ||
- "3.8" | ||
- "3.9" | ||
- "3.10" | ||
- "3.11" | ||
runner: ["macos-12"] | ||
include: | ||
- python-version: "3.8" | ||
runner: macos-m1-12 | ||
fail-fast: false | ||
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main | ||
with: | ||
repository: pytorch/vision | ||
# We need an increased timeout here, since the macos-12 runner is the free one from GH | ||
# and needs roughly 2 hours to just run the test suite | ||
timeout: 240 | ||
runner: ${{ matrix.runner }} | ||
script: | | ||
export PYTHON_VERSION=${{ matrix.python-version }} | ||
export GPU_ARCH_TYPE=cpu | ||
|
||
./.github/unittest.sh |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -298,6 +298,8 @@ def get_extensions(): | |||||
use_jpeg = use_jpeg and jpeg_found | ||||||
if use_jpeg: | ||||||
print("Building torchvision with JPEG image support") | ||||||
print(f" libpng include path: {jpeg_include}") | ||||||
print(f" libpng lib path: {jpeg_lib}") | ||||||
Comment on lines
+301
to
+302
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Small drive-by that helped me debug. We do the same for PNG already: Lines 278 to 279 in 0e62c34
I wasn't able to get the version of the library in a way that would hold for all operating systems. I guess knowing the location is good enough. |
||||||
image_link_flags.append("jpeg") | ||||||
if jpeg_conda: | ||||||
image_library += [jpeg_lib] | ||||||
|
Uh oh!
There was an error while loading. Please reload this page.