ci: install mamba on CI

This commit is contained in:
Anand Balakrishnan 2023-10-17 12:15:18 -07:00
parent f5f0b3eb28
commit e9b17f1213
No known key found for this signature in database
2 changed files with 10 additions and 12 deletions

View file

@ -30,6 +30,8 @@ jobs:
with: with:
environment-name: ci environment-name: ci
environment-file: environment.yaml environment-file: environment.yaml
create-args: >-
mamba
init-shell: bash init-shell: bash
cache-environment: true cache-environment: true
post-cleanup: 'all' post-cleanup: 'all'
@ -66,6 +68,8 @@ jobs:
with: with:
environment-name: ci environment-name: ci
environment-file: environment.yaml environment-file: environment.yaml
create-args: >-
mamba
init-shell: bash init-shell: bash
cache-environment: true cache-environment: true
post-cleanup: 'all' post-cleanup: 'all'
@ -104,6 +108,8 @@ jobs:
with: with:
environment-name: ci environment-name: ci
environment-file: environment.yaml environment-file: environment.yaml
create-args: >-
mamba
init-shell: bash init-shell: bash
cache-environment: true cache-environment: true
post-cleanup: 'all' post-cleanup: 'all'
@ -130,6 +136,8 @@ jobs:
with: with:
environment-name: ci environment-name: ci
environment-file: environment.yaml environment-file: environment.yaml
create-args: >-
mamba
init-shell: bash init-shell: bash
cache-environment: true cache-environment: true
post-cleanup: 'all' post-cleanup: 'all'

View file

@ -6,21 +6,11 @@ from pathlib import Path
import nox import nox
import nox.registry import nox.registry
MICROMAMBA = shutil.which("micromamba")
CURRENT_DIR = Path(__file__).parent.resolve() CURRENT_DIR = Path(__file__).parent.resolve()
TARGET_DIR = CURRENT_DIR / "target" TARGET_DIR = CURRENT_DIR / "target"
COVERAGE_DIR = TARGET_DIR / "debug/coverage" COVERAGE_DIR = TARGET_DIR / "debug/coverage"
if MICROMAMBA: if shutil.which("mamba"):
BIN_DIR = CURRENT_DIR / "build" / "bin"
BIN_DIR.mkdir(exist_ok=True, parents=True)
CONDA = BIN_DIR / "conda"
if not CONDA.is_file():
CONDA.hardlink_to(MICROMAMBA)
os.environ["PATH"] = os.pathsep.join([str(BIN_DIR), os.environ["PATH"]])
nox.options.default_venv_backend = "conda"
elif shutil.which("mamba"):
nox.options.default_venv_backend = "mamba" nox.options.default_venv_backend = "mamba"
else: else:
nox.options.default_venv_backend = "conda" nox.options.default_venv_backend = "conda"
@ -143,7 +133,7 @@ def mypy(session: nox.Session):
@nox.session(python=PYTHONS) @nox.session(python=PYTHONS)
def tests(session: nox.Session): def tests(session: nox.Session):
session.conda_install("pytest", "hypothesis", "lark") session.conda_install("pytest", "hypothesis", "lark", "maturin")
session.env.update(ENV) session.env.update(ENV)
try: try:
session.run( session.run(