Use js-yaml for environment-name parsing #311
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
merge_group: | |
jobs: | |
no-environment-file: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./ | |
with: | |
environment-name: test | |
create-args: >- | |
python | |
cython | |
- run: | | |
micromamba info | grep -q "environment : test" | |
shell: bash -el {0} | |
environment-file: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./ | |
with: | |
environment-file: 'test/environment.yml' | |
- run: | | |
micromamba info | grep -q "environment : env-name" | |
shell: bash -el {0} | |
no-environment: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./ | |
- run: | | |
micromamba info | grep -q "environment : None (not found)" | |
shell: bash -el {0} | |
micromamba-old-version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./ | |
with: | |
micromamba-version: 1.2.0-1 | |
environment-file: 'test/environment.yml' | |
- run: test "$(micromamba --version)" = 1.2.0 | |
shell: bash -el {0} | |
micromamba-shell: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./ | |
with: | |
init-shell: '' | |
environment-file: '' | |
create-args: pytest | |
environment-name: test | |
- run: | | |
pytest --version | |
python --version | |
shell: micromamba-shell {0} | |
bash: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./ | |
with: | |
init-shell: bash | |
environment-file: 'test/environment.yml' | |
- run: | | |
micromamba info | grep -q "environment : env-name" | |
shell: bash -el {0} | |
multiple-shell-init: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./ | |
with: | |
init-shell: >- | |
bash | |
powershell | |
environment-file: 'test/environment.yml' | |
- run: | | |
micromamba info | grep -q "environment : env-name" | |
shell: bash -el {0} | |
- name: micromamba info (pwsh) | |
run: micromamba info | |
shell: pwsh | |
# TODO: powershell equivalent of `micromamba info | grep -q "environment : env-name"` | |
cmd: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./ | |
with: | |
init-shell: cmd.exe | |
environment-file: 'test/environment.yml' | |
- name: micromamba info (cmd.exe) | |
run: micromamba info | |
shell: cmd /C CALL {0} | |
# TODO: cmd equivalent of `micromamba info | grep -q "environment : env-name"` | |
powershell: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./ | |
with: | |
init-shell: powershell | |
environment-file: 'test/environment.yml' | |
- name: micromamba info (pwsh) | |
run: micromamba info | |
shell: pwsh | |
- name: micromamba info (powershell) | |
if: matrix.os == 'windows-latest' | |
run: micromamba info | |
shell: powershell | |
# TODO: powershell equivalent of `micromamba info | grep -q "environment : env-name"` | |
env-variable: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./ | |
with: | |
environment-file: 'test/environment.yml' | |
- run: | # this should work even without `bash -l {0}` | |
[ -n "$MAMBA_ROOT_PREFIX" ] | |
[ -n "$MAMBA_EXE" ] | |
[ -n "$CONDARC" ] | |
custom-condarc: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./ | |
with: | |
environment-file: 'test/environment.yml' | |
condarc-file: 'test/.condarc' | |
- run: | # this should only work when the pytorch channel is loaded, i.e., the custom condarc is used | |
micromamba search pytorch=2.0.0 | grep -q "pytorch 2.0.0 py3.10_cpu_0 pytorch" | |
shell: bash -el {0} | |
conda-lock: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./ | |
with: | |
environment-file: 'test/conda-lock.yml' | |
environment-name: locked-env | |
- run: | | |
micromamba list | grep -q "python 3.11.3 h2755cc3_0_cpython conda-forge" | |
shell: bash -el {0} | |
comment-in-environment-file: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./ | |
with: | |
environment-file: 'test/environment2.yml' | |
- run: | | |
micromamba info | grep -q "environment : env-name2" | |
shell: bash -el {0} | |
- run: | | |
python --version | grep -q "Python 3.10.1" | |
# micromamba-shell uses the environment-name inferred by setup-micromamba | |
shell: micromamba-shell {0} | |
output-environment-path-env-file: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./ | |
id: setup-micromamba | |
with: | |
environment-file: 'test/environment.yml' | |
- run: | | |
test ${{ steps.setup-micromamba.outputs.environment-path }} = "$HOME/micromamba/envs/env-name" | |
ls ${{ steps.setup-micromamba.outputs.environment-path }} | |
output-environment-path-env-name-overwrite: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./ | |
id: setup-micromamba | |
with: | |
environment-file: 'test/environment.yml' | |
environment-name: test | |
- run: | | |
test "${{ steps.setup-micromamba.outputs.environment-path }}" = /home/runner/micromamba/envs/test | |
ls "${{ steps.setup-micromamba.outputs.environment-path }}" | |
output-environment-path-custom-root-prefix: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./ | |
id: setup-micromamba | |
with: | |
environment-name: test | |
micromamba-root-path: /home/runner/custom-micromamba-root-prefix | |
- run: | | |
test "${{ steps.setup-micromamba.outputs.environment-path }}" = /home/runner/custom-micromamba-root-prefix/envs/test | |
ls "${{ steps.setup-micromamba.outputs.environment-path }}" | |
output-no-environment-path: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./ | |
id: setup-micromamba | |
- run: | | |
test "${{ steps.setup-micromamba.outputs.environment-path }}" = "" |