Skip to content

Commit 15612b5

Browse files
Merge pull request #1 from Kitware/jrp/ci-cd-fixes
CI/CD Updates and Fixed A* Fork
2 parents 9c902a8 + 4467c69 commit 15612b5

38 files changed

+537
-1342
lines changed
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
name: "CodeQL"
22

33
on:
4-
push:
5-
branches: [ main ]
64
pull_request:
7-
branches: [ main ]
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
810
schedule:
911
- cron: '0 0 * * 1'
1012

@@ -19,16 +21,16 @@ jobs:
1921
language: [ 'python' ]
2022
steps:
2123
- name: Checkout repository
22-
uses: actions/checkout@v2
24+
uses: actions/checkout@v6
2325

2426
# Initializes the CodeQL tools for scanning.
2527
- name: Initialize CodeQL
26-
uses: github/codeql-action/init@v1
28+
uses: github/codeql-action/init@v4
2729
with:
2830
languages: ${{ matrix.language }}
2931

3032
- name: Autobuild
31-
uses: github/codeql-action/autobuild@v1
33+
uses: github/codeql-action/autobuild@v4
3234

3335
- name: Perform CodeQL Analysis
34-
uses: github/codeql-action/analyze@v1
36+
uses: github/codeql-action/analyze@v4

.github/workflows/docker-publish.yaml

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,15 @@ jobs:
2525

2626
steps:
2727
- name: Checkout code
28-
uses: nschloe/action-cached-lfs-checkout@v1.1.3
28+
uses: nschloe/action-cached-lfs-checkout@v1.2.3
2929
with:
30-
exclude: "batbot/*/models/pytorch/"
30+
exclude: "examples/example[2-4].wav"
3131

32-
- uses: docker/setup-qemu-action@v1
32+
- uses: docker/setup-qemu-action@v3
3333
name: Set up QEMU
3434
id: qemu
35-
with:
36-
image: tonistiigi/binfmt:latest
37-
platforms: all
3835

39-
- uses: docker/setup-buildx-action@v1
36+
- uses: docker/setup-buildx-action@v3
4037
name: Set up Docker Buildx
4138
id: buildx
4239

@@ -45,35 +42,43 @@ jobs:
4542

4643
# Log into container registries
4744
- name: Login to DockerHub
48-
uses: docker/login-action@v1
45+
uses: docker/login-action@v3
4946
with:
50-
username: batbot
51-
password: ${{ secrets.BATBOT_DOCKER_HUB_TOKEN }}
47+
username: ${{ vars.BATBOT_DOCKERHUB_USERNAME }}
48+
password: ${{ secrets.BATBOT_DOCKERHUB_TOKEN }}
5249

53-
# Push tagged image (version tag + latest) to registries
54-
- name: Tagged Docker Hub
55-
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') }}
56-
run: |
57-
VERSION=$(echo ${GITHUB_REF} | sed 's#.*/v##')
58-
echo "IMAGE_TAG=${VERSION}" >> $GITHUB_ENV
50+
- name: Login to GitHub Container Registry
51+
uses: docker/login-action@v3
52+
with:
53+
registry: ghcr.io
54+
username: ${{ github.actor }}
55+
password: ${{ secrets.GITHUB_TOKEN }}
5956

60-
# Push bleeding-edge image (main tag) to registries
61-
- name: Bleeding Edge Docker Hub
62-
if: github.ref == 'refs/heads/main'
57+
# Push bleeding-edge image ("<branch name>" tag) to registries
58+
- name: Bleeding Edge Docker Hub (Default Option)
6359
run: |
64-
echo "IMAGE_TAG=main" >> $GITHUB_ENV
60+
TAG=$(echo ${GITHUB_REF_NAME} | sed 's/\//-/')
61+
echo "IMAGE_TAG=${TAG}" >> $GITHUB_ENV
6562
66-
# Push nightly image (nightly tag) to registries
63+
# Push nightly image ("nightly" tag) to registries
6764
- name: Nightly Docker Hub
6865
if: github.event_name == 'schedule'
6966
run: |
7067
echo "IMAGE_TAG=nightly" >> $GITHUB_ENV
7168
69+
# Push tagged image ("<symantic version>" tag) to registries
70+
- name: Tagged Docker Hub
71+
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') }}
72+
run: |
73+
VERSION=$(echo ${GITHUB_REF} | sed 's#.*/v##')
74+
echo "IMAGE_TAG=${VERSION}" >> $GITHUB_ENV
75+
7276
# Build images
7377
- name: Build Batbot
7478
run: |
7579
docker buildx build \
7680
-t kitware/batbot:${{ env.IMAGE_TAG }} \
81+
-t ghcr.io/kitware/batbot:${{ env.IMAGE_TAG }} \
7782
--platform linux/amd64 \
7883
--push \
7984
.
@@ -84,6 +89,7 @@ jobs:
8489
run: |
8590
docker buildx build \
8691
-t kitware/batbot:latest \
92+
-t ghcr.io/kitware/batbot:latest \
8793
--platform linux/amd64 \
8894
--push \
8995
.

.github/workflows/python-publish.yaml

Lines changed: 45 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
- jrp/ci-cd-fixes
78

89
jobs:
910

@@ -14,16 +15,16 @@ jobs:
1415
fail-fast: false
1516
matrix:
1617
os: [ubuntu-latest, macos-latest]
17-
python-version: [3.8]
18+
python-version: [3.12]
1819

1920
steps:
2021
- name: Checkout code
21-
uses: nschloe/action-cached-lfs-checkout@v1.1.3
22+
uses: nschloe/action-cached-lfs-checkout@v1.2.3
2223
with:
23-
exclude: "batbot/*/models/pytorch/"
24+
exclude: "examples/example[2-4].wav"
2425

25-
- uses: actions/setup-python@v2
26-
name: Install Python
26+
- name: Set up Python ${{ matrix.python-version }}
27+
uses: actions/setup-python@v6
2728
with:
2829
python-version: ${{ matrix.python-version }}
2930

@@ -33,81 +34,93 @@ jobs:
3334
pip install build
3435
python -m build --wheel --outdir dist/ .
3536
36-
- uses: actions/upload-artifact@v2
37+
- uses: actions/upload-artifact@v6
3738
with:
39+
name: artifact-wheel-${{ matrix.os }}-${{ matrix.python-version }}
3840
path: ./dist/*.whl
3941

4042
build_sdist:
4143
name: Build source distribution
4244
runs-on: ubuntu-latest
4345
steps:
4446
- name: Checkout code
45-
uses: nschloe/action-cached-lfs-checkout@v1.1.3
47+
uses: nschloe/action-cached-lfs-checkout@v1.2.3
4648
with:
47-
exclude: "batbot/*/models/pytorch/"
49+
exclude: "examples/example[2-4].wav"
4850

49-
- uses: actions/setup-python@v2
50-
name: Install Python
51+
- name: Set up Python 3.12
52+
uses: actions/setup-python@v6
5153
with:
52-
python-version: '3.8'
54+
python-version: '3.12'
5355

5456
- name: Build sdist
5557
run: |
5658
pip install --upgrade pip
5759
pip install build
5860
python -m build --sdist --outdir dist/ .
5961
60-
- uses: actions/upload-artifact@v2
62+
- uses: actions/upload-artifact@v6
6163
with:
64+
name: artifact-sdist
6265
path: ./dist/*.tar.gz
6366

6467
test_wheel:
6568
needs: [build_wheels, build_sdist]
6669
runs-on: ubuntu-latest
67-
env:
68-
CLASSIFIER_BATCH_SIZE: 16
6970

7071
# test wheel
7172
if: github.event_name == 'push'
7273
steps:
73-
- uses: actions/setup-python@v2
74-
name: Install Python
74+
- name: Set up Python 3.12
75+
uses: actions/setup-python@v6
7576
with:
76-
python-version: '3.8'
77+
python-version: '3.12'
7778

78-
- uses: actions/download-artifact@v2
79+
- uses: actions/download-artifact@v7
7980
with:
80-
name: artifact
81-
path: dist
81+
path: artifact
8282

8383
- name: Install wheel
8484
run: |
8585
pip install --upgrade pip
8686
pip install wheel
87+
find .
88+
mkdir dist
89+
cp artifact/*-ubuntu-*/*.whl dist/
90+
cp artifact/*/*.tar.gz dist/
8791
pip install dist/*.whl
8892
8993
- name: Test module
9094
run: |
91-
python -c "import batbot; batbot.fetch(); batbot.example();"
95+
python -c "import batbot;"
9296
93-
- name: Test CLI
94-
run: |
95-
batbot fetch
96-
batbot example
97+
# - name: Test CLI
98+
# run: |
99+
# batbot example
97100

98101
upload_pypi:
99102
needs: [test_wheel]
100103
runs-on: ubuntu-latest
101104
# upload to PyPI on every tag starting with 'v'
102105
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
106+
environment:
107+
name: pypi
108+
url: https://pypi.org/p/batbot
109+
permissions:
110+
id-token: write
103111
steps:
104-
- uses: actions/download-artifact@v2
112+
- uses: actions/download-artifact@v7
105113
with:
106-
name: artifact
107-
path: dist
114+
path: artifact
115+
116+
- name: Install wheel
117+
run: |
118+
find .
119+
mkdir dist
120+
cp artifact/*-ubuntu-*/*.whl dist/
121+
cp artifact/*/*.tar.gz dist/
108122
109-
- uses: pypa/gh-action-pypi-publish@release/v1
123+
- name: Publish package distributions to PyPI
124+
uses: pypa/gh-action-pypi-publish@release/v1
110125
with:
111-
user: __token__
112-
password: ${{ secrets.PYPI_PASSWORD }}
113-
# To test: repository_url: https://test.pypi.org/legacy/
126+
password: ${{ secrets.BATBOT_PYPI_TOKEN }}

.github/workflows/testing.yaml

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,51 +12,46 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
# Use the same Python version used the Dockerfile
15-
python-version: [3.9]
15+
python-version: [3.12]
1616

1717
env:
1818
OS: ubuntu-latest
1919
PYTHON: ${{ matrix.python-version }}
20-
CLASSIFIER_BATCH_SIZE: 16
2120

2221
steps:
2322
# Checkout and env setup
2423
- name: Checkout code
25-
uses: nschloe/action-cached-lfs-checkout@v1.1.3
24+
uses: nschloe/action-cached-lfs-checkout@v1.2.3
2625
with:
27-
exclude: "batbot/*/models/pytorch/"
26+
exclude: "examples/example[3-4].wav"
2827

2928
- name: Set up Python ${{ matrix.python-version }}
30-
uses: actions/setup-python@v2
29+
uses: actions/setup-python@v6
3130
with:
3231
python-version: ${{ matrix.python-version }}
3332

3433
- name: Install dependencies
3534
run: |
3635
python -m pip install --upgrade pip
37-
pip install -r requirements.txt
38-
pip install -r requirements.optional.txt
36+
pip install -r requirements/runtime.txt
37+
pip install -r requirements/optional.txt
38+
pip install -e .
3939
40-
- name: Lint with flake8
40+
- name: Check with pre-commit
4141
run: |
42-
# stop the build if there are Python syntax errors or undefined names
43-
flake8 . --count --show-source --statistics
44-
# exit-zero treats all errors as warnings.
45-
flake8 . --count --exit-zero --max-complexity=10 --statistics
42+
SKIP=hadolint pre-commit
43+
SKIP=hadolint pre-commit run --all-files
4644
47-
- name: Run tests
45+
- name: Run tests and coverage
4846
run: |
4947
set -ex
50-
pytest --cov=./ --cov-append --random-order-seed=1
51-
52-
- name: Run coverage
53-
run: |
54-
coverage xml
48+
pytest --cov=batbot --cov-append --cov-report=xml --random-order-seed=1
5549
5650
- name: Upload coverage to Codecov
57-
uses: codecov/codecov-action@v1.2.1
51+
continue-on-error: true
52+
uses: codecov/codecov-action@v5
5853
with:
59-
token: ${{ secrets.CODECOV_TOKEN }}
54+
token: ${{ secrets.BATBOT_CODECOV_TOKEN }}
6055
files: ./coverage/coverage.xml
6156
env_vars: OS,PYTHON
6257
fail_ci_if_error: true

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
output.*.jpg
33
*.log*
44

5+
build/
6+
dist/
57
*.egg-info/
68

79
.coverage*
@@ -16,3 +18,4 @@ docs/_build/
1618

1719
example*.jpg
1820
example*.json
21+
.vscode/*

Dockerfile

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,11 @@ RUN python3 -m venv /venv
3131
# hadolint ignore=DL3003,DL3013
3232
RUN /venv/bin/pip install --no-cache-dir -r requirements/runtime.txt \
3333
&& /venv/bin/pip install --no-cache-dir -r requirements/optional.txt \
34-
&& cd tpl/pyastar2d/ \
35-
&& /venv/bin/pip install --no-cache-dir -e . \
36-
&& cd ../.. \
37-
&& /venv/bin/pip install --no-cache-dir -e . \
38-
&& if [ "$(uname -m)" != "aarch64" ] \
39-
; then \
40-
/venv/bin/pip uninstall -y onnxruntime \
41-
/venv/bin/pip install --no-cache-dir onnxruntime-gpu \
42-
; fi
34+
&& /venv/bin/pip install --no-cache-dir -e .
35+
# && if [ "$(uname -m)" != "aarch64" ] \
36+
# ; then \
37+
# /venv/bin/pip uninstall -y onnxruntime \
38+
# /venv/bin/pip install --no-cache-dir onnxruntime-gpu \
39+
# ; fi
4340

4441
CMD [".", "/venv/bin/activate", "&&", "exec", "python", "app.py"]

ISSUES.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,9 @@
22
Known Issues
33
============
44

5-
N/A
5+
TODO:
6+
- Fix CI/CD docker build
7+
- Add API documentation, tutorials, and examples
8+
- Create example notebooks with Google colab
9+
- Crate discord / discourse community board
10+
- [BatAI] Upload training scripts with MLFlow support, database export with celery

MANIFEST.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
include pyproject.toml
2-
31
# Include the README and SECURITY documents
42
include *.rst
53

0 commit comments

Comments
 (0)