Skip to content

Commit 40a0e8b

Browse files
Update README to match functionality
Assisted-by: GPT-5.4 GitHub Copilot <copilot@github.com>
1 parent 8e53d05 commit 40a0e8b

1 file changed

Lines changed: 94 additions & 36 deletions

File tree

README.md

Lines changed: 94 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,91 @@
22

33
## Overview
44

5-
This repository contains GitHub actions for various conda-related tasks, such as verifying a conda package, and uploading a conda package to Anaconda Cloud.
5+
This repository contains GitHub actions for common conda package workflows, including installing a package into a test environment, verifying that it imports correctly, removing old packages from Anaconda Cloud, and publishing packages to Anaconda Cloud.
66

7-
These actions primarily assumes that you have built a `<package-name>.conda`,
8-
and that it is located in a conda-style channel directory (see [conda-index](https://github.com/conda/conda-index)).
7+
Some actions assume you have already built a `.conda` package. When using a local package artifact, place it in a conda-style channel directory (see [conda-index](https://github.com/conda/conda-index)).
98

109
Available actions:
1110

12-
- [pkg-verify](#pkg-verify): Verify a conda package by installing it with `micromamba` and ensuring it is importable by Python, and that the version reported by conda and python match.
11+
- [pkg-install](#pkg-install): Create a micromamba environment and install a conda package into it.
12+
- [pkg-verify](#pkg-verify): Verify an already-installed conda package by importing it in Python and checking that the conda and Python versions match.
1313
- [pkg-remove](#pkg-remove): Clean up old conda packages from Anaconda Cloud.
1414
- [publish](#publish): Publish a conda package to Anaconda Cloud.
1515

16+
## pkg-install
17+
18+
GitHub action to create a micromamba environment, optionally index a local conda channel, and install a conda package.
19+
20+
#### Usage
21+
22+
Full list of available inputs in [`pkg-install/action.yml`](pkg-install/action.yml).
23+
24+
Inputs:
25+
26+
| Input | Description | Required | Default |
27+
| ---------------- | --------------------------------------------------------------------------------- | -------- | ------- |
28+
| `package-name` | Name of the conda package to install | Yes | - |
29+
| `local-channel` | Path to a local conda channel containing the package | No | - |
30+
| `python-version` | Python version to install into the test environment (for example `3.10`) | No | - |
31+
| `extra-channels` | Additional conda channels to use during installation | No | - |
32+
33+
Outputs:
34+
35+
| Output | Description |
36+
| ------------------- | ---------------------------------------- |
37+
| `conda_env` | Name of the created conda environment |
38+
| `conda_install_dir` | Filesystem path of the created env |
39+
40+
Example:
41+
42+
```yaml
43+
jobs:
44+
pkg-install:
45+
runs-on: ubuntu-latest
46+
defaults:
47+
run:
48+
shell: bash -el {0}
49+
steps:
50+
- name: Download conda package artifact
51+
uses: actions/download-artifact@main
52+
with:
53+
name: artifact-conda-package
54+
path: /tmp/local-channel/linux-64
55+
56+
- name: Install Conda Package
57+
id: install
58+
uses: neutrons/conda-actions/pkg-install@main
59+
with:
60+
local-channel: /tmp/local-channel
61+
package-name: ${{ env.PKG_NAME }}
62+
python-version: "3.11"
63+
extra-channels: mantid neutrons pyoncat
64+
```
65+
1666
## pkg-verify
1767
18-
GitHub action to verify a conda package by installing it with `micromamba` and ensuring it is importable by Python, and that the version reported by conda and python match.
68+
GitHub action to verify a conda package that is already installed in a conda environment. The action imports the package in Python and ensures that the version reported by conda and Python match.
1969
2070
#### Usage
2171
22-
Full list of available inputs in [`pkg-verify/action.yaml`](#pkg-verify/action.yaml).
72+
Full list of available inputs in [`pkg-verify/action.yaml`](pkg-verify/action.yaml).
2373

2474
Inputs:
2575

2676
| Input | Description | Required | Default |
2777
| ---------------- | --------------------------------------------------------------------------------- | -------- | ------- |
28-
| `local-channel` | Path to the local conda channel containing the package to verify | No | - |
2978
| `package-name` | Name of the conda package | Yes | - |
3079
| `module-name` | Name of the Python module to import (if different from package name) | No | - |
31-
| `python-version` | Python version to use for testing (e.g., `3.10`) | No | `3.10` |
32-
| `extra-channels` | Additional conda channels to use for dependencies (comma-separated) | No | - |
33-
| `extra-commands` | Additional shell commands to run after installing the package (newline-separated) | No | - |
80+
| `conda-env-name` | Name of the conda environment where the package is already installed | Yes | - |
81+
| `extra-commands` | Additional shell commands to run during verification (newline-separated) | No | - |
3482

3583
Example usage in a GitHub workflow:
3684

3785
```yaml
3886
jobs:
3987
# First, build your conda package and upload it as an artifact:
4088
build:
89+
runs-on: ubuntu-latest
4190
steps:
4291
- name: Build conda package
4392
run: |
@@ -49,10 +98,10 @@ jobs:
4998
name: artifact-conda-package
5099
path: ${{ env.PKG_NAME }}-*.conda
51100
52-
# Then, to verify the conda package:
101+
# Then install and verify the conda package:
53102
pkg-verify:
54103
needs: build
55-
run-on: ubuntu-latest
104+
runs-on: ubuntu-latest
56105
defaults:
57106
run:
58107
shell: bash -el {0}
@@ -63,12 +112,19 @@ jobs:
63112
name: artifact-conda-package
64113
path: /tmp/local-channel/linux-64
65114
66-
- name: Verify Conda Package
67-
uses: neutrons/conda-actions/pkg-verify@main
115+
- name: Install Conda Package
116+
id: install
117+
uses: neutrons/conda-actions/pkg-install@main
68118
with:
69119
local-channel: /tmp/local-channel
70120
package-name: ${{ env.PKG_NAME }}
71121
extra-channels: mantid neutrons pyoncat
122+
123+
- name: Verify Conda Package
124+
uses: neutrons/conda-actions/pkg-verify@main
125+
with:
126+
package-name: ${{ env.PKG_NAME }}
127+
conda-env-name: ${{ steps.install.outputs.conda_env }}
72128
```
73129

74130
## pkg-remove
@@ -78,7 +134,7 @@ keeping the N most recent versions.
78134

79135
#### Usage
80136

81-
Full list of available inputs in [`pkg-remove/action.yaml`](#pkg-remove/action.yaml).
137+
Full list of available inputs in [`pkg-remove/action.yaml`](pkg-remove/action.yaml).
82138

83139
Inputs:
84140

@@ -87,7 +143,7 @@ Inputs:
87143
| `anaconda_token` | Anaconda.org API token | Yes | - |
88144
| `organization` | Anaconda.org organization or user name | Yes | - |
89145
| `package_name` | Name of the conda package to clean up | Yes | - |
90-
| `label` | Label to target for cleanup (e.g., `dev`, `nightly`, `rc`) | No | - |
146+
| `label` | Label to target for cleanup (e.g., `dev`, `nightly`, `rc`) | No | `dev` |
91147
| `keep` | Number of most recent package versions to keep | No | `5` |
92148
| `dry_run` | If `true`, only print what would be deleted without actually deleting | No | `false` |
93149

@@ -116,23 +172,23 @@ jobs:
116172

117173
## publish
118174

119-
GitHub action to publish a conda package to Anaconda Cloud.
175+
GitHub action to publish a pre-built conda package to Anaconda Cloud.
120176

121177
This action assumes that:
122178

123-
- The package has already been built and is available in a local conda channel directory
124-
- Either `anaconda-client` or `pixi` is installed in the environment where the action is running
179+
- The package has already been built and is available at the path given by `package-path`
180+
- Either `anaconda-client` is available in `PATH`, or `pixi` is available so the action can run or install `anaconda-client`
125181

126-
If `label` is not provided, the action will attempt to determine the label from the `github-ref`:
182+
If `label` is not provided, the action will attempt to determine it from `github-ref`:
127183

128-
- If the ref is tagged `refs/tags/v*`, the package will be published to the `main` label
129184
- If the ref is tagged `refs/tags/v*rc*`, the package will be published to the `rc` label
185+
- If the ref is tagged `refs/tags/v*`, the package will be published to the `main` label
130186
- If the ref is tagged `refs/heads/next`, the package will be published to the `dev` label
131187
- If the label cannot be determined from the ref, the action will fail
132188

133189
#### Usage
134190

135-
Full list of available inputs in [`publish/action.yaml`](#publish/action.yaml).
191+
Full list of available inputs in [`publish/action.yaml`](publish/action.yaml).
136192

137193
Inputs:
138194

@@ -141,8 +197,8 @@ Inputs:
141197
| `anaconda-token` | Anaconda.org API token | Yes | - |
142198
| `organization` | Anaconda.org organization or user name | Yes | - |
143199
| `package-path` | Path to the conda package to publish | Yes | - |
144-
| `github-ref` | GitHub ref (e.g., `refs/tags/v1.0.0`) to determine the label | No | github.ref |
145-
| `label` | Label to apply to the package (e.g., `dev`, `nightly`, `rc`) | No | - |
200+
| `github-ref` | GitHub ref (for example `refs/tags/v1.0.0`) used when inferring the label | No | `github.ref` |
201+
| `label` | Label to apply to the package (e.g., `main`, `dev`, `nightly`, `rc`) | No | inferred from `github-ref` |
146202
| `force` | If `true`, overwrite existing package with the same version | No | `false` |
147203
| `dry-run` | If `true`, print the upload command and skip publishing | No | `false` |
148204

@@ -151,19 +207,21 @@ Example:
151207
```yaml
152208
jobs:
153209
publish:
154-
- uses: actions/checkout@main
210+
runs-on: ubuntu-latest
211+
steps:
212+
- uses: actions/checkout@main
155213
156-
- uses: prefix-dev/setup-pixi@main
214+
- uses: prefix-dev/setup-pixi@main
157215
158-
- name: Build package
159-
run: |
160-
# steps to build your .conda package, for example:
161-
pixi build
216+
- name: Build package
217+
run: |
218+
# steps to build your .conda package, for example:
219+
pixi build
162220
163-
- name: Publish package to Anaconda Cloud
164-
uses: neutrons/conda-actions/publish@main
165-
with:
166-
anaconda-token: ${{ secrets.ANACONDA_TOKEN }}
167-
organization: neutrons
168-
package-path: my-package-*.conda
221+
- name: Publish package to Anaconda Cloud
222+
uses: neutrons/conda-actions/publish@main
223+
with:
224+
anaconda-token: ${{ secrets.ANACONDA_TOKEN }}
225+
organization: neutrons
226+
package-path: my-package-*.conda
169227
```

0 commit comments

Comments
 (0)