Skip to content

Commit

Permalink
Update micromamba installation process, refactor options (#185)
Browse files Browse the repository at this point in the history
Co-authored-by: Pavel Zwerschke <pavelzw@gmail.com>
Co-authored-by: Jannik Wibker <jannikwibker@gmail.com>
  • Loading branch information
3 people authored Jan 23, 2024
1 parent 5436597 commit 8767fb7
Show file tree
Hide file tree
Showing 21 changed files with 52,851 additions and 51,533 deletions.
5 changes: 2 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
ignorePatterns: ['dist/**/*', 'build/**/*'],
ignorePatterns: ['dist/**/*'],
extends: ['standard', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
parser: '@typescript-eslint/parser',
parserOptions: {
Expand All @@ -9,10 +9,9 @@ module.exports = {
rules: {
'import/order': 'error',
'no-use-before-define': 'off',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'n/no-callback-literal': 'off',
'@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }],
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-use-before-define': 'error',
'prettier/prettier': [
'error',
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,23 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile
run: pnpm install

- name: Rebuild the dist/ directory
run: pnpm build

- name: Generate third party license disclaimer
run: pnpm run generate-third-party-license-disclaimer

# Cannot compare license.txt file at the moment as the output of pnpm is non-deterministic
# https://github.com/pnpm/pnpm/issues/7224
- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol dist/* | wc -l)" -gt "0" ]; then
if [ "$(git diff --ignore-space-at-eol dist/*.{js,js.map} | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/test-download.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Test download

on:
push:
branches: [main]
pull_request:
branches: [main]
merge_group:


jobs:
ensure-download:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
echo "exit 1" >> micromamba
sudo cp micromamba /usr/bin/micromamba
sudo chmod +x /usr/bin/micromamba
- uses: ./
with:
environment-name: test
create-args: >-
python
download-micromamba: true
- run: |
micromamba --version
ensure-local-default:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
curl -Ls https://github.com/mamba-org/micromamba-releases/releases/latest/download/micromamba-linux-64 > micromamba
sudo cp micromamba /usr/bin/micromamba
sudo chmod +x /usr/bin/micromamba
- uses: ./
with:
environment-name: test
create-args: >-
python
micromamba-url: https://invalid.domain
4 changes: 2 additions & 2 deletions .github/workflows/test-post-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
${{ matrix.env-exists }}test -d ~/micromamba/envs/env-name
${{ matrix.root-exists }}test -d ~/micromamba
${{ matrix.binary-exists }}test -f ~/micromamba-bin/micromamba
${{ matrix.binary-exists }}test -f ~/micromamba-bin/.condarc
${{ matrix.binary-exists }}test -f ${{ runner.temp }}/setup-micromamba/.condarc
- uses: ./
with:
environment-file: 'test/environment.yml'
Expand All @@ -59,4 +59,4 @@ jobs:
test -d ~/micromamba/envs/env-name
test -d ~/micromamba
test -f ~/micromamba-bin/micromamba
test -f ~/micromamba-bin/.condarc
test -f ${{ runner.temp }}/setup-micromamba/.condarc
7 changes: 6 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,14 @@ jobs:
init-shell: none
environment-file: test/environment.yml
- run: |
echo $PATH
echo "$(which micromamba)"
echo "$(type micromamba)"
echo "$(which micromamba-shell)"
echo "${{ runner.temp }}"
which micromamba | grep /home/runner/micromamba-bin/micromamba
type micromamba | grep "micromamba is /home/runner/micromamba-bin/micromamba"
which micromamba-shell | grep /home/runner/micromamba-bin/micromamba-shell
which micromamba-shell | grep "${{ runner.temp }}/setup-micromamba/micromamba-shell"
shell: bash -el {0}
use-micromamba-from-path:
Expand Down
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,22 @@ You also might want to alter the default micromamba installation location to a t
micromamba-binary-path: ${{ runner.temp }}/bin/micromamba
```

You can also use a pre-installed micromamba binary by setting `micromamba-binary-path` to the path of the binary and specifying `download-micromamba: false`.
You can control the download behavior of micromamba with the options `download-micromamba` and `micromamba-binary-path`.

| Micromamba on `$PATH` | `download-micromamba` | `micromamba-binary-path` | Behavior |
|----------------|-----------------------|--------------------------|------------------------------------|
| No | unset | unset | Download to default location |
| No | unset | set | Download to specified path |
| No | false | unset | Error |
| No | false | set | Use binary (absolute path) |
| No | true | unset | Download to default location |
| No | true | set | Download to specified path |
| Yes | unset | unset | Use binary (from PATH) |
| Yes | unset | set | Download to specified path |
| Yes | false | unset | Use binary (from PATH) |
| Yes | false | set | Use binary (specified path) |
| Yes | true | unset | Download to default location |
| Yes | true | set | Download to specified path |

```yml
- uses: mamba-org/setup-micromamba@v1
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,5 @@ outputs:

runs:
using: node20
main: dist/index.js
main: dist/main.js
post: dist/post.js
Loading

0 comments on commit 8767fb7

Please sign in to comment.