-
Notifications
You must be signed in to change notification settings - Fork 1
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 #11 from PennChopMicrobiomeProgram/10-update-ci-an…
…d-docs Update CI workflows and docs
- Loading branch information
Showing
11 changed files
with
252 additions
and
155 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,14 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: [ main, master ] | ||
pull_request: | ||
branches: [ main, master ] | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
run-tests: | ||
uses: ./.github/workflows/test.yml | ||
secrets: inherit |
This file was deleted.
Oops, something went wrong.
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,104 @@ | ||
name: Release Package | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
check-version: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install Library | ||
run: | | ||
python -m pip install . | ||
python -m pip install setuptools | ||
- id: get_version | ||
uses: battila7/get-version-action@v2 | ||
|
||
- name: Check version | ||
run: | | ||
LIBRARY_VERSION=$(unassign --version) | ||
GITHUB_VERSION=${{ steps.get_version.outputs.version-without-v }} | ||
if [[ $LIBRARY_VERSION == $GITHUB_VERSION ]]; then | ||
echo "Versions match, continuing..." | ||
else | ||
echo "Versions don't match, exiting..." | ||
echo "Library version: $LIBRARY_VERSION" | ||
echo "GitHub version: $GITHUB_VERSION" | ||
exit 1 | ||
fi | ||
run-tests: | ||
uses: ./.github/workflows/test.yml | ||
secrets: inherit | ||
|
||
build-and-publish-to-pypi: | ||
name: Publish to PyPI | ||
runs-on: ubuntu-latest | ||
needs: [run-tests, check-version] | ||
|
||
permissions: | ||
contents: read | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install build | ||
- name: Build package | ||
run: python -m build | ||
|
||
- name: Publish package | ||
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
|
||
build-and-push-to-dockerhub: | ||
name: Push Docker image to Docker Hub | ||
runs-on: ubuntu-latest | ||
needs: [run-tests, check-version] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ctbushman/unassigner | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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,90 @@ | ||
name: Tests | ||
|
||
on: | ||
workflow_call: | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
tests-with-coverage: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: setup-conda | ||
uses: s-weigand/[email protected] | ||
|
||
- name: Install dependencies | ||
run: | | ||
conda install -c bioconda vsearch | ||
python -m pip install --upgrade pip | ||
python -m pip install pytest pytest-cov | ||
python -m pip install . | ||
- name: Run tests and collect coverage | ||
run: pytest --cov tests | ||
|
||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
|
||
tests: | ||
name: Run Tests | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ['3.12'] | ||
os: [ubuntu-latest] # setup-conda action currently doesn't work with latest macOS runners | ||
include: | ||
- python-version: '3.11' | ||
os: ubuntu-latest | ||
- python-version: '3.10' | ||
os: ubuntu-latest | ||
- python-version: '3.9' | ||
os: ubuntu-latest | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: setup-conda | ||
uses: s-weigand/[email protected] | ||
|
||
- name: Install dependencies | ||
run: | | ||
conda install -c bioconda vsearch | ||
python -m pip install --upgrade pip | ||
python -m pip install pytest | ||
python -m pip install . | ||
- name: Run tests | ||
run: pytest -s -vvvv -l --tb=long tests | ||
|
||
lint: | ||
name: Lint Code Base | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.12 | ||
|
||
- name: Install Dependencies | ||
run: pip install black | ||
|
||
- name: Lint Code Base | ||
run: | | ||
black --check . |
This file was deleted.
Oops, something went wrong.
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,21 @@ | ||
FROM condaforge/mambaforge:latest | ||
|
||
# Setup | ||
WORKDIR /home | ||
|
||
COPY . . | ||
|
||
# Install environment | ||
RUN mamba create --name primertrim -c conda-forge -c bioconda vsearch | ||
|
||
ENV PATH="/opt/conda/envs/primertrim/bin/:${PATH}" | ||
|
||
# "Activate" the environment | ||
SHELL ["conda", "run", "--no-capture-output", "-n", "primertrim", "/bin/bash", "-c"] | ||
|
||
RUN pip install /home/ | ||
|
||
RUN echo "Python: $(python --version), Conda: $(conda --version), Vsearch: $(vsearch -v)" > installed_packages.txt | ||
|
||
# Run | ||
CMD "bash" |
Oops, something went wrong.