Skip to content
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

Add micromamba deinit in post.js #89

Merged
merged 8 commits into from Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
102 changes: 102 additions & 0 deletions .github/workflows/test_deinit.yml
@@ -0,0 +1,102 @@
name: Test deinit

on:
push:
branches:
- main
pull_request: null

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test_deinit:
name: Test deinit - ${{ matrix.os }} ${{ matrix.rcfile }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# .bash_profile gets initialized in p-w-m ubuntu-latest instead of .bashrc like in micromamba
- { os: ubuntu-latest, rcfile: ~/.bash_profile }
- { os: ubuntu-latest, rcfile: ~/.zshrc }
# TODO zshrc not yet initialized in macos p-w-m
# https://github.com/mamba-org/mamba/issues/925
- { os: macos-latest, rcfile: ~/.bash_profile }
- { os: windows-latest, rcfile: ~/.bash_profile }
- { os: windows-latest, rcfile: ~/Documents/WindowsPowerShell/profile.ps1 }
steps:
- uses: actions/checkout@v3

# This is a fork of webiny/action-post-run. If webiny/action-post-run is updated, this should be updated as well.
- uses: lisanna-dettwyler/action-post-run@d053b9b43d788b87a409f6cdb3b6fc87c6c8a4fe
with:
# assert that mamba initialize is not in rcfile
# if the rcfile is not found, the test will still succeed
run: |
! grep -F "mamba initialize" ${{ matrix.rcfile }}

- uses: ./
with:
environment-file: false

pavelzw marked this conversation as resolved.
Show resolved Hide resolved
test_deinit_false:
name: Test deinit false - ${{ matrix.os }} ${{ matrix.rcfile }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# .bash_profile gets initialized in p-w-m ubuntu-latest instead of .bashrc like in micromamba
- { os: ubuntu-latest, rcfile: ~/.bash_profile }
- { os: ubuntu-latest, rcfile: ~/.zshrc }
# TODO zshrc not yet initialized in macos p-w-m
# https://github.com/mamba-org/mamba/issues/925
- { os: macos-latest, rcfile: ~/.bash_profile }
- { os: windows-latest, rcfile: ~/.bash_profile }
- { os: windows-latest, rcfile: ~/Documents/WindowsPowerShell/profile.ps1 }
steps:
- uses: actions/checkout@v3

# This is a fork of webiny/action-post-run. If webiny/action-post-run is updated, this should be updated as well.
- uses: lisanna-dettwyler/action-post-run@d053b9b43d788b87a409f6cdb3b6fc87c6c8a4fe
with:
# assert that mamba initialize is in rcfile
run: |
grep -F "mamba initialize" ${{ matrix.rcfile }}

- uses: ./
with:
environment-file: false
post-deinit: false

pavelzw marked this conversation as resolved.
Show resolved Hide resolved
test_deinit_auto_old_micromamba:
name: Test deinit auto old micromamba - ${{ matrix.os }} ${{ matrix.rcfile }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# .bash_profile gets initialized in p-w-m ubuntu-latest instead of .bashrc like in micromamba
- { os: ubuntu-latest, rcfile: ~/.bash_profile }
- { os: ubuntu-latest, rcfile: ~/.zshrc }
# TODO zshrc not yet initialized in macos p-w-m
# https://github.com/mamba-org/mamba/issues/925
- { os: macos-latest, rcfile: ~/.bash_profile }
- { os: windows-latest, rcfile: ~/.bash_profile }
- { os: windows-latest, rcfile: ~/Documents/WindowsPowerShell/profile.ps1 }
steps:
- uses: actions/checkout@v3

# This is a fork of webiny/action-post-run. If webiny/action-post-run is updated, this should be updated as well.
- uses: lisanna-dettwyler/action-post-run@d053b9b43d788b87a409f6cdb3b6fc87c6c8a4fe
with:
# assert that mamba initialize is in rcfile
run: |
grep -F "mamba initialize" ${{ matrix.rcfile }}

- uses: ./
with:
environment-file: false
micromamba-version: "0.23.0"
pavelzw marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 9 additions & 0 deletions README.md
Expand Up @@ -96,6 +96,15 @@ condarc-options: |
http: ...
```

### `post-deinit`

Attempt to undo any modifications done to `.bashrc` etc. in the post action of the workflow.
This is useful for self-hosted runners that keep the state of the system.
One of `"auto"`, `"true"` or `"false"`.
If set to `"auto"`, behaves like `"true"` if the micromamba version used supports `micromamba shell deinit` (i.e. `micromamba>=0.25.0`).

Default value: `auto`

<!-- end generated -->

## Example usage
Expand Down
8 changes: 8 additions & 0 deletions action.yml
Expand Up @@ -109,6 +109,14 @@ inputs:
proxy_servers:
http: ...
```
post-deinit:
description: |-
Attempt to undo any modifications done to `.bashrc` etc. in the post action of the workflow.
This is useful for self-hosted runners that keep the state of the system.
One of `"auto"`, `"true"` or `"false"`.
If set to `"auto"`, behaves like `"true"` if the micromamba version used supports `micromamba shell deinit` (i.e. `micromamba>=0.25.0`).
required: true
default: auto

# setup-miniconda options that are not (yet) supported:
#
Expand Down