Skip to content

Commit

Permalink
Add macOS to CI (conda#10875)
Browse files Browse the repository at this point in the history
Co-authored-by: Ryan Houle <[email protected]>
Co-authored-by: Jaime Rodríguez-Guerra <[email protected]>
  • Loading branch information
3 people authored Jan 10, 2022
1 parent 37da327 commit 09cb6bd
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 4 deletions.
60 changes: 59 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: ['3.7', '3.8', '3.9']
conda-subdir: ['win-64']
test-type: ['unit', 'integration']
test-group: ['1', '2', '3']
Expand Down Expand Up @@ -85,3 +85,61 @@ jobs:
with:
flags: ${{ matrix.test-type }}
env_vars: OS,PYTHON

macos:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.9']
test-type: ['unit', 'integration']
test-group: ['1', '2', '3']

env:
OS: 'macos'
PYTHON: ${{ matrix.python-version }}
TEST_SPLITS: 3
TEST_GROUP: ${{ matrix.test-group }}

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

# - name: Cache conda
# uses: actions/cache@v2
# env:
# # Increase this value to reset cache if tests/requirements.txt has not changed
# CACHE_NUMBER: 0
# with:
# path: ~/conda_pkgs_dir
# key:
# ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('tests/requirements.txt') }}

- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: conda-test-env
miniconda-version: "latest"
python-version: ${{ matrix.python-version }}
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!

- name: Setup environment
shell: bash -l {0}
run: |
# restoring the default for changeps1 to have parity with dev
conda config --set changeps1 true
# make sure the caching works correctly
conda config --set use_only_tar_bz2 true
# install all test requirements
conda install --name conda-test-env --yes --file tests/requirements.txt
conda update openssl ca-certificates certifi
- name: Python ${{ matrix.python-version }} ${{ matrix.test-type }} tests, group ${{ matrix.test-group }}
shell: bash -l {0}
run : |
./dev/macos/${{ matrix.test-type }}.sh
- uses: codecov/codecov-action@v2
with:
flags: ${{ matrix.test-type }}
env_vars: OS,PYTHON
11 changes: 11 additions & 0 deletions dev/macos/integration.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -o errtrace -o pipefail -o errexit

TEST_SPLITS="${TEST_SPLITS:-1}"
TEST_GROUP="${TEST_GROUP:-1}"

eval "$(sudo python -m conda init bash --dev)"
conda-build tests/test-recipes/activate_deactivate_package
pytest -m "integration" -v --splits ${TEST_SPLITS} --group=${TEST_GROUP}
python -m conda.common.io
10 changes: 10 additions & 0 deletions dev/macos/unit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -o errtrace -o pipefail -o errexit

TEST_SPLITS="${TEST_SPLITS:-1}"
TEST_GROUP="${TEST_GROUP:-1}"

eval "$(sudo python -m conda init bash --dev)"
conda info
pytest -m "not integration" -v --splits ${TEST_SPLITS} --group=${TEST_GROUP}
1 change: 0 additions & 1 deletion dev/windows/setup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ cd \conda_src || goto :error
CALL \conda_bin\scripts\activate.bat || goto :error
CALL conda create -n conda-test-env -y python=%PYTHON% pywin32 --file=tests\requirements.txt || goto :error
CALL conda activate conda-test-env || goto :error
CALL conda install -yq pip conda-build conda-verify || goto :error
CALL conda update openssl ca-certificates certifi || goto :error
python -m conda init cmd.exe --dev || goto :error
goto :EOF
Expand Down
6 changes: 4 additions & 2 deletions tests/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
from conda.cli.conda_argparse import do_call
from conda.cli.main import generate_parser, init_loggers
from conda.common.compat import (ensure_text_type, iteritems, string_types, text_type,
encode_arguments)
encode_arguments, on_win, on_mac)
from conda.common.io import argv, captured, disable_logger, env_var, stderr_log_level, dashlist, env_vars
from conda.common.path import get_bin_directory_short_path, get_python_site_packages_short_path, \
pyc_path
Expand All @@ -66,7 +66,7 @@
from conda.models.records import PackageRecord
from conda.models.version import VersionOrder
from conda.resolve import exactness_and_number_of_deps
from conda.utils import massage_arguments, on_win
from conda.utils import massage_arguments

from .cases import BaseTestCase

Expand Down Expand Up @@ -2607,6 +2607,7 @@ def test_multiline_run_command(self):
assert env_which_etc
assert not errs_etc

@pytest.mark.xfail(on_mac, reason="see #11128")
def test_init_dev_and_NoBaseEnvironmentError(self):
# This specific python version is named so that the test suite uses an
# old python build that still hacks 'Library/bin' into PATH. Really, we
Expand Down Expand Up @@ -2787,6 +2788,7 @@ def test_run_script_called(self):
assert package_is_installed(prefix, 'openssl')
assert rs.call_count == 1

@pytest.mark.xfail(on_mac, reason="known broken; see #11127")
def test_post_link_run_in_env(self):
test_pkg = '_conda_test_env_activated_when_post_link_executed'
# a non-unicode name must be provided here as activate.d scripts
Expand Down

0 comments on commit 09cb6bd

Please sign in to comment.