Repository: dwhswenson/contact_map (language: python)

Issue:
What to do with the new travis.com plan?
https://blog.travis-ci.com/2020-11-02-travis-ci-new-billing

So the big point for us would be:
> For those of you who have been building on public repositories (on travis-ci.com, with no paid subscription), we will upgrade you to our trial (free) plan with a 10K credit allotment (which allows around 1000 minutes in a Linux environment).

So that seems they are giving a *one time* allotment of 1000 minutes (which would get us 67 nightly builds, at 15 min per build, and without you as a user running any other jobs) (The free plan explicitly says it does not replenish credits)

I found two options to go forward:
1) Apply for repeated open-source credits for this project
> We will be offering an allotment of OSS minutes that will be reviewed and allocated on a case by case basis. Should you want to apply for these credits please open a request with Travis CI support stating that you’d like to be considered for the OSS allotment. Please include:

   > Your account name and VCS provider (like travis-ci.com/github/[your account name] )
    How many credits (build minutes) you’d like to request (should your run out of credits again you can repeat
    the process to  request more or discuss a renewable amount)

2) Switch to Azure for CI https://azure.microsoft.com/en-us/blog/announcing-azure-pipelines-with-unlimited-ci-cd-minutes-for-open-source/

@dwhswenson do you have any other options/ an opinion on which way to go forward? (No worries if you don't have time to figure out the switch, I might be able to spend a couple hours figuring that out)

Looking around it seems like Azure is getting more and more adaptation so I am +0.5 on that option but I am willing to default to your opinion here




Discussion / hints:
Ugh, this is going to be a pain. Long run, we may need to switch to Azure, but I'm not sure that Autorelease can maintain single-source for CI structure in that case. I'll have to look into it.

However, path 1 may be quite reasonable. I think we might request a renewable 10k credit (1000 minutes) allotment. If that's ~67 builds, it's a little less than we needed in October, but we were particularly busy in October. It will also encourage us to use a Travis cache to speed up build time, which would probably be a good thing anyway.

FWIW, here's what they are looking for to qualify as "open source" (per project):

1. You are a project lead or regular committer (latest commit in the last month)
2. Project must be at least 3 months old and is in active development (with regular commits and activity)
3. Project meets the OSD specification
4. Project must not be sponsored by a commercial company or organization (monetary or with employees paid to work on the project)
5. Project can not provide commercial services or distribute paid versions of the software

(from https://travis-ci.community/t/is-travis-educational-still-active-with-the-new-pricing-plan-how-to-enable-it/10456/4)

So we're solid on that here. It's a bit annoying for the various projects that aren't particularly active and just run a nightly build to check that nothing has broken (OPSPiggybacker, Autorelease, CodeModel). I'll probably move those over to Azure to get the feel for it (though they'll use their minutes slowly, since they have fast test suites and only run once/day.)
> but I'm not sure that Autorelease can maintain single-source for CI structure in that case. I'll have to look into it.

Shouldn't [this example](https://elanderson.net/2020/04/azure-devops-pipelines-use-yaml-across-repos/) solve most of your issues?

> I'll probably move those over to Azure to get the feel for it (though they'll use their minutes slowly, since they have fast test suites and only run once/day.)

Working on those as well, started with [Dask-traj](https://github.com/sroet/dask-traj) Which seems to be running on PRs and a nightly build and was not *too* painful to setup (took me 1 or 2 hours, most of which was getting familiar with the interface).
I still need to figure out: 
- How to get the coverage to report back to github, 
- How to *not* get an email for every completed build (now also getting the succesful ones)
- Find a new badge to display for the current build status

I will keep you updated on how those things go
> Shouldn't this example solve most of your issues?

Looks likely! Thanks. I'm starting to play with Azure on a few projects as well. Once I get it running with Autorelease, we can make the switch here.
Status update: https://github.com/dwhswenson/autorelease/issues/76

Fix patch:
diff --git a/.github/workflows/autorelease-default-env.sh b/.github/workflows/autorelease-default-env.sh
new file mode 100644
index 0000000..f1da159
--- /dev/null
+++ b/.github/workflows/autorelease-default-env.sh
@@ -0,0 +1,5 @@
+INSTALL_AUTORELEASE="python -m pip install autorelease==0.2.6"
+if [ -f autorelease-env.sh ]; then
+    source autorelease-env.sh
+fi
+
diff --git a/.github/workflows/autorelease-deploy.yml b/.github/workflows/autorelease-deploy.yml
new file mode 100644
index 0000000..9a8f03b
--- /dev/null
+++ b/.github/workflows/autorelease-deploy.yml
@@ -0,0 +1,33 @@
+name: Autorelease
+on:
+  release:
+    types: [published]
+
+jobs:
+  deploy_pypi:
+    runs-on: ubuntu-latest
+    name: "Deploy to PyPI"
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-python@v2
+        with:
+          python-version: "3.x"
+      - run: |  # TODO: move this to an action
+          source ./.github/workflows/autorelease-default-env.sh
+          if [ -f "autorelease-env.sh" ]; then
+            cat autorelease-env.sh >> $GITHUB_ENV
+          fi
+          eval $INSTALL_AUTORELEASE
+        name: "Install autorelease"
+      - run: |
+          python -m pip install twine wheel
+        name: "Install release tools"
+      - run: |
+          python setup.py sdist bdist_wheel
+          twine check dist/*
+        name: "Build and check package"
+      - uses: pypa/gh-action-pypi-publish@master
+        with:
+          password: ${{ secrets.pypi_password }}
+        name: "Deploy to pypi"
+ 
diff --git a/.github/workflows/autorelease-gh-rel.yml b/.github/workflows/autorelease-gh-rel.yml
new file mode 100644
index 0000000..bb5cd27
--- /dev/null
+++ b/.github/workflows/autorelease-gh-rel.yml
@@ -0,0 +1,29 @@
+name: Autorelease
+on:
+  push:
+    branches:
+      - stable
+
+jobs:
+  release-gh:
+    runs-on: ubuntu-latest
+    name: "Cut release"
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-python@v2
+        with:
+          python-version: "3.7"
+      - run: |  # TODO: move this to an action
+          source ./.github/workflows/autorelease-default-env.sh
+          if [ -f "autorelease-env.sh" ]; then
+            cat autorelease-env.sh >> $GITHUB_ENV
+          fi
+          eval $INSTALL_AUTORELEASE
+        name: "Install autorelease"
+      - run: |
+          VERSION=`python setup.py --version`
+          PROJECT=`python setup.py --name`
+          echo $PROJECT $VERSION
+          autorelease-release --project $PROJECT --version $VERSION --token $AUTORELEASE_TOKEN
+        env:
+          AUTORELEASE_TOKEN: ${{ secrets.AUTORELEASE_TOKEN }}
diff --git a/.github/workflows/autorelease-prep.yml b/.github/workflows/autorelease-prep.yml
new file mode 100644
index 0000000..4967413
--- /dev/null
+++ b/.github/workflows/autorelease-prep.yml
@@ -0,0 +1,60 @@
+name: "Autorelease"
+on:
+  pull_request:
+    branches:
+      - stable
+
+defaults:
+  run:
+    shell: bash
+
+jobs:
+  deploy_testpypi:
+    runs-on: ubuntu-latest
+    name: "Deployment test"
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-python@v2
+        with:
+          python-version: "3.x"
+      - run: |  # TODO: move this to an action
+          source ./.github/workflows/autorelease-default-env.sh
+          if [ -f "autorelease-env.sh" ]; then
+            cat autorelease-env.sh >> $GITHUB_ENV
+          fi
+          eval $INSTALL_AUTORELEASE
+        name: "Install autorelease"
+      - run: |
+          python -m pip install twine wheel
+        name: "Install release tools"
+      - run: |
+          bump-dev-version
+          python setup.py --version
+        name: "Bump testpypi dev version"
+      - run: |
+          python setup.py sdist bdist_wheel
+          twine check dist/*
+        name: "Build and check package"
+      - uses: pypa/gh-action-pypi-publish@master
+        with:
+          password: ${{ secrets.testpypi_password }}
+          repository_url: https://test.pypi.org/legacy/
+        name: "Deploy to testpypi"
+  test_testpypi:
+    runs-on: ubuntu-latest
+    name: "Test deployed"
+    needs: deploy_testpypi
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-python@v2
+        with:
+          python-version: "3.x"
+      - run: |  # TODO: move this to an action
+          source ./.github/workflows/autorelease-default-env.sh
+          if [ -f "autorelease-env.sh" ]; then
+            cat autorelease-env.sh >> $GITHUB_ENV
+          fi
+          eval $INSTALL_AUTORELEASE
+        name: "Install autorelease"
+      - run: test-testpypi
+
diff --git a/.travis.yml b/.travis.yml.disabled
similarity index 100%
rename from .travis.yml
rename to .travis.yml.disabled
diff --git a/README.md b/README.md
index 455e753..19200ec 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,13 @@
 [![Documentation Status](https://readthedocs.org/projects/contact-map/badge/?version=latest)](http://contact-map.readthedocs.io/en/latest/?badge=latest)
-[![Build Status](https://travis-ci.com/dwhswenson/contact_map.svg?branch=master)](https://travis-ci.com/dwhswenson/contact_map)
+![Unit tests](https://github.com/dwhswenson/contact_map/workflows/Unit%20tests/badge.svg)
 [![Windows Build status](https://ci.appveyor.com/api/projects/status/em3fo96sjrg2vmcc/branch/master?svg=true)](https://ci.appveyor.com/project/dwhswenson/contact-map/branch/master)
-[![Coverage Status](https://coveralls.io/repos/github/dwhswenson/contact_map/badge.svg?branch=master)](https://coveralls.io/github/dwhswenson/contact_map?branch=master)
+[![codecov](https://codecov.io/gh/dwhswenson/contact_map/branch/master/graph/badge.svg?token=4so8QmiC5W)](https://codecov.io/gh/dwhswenson/contact_map)
 [![PyPI](https://img.shields.io/pypi/v/contact-map.svg)](https://pypi.python.org/pypi/contact-map/)
 [![conda-forge](https://img.shields.io/conda/v/conda-forge/contact_map.svg)](https://github.com/conda-forge/contact_map-feedstock)
 
+[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/dwhswenson/contact_map/master)
 [![Codacy Badge](https://api.codacy.com/project/badge/Grade/f7f3cf53698e4655ac8895f13fa5dea6)](https://www.codacy.com/app/dwhswenson/contact_map?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=dwhswenson/contact_map&amp;utm_campaign=Badge_Grade)
 [![Maintainability](https://api.codeclimate.com/v1/badges/84768756d594176d8da6/maintainability)](https://codeclimate.com/github/dwhswenson/contact_map/maintainability)
-[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/dwhswenson/contact_map/master)
 # Contact Map Explorer
 
 This package provides tools for analyzing and exploring contacts
diff --git a/autorelease_check.py b/autorelease_check.py
index 9ac0536..5a234ca 100644
--- a/autorelease_check.py
+++ b/autorelease_check.py
@@ -25,5 +25,5 @@
     )
     checker.release_branches = RELEASE_BRANCHES + [RELEASE_TAG]
 
-    tests = checker.select_tests_from_sysargs()
+    tests = checker.select_tests()
     n_fails = checker.run_as_test(tests)


Test patch:
diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml
new file mode 100644
index 0000000..05d9d68
--- /dev/null
+++ b/.github/workflows/unit-tests.yml
@@ -0,0 +1,65 @@
+name: "Unit tests"
+on:
+  pull_request:
+    branches:
+      - master
+      - stable
+  push:
+    branches:
+      - master
+    tags:
+      - "v*"
+  schedule:
+    - cron: "20 5 * * *"
+
+defaults:
+  run:
+    shell: bash -l {0}
+
+jobs:
+  test_suite:
+    runs-on: ubuntu-latest
+    name: "Unit Tests"
+    strategy:
+      matrix:
+        CONDA_PY:
+          - 3.9
+          - 3.8
+          - 3.7
+          - 3.6
+        MDTRAJ: ["mdtraj-release"]
+        include:
+          - CONDA_PY: 3.9
+            MDTRAJ: "mdtraj-dev"
+
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-python@v2
+      - uses: conda-incubator/setup-miniconda@v2
+        with:
+          auto-update-python: true
+          python-version: ${{ matrix.CONDA_PY }}
+      - name: "Install"
+        env:
+          MDTRAJ: ${{ matrix.MDTRAJ }}
+        run: |
+          source ci/pip-install/install_requirements.sh
+          pip install -e .
+          pip install -U -r ci/pip-install/testing_requirements.txt
+          if [ "$MDTRAJ" = "mdtraj-dev" ]; then
+            pip install --upgrade --force-reinstall -r ci/pip-install/mdtraj_dev.txt
+            pip install -r optional_installs.txt
+          fi
+      - name: "Versions"
+        run: pip list
+      - name: "Autorelease check"
+        run: python autorelease_check.py
+      - name: "Tests"
+        env:
+          PY_COLORS: "1"
+        run: |
+          python -c "import contact_map"
+          py.test -vv --cov=contact_map --cov-report xml
+      - name: "Report coverage"
+        if: ${{ github.event }} != "schedule"
+        run: bash <(curl -s https://codecov.io/bash)