Skip to content

Commit

Permalink
DEV/TST/DOC: environment YAML; GH wkflw; dev docs
Browse files Browse the repository at this point in the history
  • Loading branch information
fedarko committed Aug 24, 2023
1 parent 7a12c62 commit e1c0ec0
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 7 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Based on
# https://github.com/fedarko/strainFlye/blob/main/.github/workflows/main.yml,
# which was in turn "[based] roughly on the main.yml and standalone.yml
# workflows in
# https://github.com/biocore/empress/blob/master/.github/workflows/,
# and on https://docs.github.com/en/actions/quickstart". It's copy-and-paste
# all the way down baybee
name: wotplot CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]

steps:

# Updating from v2 to v3 to match, as of writing,
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
- name: Check out code
uses: actions/checkout@v3

# https://github.com/conda-incubator/setup-miniconda#example-3-other-options
- name: Install conda dependencies
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: wotplot
environment-file: environment.yml
python-version: ${{ matrix.python-version }}

# We need to keep saying "run this command from within the new conda
# environment", and we can do this easily by prefixing commands with
# "conda run -n" (as done in EMPress' main.yml file, linked above).
#
# I don't know of a more elegant way to do this; I do know that
# installing everything into the "base" environment (as done in, e.g.,
# https://autobencoder.com/2020-08-24-conda-actions) would remove the
# need to keep re-activating the new environment, but it'd have
# the effect of polluting the base environment (which is not ideal
# practice, according to
# https://github.com/marketplace/actions/setup-miniconda#environment-activation).
- name: Install wotplot (and pip dependencies)
run: conda run -n wotplot pip install -e .[dev,viz]

- name: Lint and stylecheck
run: conda run -n wotplot make stylecheck

- name: Run tests
run: conda run -n wotplot make test

- name: Upload code coverage information to Codecov
uses: codecov/codecov-action@v2
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,15 @@ some discussion of this.

## Setting up a development environment

Something like the following should work. This assumes that you have mamba and
conda installed already. (You could also replace `mamba` in the first command
with `conda` if you only have conda installed, but I recommend using mamba;
it's a lot faster.)
First, fork wotplot. Then download the code from your fork.
Something like the following should work; this assumes that you have conda
installed.

```bash
mamba create -n wotplot "python>=3.6" numpy cython
conda activate wotplot
git clone https://github.com/fedarko/wotplot.git
git clone https://github.com/your-github-username-goes-here/wotplot.git
cd wotplot
conda env create -f environment.yml
conda activate wotplot
pip install -e .[dev,viz]
```

Expand Down
9 changes: 9 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: wotplot
channels:
- conda-forge
- defaults
dependencies:
- python >= 3.6
- cython
- pip
- numpy

0 comments on commit e1c0ec0

Please sign in to comment.