-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from daler/v1.0rc
V1.0rc
- Loading branch information
Showing
39 changed files
with
2,054 additions
and
1,587 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 |
---|---|---|
|
@@ -2,71 +2,57 @@ name: main | |
on: [push] | ||
|
||
jobs: | ||
conda-env: | ||
test: | ||
strategy: | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10"] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
|
||
- uses: actions/checkout@v4 | ||
- name: git setup | ||
# Set up git and export env vars to be used in later steps. | ||
# Note the unconventional mechanism for exporting envs by appending to | ||
# $GITHUB_ENV. | ||
id: git-setup | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Action" | ||
echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV | ||
echo "WORKDIR=$(pwd)" >> $GITHUB_ENV | ||
- name: load cached conda env | ||
# Load cached env. | ||
# This looks for a cache based on the hash of requirements.txt and | ||
# test-requirements.txt; if it's found the cached directory is | ||
# restored. There's an extra "v1" on the end so it can be forced to be | ||
# regenerated when needed. | ||
id: cache-env | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/test-env | ||
key: ${{ hashFiles('requirements.txt') }}-${{ hashFiles('test-requirements.txt') }}-v1 | ||
|
||
|
||
- name: build new conda env | ||
# Build cache if needed. | ||
# Only runs if there was a cache miss. If this is created. there's | ||
# a "Post load cached env" job (which is automatically created, it's | ||
# not defined here) that will load this into the cache for use next | ||
# time. | ||
if: steps.cache-env.outputs.cache-hit != 'true' | ||
run: | | ||
eval "$(conda shell.bash hook)" | ||
conda create -p /tmp/test-env -y --file requirements.txt --file test-requirements.txt --channel conda-forge --channel bioconda | ||
conda install -n base mamba -y --channel conda-forge | ||
mamba create -p ./env -y python=${{ matrix.python-version }} --file test-requirements.txt --channel conda-forge --channel bioconda | ||
conda activate ./env | ||
pip install -e . | ||
- name: run pytests and build docs | ||
- name: run pytests | ||
# pytests and doctests happen here | ||
run: | | ||
eval "$(conda shell.bash hook)" | ||
source activate /tmp/test-env | ||
python setup.py install | ||
conda activate ./env | ||
pytest -vv --doctest-modules trackhub | ||
- name: build docs | ||
run: | | ||
# To make sure that the links in the built docs refer to the correct | ||
# branch on the trackhub-demo repo, we replace the branch names in the | ||
# .rst files. Note if we're on master branch then this is a no-op. | ||
cd doc | ||
find . -name "*.rst" | xargs sed -i "s|trackhub-demo/master|trackhub-demo/$BRANCH|g" | ||
make doctest html | ||
conda deactivate | ||
eval "$(conda shell.bash hook)" | ||
conda activate ./env | ||
conda env export | ||
( | ||
cd doc | ||
find . -name "*.rst" | xargs sed -i "s|trackhub-demo/master|trackhub-demo/$BRANCH|g" | ||
make doctest html | ||
) | ||
- name: test command-line script | ||
# Ensure that the installed command-line script can be run and creates | ||
# the correct files | ||
run: | | ||
eval "$(conda shell.bash hook)" | ||
source activate /tmp/test-env | ||
conda activate ./env | ||
trackhub_from_excel --template | ||
trackhub_from_excel --create-example a.xlsx | ||
trackhub_from_excel --excel-file a.xlsx | ||
|
@@ -77,32 +63,26 @@ jobs: | |
err=1 | ||
fi | ||
done | ||
if [ err == 1 ]; then | ||
if [ $err == 1 ]; then | ||
exit 1 | ||
fi | ||
- name: upload the just-built docs as an artifact | ||
# The built docs will be uploaded as a zip file (called docs.zip). | ||
# This file will be available on the Actions page and can be used to | ||
# inspect the final rendered docs. This is useful when building on | ||
# a branch and for contributors to make corrections to the docs without | ||
# needing to set everything up locally. | ||
uses: actions/upload-artifact@v2 | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: docs | ||
name: docs-${{matrix.python-version}}-${{ github.run_id }} | ||
path: doc/build/html | ||
overwrite: true # v4 requires unique names; this will delete existing before uploading | ||
|
||
|
||
- name: commit built docs to gh-pages branch | ||
# Commit to the gh-pages branch. | ||
# Note that this step is not restricted to the master branch, which | ||
# lets us better test the process. The changes aren't actually pushed | ||
# though unless we're on the master branch (see next step). | ||
- name: commit built docs to gh-pages | ||
# The changes aren't actually pushed unless we're on the master branch | ||
# (see next step). | ||
# | ||
# Note that cloning just the gh-pages branch to a new directory ended | ||
# up being easier than staying in this directory and copying stuff | ||
# around within it. | ||
# Note that cloning just the gh-pages branch to a new directory ended | ||
# up being easier than staying in this directory and copying stuff | ||
# around within it. | ||
run: | | ||
git clone \ | ||
--single-branch \ | ||
|
@@ -145,7 +125,7 @@ jobs: | |
git branch | ||
git checkout $BRANCH | ||
eval "$(conda shell.bash hook)" | ||
source activate /tmp/test-env | ||
conda activate ./env | ||
ci/build_examples.py | ||
|
@@ -192,15 +172,15 @@ jobs: | |
# It's possible that the $BRANCH here in the trackhub repo does not yet | ||
# exist over in the trackhub-demo repo. In that case, we should be good | ||
# to push. | ||
# to push immediately. | ||
if [[ -z $(git ls-remote --heads origin $BRANCH) ]]; then | ||
echo "remote branch $BRANCH does not exist" | ||
git commit -m 'update hub' | ||
git push origin $BRANCH --force | ||
exit 0 | ||
fi | ||
# Otherwise, only push if there are changes. | ||
# Otherwise, only push to existing branch if there are changes. | ||
if git diff origin/$BRANCH --quiet; then | ||
echo "no changes to push to branch $BRANCH!"; | ||
else | ||
|
@@ -219,7 +199,7 @@ jobs: | |
run: | | ||
git checkout $BRANCH | ||
eval "$(conda shell.bash hook)" | ||
source activate /tmp/test-env | ||
conda activate ./env | ||
ci/check_hubs.py | ||
|
@@ -231,13 +211,3 @@ jobs: | |
run: | | ||
ssh-add -D | ||
rm -Rf * | ||
pip-install: | ||
# Separate, parallel job for testing pip installation | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: python setup.py sdist | ||
- run: pip install dist/*.tar.gz | ||
- run: python -c 'import trackhub' |
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,15 @@ | ||
on: workflow_dispatch | ||
jobs: | ||
publish-testpypi: | ||
name: Upload release to Test PyPI | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: testpypi | ||
url: https://pypi.org/p/trackhub | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Publish to Test PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy |
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,3 +1,4 @@ | ||
include ez_setup.py | ||
include *.rst | ||
include *.txt | ||
recursive-include trackhub/test/data * |
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
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
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
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 |
---|---|---|
|
@@ -13,6 +13,6 @@ Contents: | |
assembly_example | ||
groupAutoScale | ||
tracktypes | ||
autodocs | ||
tests | ||
autodocs | ||
changelog |
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,19 @@ | ||
|
||
.. _tests: | ||
|
||
Testing infrastructure | ||
====================== | ||
Tests are run on GitHub Actions, configured in ``.github/workflows/main.yml``. | ||
|
||
In addition to unit tests, now any code in the documentation that shows how to | ||
build example track hubs is handled like this: | ||
|
||
- extract code from documentation (see ``ci/example_hubs.tsv`` for the list of | ||
files from which code is extracted) | ||
- execute code to build track hub (see ``ci//build_examples.py``) | ||
- upload code and built track hub (and data, if relevant) to the `trackhub-demo | ||
<https://github.com/daler/trackhub-demo>`_ repository | ||
- run ``hubCheck`` on the just-uploaded hubs (see ``ci/check_hubs.py``) | ||
|
||
The just-built track hubs are then live, and linked to from within the | ||
documentation. |
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,3 @@ | ||
[build-system] | ||
requires = ["setuptools >= 61.0"] | ||
build-backend = "setuptools.build_meta" |
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
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.