-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use conda-lock with the conda-lock project (dogfood) (#359)
Co-authored-by: maresb <[email protected]>
- Loading branch information
Showing
6 changed files
with
10,395 additions
and
10 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Run conda-lock to update dependencies | ||
|
||
on: | ||
push: | ||
workflow_dispatch: | ||
schedule: | ||
# At 5:28am UTC Monday and Thursday | ||
- cron: 28 5 * * MON,THU | ||
|
||
jobs: | ||
conda-lock: | ||
defaults: | ||
run: | ||
# Ensure the environment is activated | ||
# <https://github.com/mamba-org/provision-with-micromamba#important> | ||
shell: bash -l {0} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install Micromamba | ||
uses: mamba-org/setup-micromamba@v1 | ||
with: | ||
environment-file: environments/conda-lock.yml | ||
environment-name: conda-lock-dev | ||
|
||
- name: Install conda-lock from branch | ||
run: pip install --editable . | ||
|
||
- name: Run conda-lock to recreate lockfile from scratch | ||
run: | | ||
rm environments/conda-lock.yml | ||
conda-lock \ | ||
--file=environments/dev-environment.yaml \ | ||
--file=pyproject.toml \ | ||
--lockfile=environments/conda-lock.yml | ||
- name: Open a pull request | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
# # The default GITHUB_TOKEN doesn't allow other workflows to trigger. | ||
# # Thus if there are tests to be run, they won't be run. For more info, | ||
# # see the note under | ||
# # <https://github.com/peter-evans/create-pull-request#action-inputs>. | ||
# # One possible workaround is to specify a Personal Access Token (PAT). | ||
# # This PAT should have read-write permissions for "Pull Requests" | ||
# # and read-write permissions for "Contents". | ||
# token: ${{ secrets.GH_PAT_FOR_PR }} | ||
commit-message: Relock dependencies | ||
title: Relock dependencies | ||
body: > | ||
This pull request relocks the dependencies with conda-lock. | ||
branch: relock-deps | ||
labels: conda-lock | ||
reviewers: maresb | ||
delete-branch: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,15 @@ | ||
|
||
## Developing | ||
|
||
For the most up-to-date instructions see the github actions [test.yml workflow](./.github/workflows/test.yml) | ||
|
||
1. Ensure conda and mamba are installed. Install [mambaforge](https://github.com/conda-forge/miniforge#mambaforge) if you're otherwise not sure which one to pick. | ||
2. `mamba create -n conda-lock-dev pip pytest-cov pytest-xdist` | ||
1. Ensure that Conda, Mamba, and Micromamba are installed. Install [mambaforge](https://github.com/conda-forge/miniforge#mambaforge) if you're otherwise not sure which Conda distribution to pick. | ||
2. `micromamba create --name=conda-lock-dev --category=main --category=dev --file=environments/conda-lock.yml` | ||
3. `conda activate conda-lock-dev` | ||
4. `python -m pip install -r requirements-dev.txt` | ||
5. `pip install -e . --force-reinstall` | ||
4. `pip install --no-deps --editable .` | ||
|
||
Run the tests to ensure that everything is running correctly. Due to the nature of this project, it hits remote webservers regularly so some tests occasionally fail. This is a normal part of conda-lock development. If you're not sure if your env is borked or the remote webserver is just being flaky, run the tests again. If you're still not sure you can open an issue about. | ||
|
||
7. `pytest` | ||
5. `pytest` | ||
|
||
Whilst not strictly necessary; the CI run using github actions will run pre-commit in order to reduce development friction you may want to install the pre-commit hooks: | ||
|
||
8. `pre-commit install` | ||
|
||
6. `pre-commit install` |
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
Oops, something went wrong.