Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/development' into example_notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
jjjermiah committed Jan 28, 2024
2 parents 0a41b96 + 1bdd456 commit 9ef2623
Show file tree
Hide file tree
Showing 25 changed files with 1,394 additions and 642 deletions.
177 changes: 114 additions & 63 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,46 @@ jobs:
run: |
pip install -r requirements.txt
poetry install
pytest --cov --cov-report=xml
pytest --cov --cov-report=xml:coverage-report/coverage.xml
- name: Build documentation
run: poetry run make html --directory docs/

- name: Upload coverage report
uses: actions/upload-artifact@v2
with:
name: coverage-report
path: coverage-report

Codecov:
needs: Continuous-Integration
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Download coverage.xml artifact
uses: actions/download-artifact@v2
with:
name: coverage-report
path: coverage-report

- name: Use Codecov to track coverage
uses: codecov/codecov-action@v3
with:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
files: ./coverage-report/coverage.xml
fail_ci_if_error: true
verbose: true
name: codecov-umbrella

- name: Build documentation
run: poetry run make html --directory docs/

Continuous-Deployment:
permissions:
contents: write
packages: write
issues: write
pull-requests: write

# needs: Continuous-Integration

# if pulling to main, deploy to PyPI
Expand All @@ -72,13 +97,6 @@ jobs:
- name: Install package
run: poetry install


# Get the last tag value (i.e 0.6.0)
# save to a variable called last_tag to be used later
- name: Get latest tag name
id: last_tag
run: echo ::set-output name=tag::$(git describe --tags --abbrev=0 | sed 's/^v//')

# This action uses Python Semantic Release v8
# What this action does:
# - Determines the next version number based on the commit history
Expand All @@ -105,7 +123,7 @@ jobs:
run: |
poetry version $(git describe --tags --abbrev=0 | sed 's/^v//')
python -m build --sdist --wheel --outdir dist/ .
ls dist/
echo "LATEST_TAG=$(poetry version | sed 's/^nbiatoolkit //')" >> "$GITHUB_ENV"
- name: Publish package distributions to PyPI
if: steps.release.outputs.released == 'true'
Expand All @@ -115,51 +133,84 @@ jobs:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

# # - name: Publish package distributions to GitHub Releases
# - name: Build and Publish
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# user: __token__
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
# repository_url: https://test.pypi.org/legacy/
# build: true
# build_command: poetry build
# build_command_postfix: dist/*

# - name: Publish package distributions to PyPI
# id: pypi-publish



# - name: Publish package distributions to GitHub Releases
# uses: python-semantic-release/upload-to-gh-release@main
# if: steps.release.outputs.released == 'true'
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# - name: Publish to TestPyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# user: __token__
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
# repository_url: https://test.pypi.org/legacy/

# - name: Test install from TestPyPI
# run: |
# pip install \
# --index-url https://test.pypi.org/simple/ \
# --extra-index-url https://pypi.org/simple \
# nbiatoolkit

# - name: Publish to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# user: __token__
# password: ${{ secrets.PYPI_API_TOKEN }}

# - name: Publish documentation
# uses: maxheld83/ghpages@v0.2.1
# with:
# build_dir: docs/_build/html
# target_branch: gh-pages
# committer_name: "GitHub Actions"
# committer_email: "jermiahjoseph98@gmail.com"
- name: Print latest tag name
run: |
printf "%s\n" "${LATEST_TAG}"
- name: Print branch name
run: |
printf "LATEST TAG: %s\n" "${LATEST_TAG}"
echo "DOCKER_IMAGE_TAG=${LATEST_TAG}" >> "$GITHUB_ENV"
printf "DOCKER_IMAGE_TAG: %s\n" "${DOCKER_IMAGE_TAG}"
- name: Set up QEMU
if: steps.release.outputs.released == 'true'
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
if: steps.release.outputs.released == 'true'
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
if: steps.release.outputs.released == 'true'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to the GitHub Container Registry
if: steps.release.outputs.released == 'true'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: |
${{ secrets.DOCKERHUB_USERNAME }}/nbiatoolkit:${{ env.DOCKER_IMAGE_TAG }}
ghcr.io/${{ github.repository }}/nbiatoolkit:${{ env.DOCKER_IMAGE_TAG }}
- name: Build
if: steps.release.outputs.released == 'true'
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/nbiatoolkit:${{ env.DOCKER_IMAGE_TAG }}
${{ secrets.DOCKERHUB_USERNAME }}/nbiatoolkit:latest
ghcr.io/${{ github.repository }}/nbiatoolkit:${{ env.DOCKER_IMAGE_TAG }}
ghcr.io/${{ github.repository }}/nbiatoolkit:latest
labels: ${{ steps.meta.outputs.labels }}

test_image_with_new_tag:
needs: Continuous-Deployment
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Test Image With new Tag
run: |
docker run --rm \
${{ secrets.DOCKERHUB_USERNAME }}/nbiatoolkit:${{ env.DOCKER_IMAGE_TAG }} \
python -c "import nbiatoolkit; print(nbiatoolkit.__version__)"
test_image_with_latest_tag:
needs: Continuous-Deployment
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Test Image with "latest" Tag
run: |
docker run --rm \
${{ secrets.DOCKERHUB_USERNAME }}/nbiatoolkit:latest \
python -c "import nbiatoolkit; print(nbiatoolkit.__version__)"

0 comments on commit 9ef2623

Please sign in to comment.