Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: kapture-main
name: kapture-push-main

on:
push:
Expand All @@ -21,30 +21,30 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v4
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install dependencies
cache: pip
cache-dependency-path: pyproject.toml

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y pandoc asciidoctor

- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
python -m pip install --upgrade pip
python -m pip install flake8 pytest
make install

- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. We allow 120 chars wide lines
flake8 . --count --exit-zero --max-complexity=16 --max-line-length=120 --statistics --extend-ignore=F401

- name: Test with unittest
run: |
python -m unittest discover -s tests/
38 changes: 38 additions & 0 deletions .github/workflows/kapture-release-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This workflow will build and push docker images to Docker Hub when a release is created.
# for debugging purpose, the docker image is tagged with debug when it is not an actual release.

name: kapture-release-docker

on:
release:
types: [created]
workflow_dispatch:

jobs:
deploy_docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: docker build and push
uses: elgohr/Publish-Docker-Github-Action@v4
if: github.event_name == 'release'
with:
name: kapture/kapture
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
dockerfile: docker/Dockerfile
context: .
tag_names: true
tags: "latest"

- name: docker tag debug
uses: elgohr/Publish-Docker-Github-Action@v4
if: github.event_name == 'workflow_dispatch'
with:
name: kapture/kapture
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
dockerfile: docker/Dockerfile
context: .
tags: "debug"
70 changes: 70 additions & 0 deletions .github/workflows/kapture-release-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# This workflow will build and push the release distributions to PyPI (or test PyPI if it is not a release).

name: kapture-release-pypi

on:
release:
types: [created]
workflow_dispatch:

jobs:
release-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: build release distributions
run: |
python -m pip install build
python -m build

- name: install doc tools
run: |
sudo apt-get update
sudo apt-get install -y pandoc asciidoctor

- name: generate README
run: make README.md

- name: upload release dists
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/

testpypi-publish:
runs-on: ubuntu-latest
needs: release-build
if: github.event_name == 'workflow_dispatch'
steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/

- name: Publish release distributions to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
password: ${{ secrets.PYPI_TEST_TOKEN }}
attestations: false

pypi-publish:
runs-on: ubuntu-latest
needs: release-build
if: github.event_name == 'release'
steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/

- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TOKEN }}
attestations: false
66 changes: 0 additions & 66 deletions .github/workflows/release.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# compiled MD documentation
README.md

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
33 changes: 33 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.PHONY: install install_dev docker clean check-docker check-asciidoctor check-pandoc unittests

build: README.md
python3 -m build

install: README.md
pip install .

install_dev: README.md
pip install -e .

docker: check-docker
docker build -f docker/Dockerfile . -t kapture/kapture

check-docker:
@command -v docker >/dev/null 2>&1 || { echo "docker is not installed"; exit 1; }

README.md: README.adoc
asciidoctor -b docbook $< -o - | pandoc -f docbook -t gfm -o $@

check-asciidoctor:
@command -v asciidoctor >/dev/null 2>&1 || { echo "asciidoctor is not installed"; exit 1; }

check-pandoc:
@command -v pandoc >/dev/null 2>&1 || { echo "pandoc is not installed"; exit 1; }

clean:
rm -rf dist/ kapture.egg-info/ README.md

all: install

unittests:
python3 -m unittest discover -s tests
11 changes: 6 additions & 5 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,13 @@ Build the docker image:

[source,bash]
----
$> cd kapture
# build the docker image : if you have already cloned the repository
docker build . -t kapture/kapture
# OR build the docker image directly from github
docker build git://github.com/naver/kapture -t kapture/kapture
$> make docker
# OR build the docker image directly from github (no need to clone).
$> docker build git://github.com/naver/kapture -t kapture/kapture
# run unit tests
docker run -it --rm kapture/kapture python3 -m unittest discover -s /opt/src/kapture/tests
$> docker run -it --rm kapture/kapture python3 -m unittest discover -s /opt/src/kapture/tests
----

If you want to process your own data, you can bind directories between the host and the container using
Expand All @@ -132,7 +133,7 @@ The following example mounts `/path/to/dataset/` from the host to `/dataset` ins

[source,bash]
----
docker run -it \
$> docker run -it \
--rm \ # Automatically remove the container when it exits \
--volume /path/to/dataset/:/dataset:ro \ #read only
kapture/kapture
Expand Down
Loading
Loading