Skip to content

Commit 6df9232

Browse files
committed
enable local CI tests
1 parent cf377b1 commit 6df9232

File tree

11 files changed

+334
-212
lines changed

11 files changed

+334
-212
lines changed

.github/workflows/bandit.yml

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,37 @@
11
name: security checks
22
on:
3-
push:
4-
paths-ignore:
5-
- 'README.md'
6-
- 'docs/**'
7-
- '**/README.md'
8-
pull_request:
9-
paths-ignore:
10-
- 'README.md'
11-
- 'docs/**'
12-
- '**/README.md'
3+
push:
4+
paths-ignore:
5+
- "README.md"
6+
- "docs/**"
7+
- "**/README.md"
8+
pull_request:
9+
paths-ignore:
10+
- "README.md"
11+
- "docs/**"
12+
- "**/README.md"
1313
permissions:
14-
contents: read
14+
contents: read
1515
jobs:
16-
build:
17-
runs-on: ubuntu-latest
18-
steps:
19-
- uses: actions/checkout@v4
20-
- uses: actions/setup-python@v5
21-
with:
22-
python-version: "3.12"
23-
- name: Install dependencies
24-
run: |
25-
python -m pip install --upgrade pip
26-
pip install bandit
27-
28-
- name: Simple bandit security checks
29-
run: bandit -ll -ii -r . -f json -o bandit-report.json
30-
31-
- name: Show Report in Action Output
32-
if: always()
33-
run: cat bandit-report.json
34-
35-
- name: Upload Bandit Scan Artifact
36-
uses: actions/upload-artifact@v4
37-
if: always()
38-
with:
39-
name: bandit-findings
40-
path: bandit-report.json
41-
16+
build:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.13"
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install poetry
27+
- name: Simple bandit security checks
28+
run: make security
29+
- name: Show Report in Action Output
30+
if: always()
31+
run: cat bandit-report.json
32+
- name: Upload Bandit Scan Artifact
33+
uses: actions/upload-artifact@v4
34+
if: always()
35+
with:
36+
name: bandit-findings
37+
path: bandit-report.json

.github/workflows/black.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,15 @@ name: Lint
33
on: [push, pull_request]
44

55
jobs:
6-
lint:
7-
runs-on: ubuntu-latest
8-
steps:
9-
- uses: actions/checkout@v4
10-
- uses: psf/black@stable
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- uses: actions/setup-python@v5
11+
with:
12+
python-version: "3.13"
13+
- name: Install dependencies
14+
run: |
15+
python -m pip install --upgrade pip
16+
pip install poetry
17+
- run: make lint

.github/workflows/build.yml

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
name: Build
22
on:
3-
push:
4-
paths-ignore:
5-
- 'README.md'
6-
- 'docs/**'
7-
- '**/README.md'
8-
pull_request:
9-
paths-ignore:
10-
- 'README.md'
11-
- 'docs/**'
12-
- '**/README.md'
3+
push:
4+
paths-ignore:
5+
- "README.md"
6+
- "docs/**"
7+
- "**/README.md"
8+
pull_request:
9+
paths-ignore:
10+
- "README.md"
11+
- "docs/**"
12+
- "**/README.md"
1313
permissions:
14-
contents: read
14+
contents: read
1515
jobs:
16-
build:
17-
runs-on: ubuntu-latest
18-
steps:
19-
- uses: actions/checkout@v4
20-
- uses: actions/setup-python@v5
21-
with:
22-
python-version: "3.12"
23-
- name: Install dependencies
24-
run: |
25-
python -m pip install --upgrade pip
26-
pip install poetry
27-
- name: Simple poetry build no package
28-
run: poetry build
29-
16+
build:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.12"
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install poetry
27+
- name: Simple poetry build no package
28+
run: make build

.github/workflows/docs.yml

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,26 @@ name: Update Sphinx documentation
33
on: [push, pull_request, workflow_dispatch]
44

55
permissions:
6-
contents: write
6+
contents: write
77

88
jobs:
9-
docs:
10-
runs-on: ubuntu-latest
11-
steps:
12-
- uses: actions/checkout@v4
13-
- uses: actions/setup-python@v5
14-
- name: Install dependencies
15-
run: |
16-
pip install sphinx poetry
17-
- name: Sphinx build
18-
run: |
19-
python -m venv venv
20-
source venv/bin/activate
21-
poetry install
22-
sphinx-build docs _build
23-
- name: Deploy to GitHub Pages
24-
uses: peaceiris/actions-gh-pages@v4
25-
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
26-
with:
27-
publish_branch: gh-pages
28-
github_token: ${{ secrets.GITHUB_TOKEN }}
29-
publish_dir: _build
30-
force_orphan: true
9+
docs:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-python@v5
14+
with:
15+
python-version: "3.12"
16+
- name: Install dependencies
17+
run: |
18+
python -m pip install --upgrade pip
19+
pip install poetry
20+
- run: make docs
21+
- name: Deploy to GitHub Pages
22+
uses: peaceiris/actions-gh-pages@v4
23+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
24+
with:
25+
publish_branch: gh-pages
26+
github_token: ${{ secrets.GITHUB_TOKEN }}
27+
publish_dir: _build
28+
force_orphan: true

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,9 @@ cython_debug/
162162
# and can be added to the global gitignore or merged into this file. For a more nuclear
163163
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
164164
.idea/
165+
166+
# bandit
167+
bandit-report.json
168+
169+
# zot
170+
test-data/zot

Makefile

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
.PHONY: build install install-dev install-docs test format lint security docs clean help
2+
3+
POETRY := poetry
4+
5+
help:
6+
@echo "Available targets:"
7+
@echo " build - Build the package"
8+
@echo " install - Install the package and dependencies"
9+
@echo " install-dev - Install the package and dev dependencies"
10+
@echo " test - Run tests"
11+
@echo " format - Format code with black"
12+
@echo " lint - Run linting checks"
13+
@echo " security - Run security checks with bandit"
14+
@echo " docs - Build the documentation"
15+
@echo " clean - Clean build artifacts and cache"
16+
@echo " help - Show this help message"
17+
18+
build:
19+
$(POETRY) build
20+
21+
install:
22+
$(POETRY) install
23+
24+
install-dev:
25+
$(POETRY) install --with dev
26+
27+
install-docs:
28+
$(POETRY) install --with dev,docs
29+
30+
test-deps:
31+
test -f ./test-data/zot || curl -o ./test-data/zot https://github.com/project-zot/zot/releases/download/v2.1.0/zot-linux-amd64
32+
chmod +x ./test-data/zot
33+
34+
test: install-dev test-deps
35+
$(POETRY) run pytest
36+
37+
format: install-dev
38+
$(POETRY) run black .
39+
40+
lint: install-dev
41+
$(POETRY) run black --check .
42+
43+
security: install-dev
44+
@if [ "$(CI)" = "true" ]; then \
45+
$(POETRY) run bandit -ll -ii -r . -f json -o bandit-report.json ; \
46+
else \
47+
$(POETRY) run bandit -r . ; \
48+
fi
49+
50+
docs: install-docs
51+
$(POETRY) run sphinx-build docs _build
52+
53+
clean:
54+
rm -rf build/
55+
rm -rf dist/
56+
rm -rf *.egg-info/
57+
rm -rf .eggs/
58+
rm -rf .pytest_cache/
59+
rm -rf .coverage
60+
rm -rf htmlcov/
61+
find . -type d -name __pycache__ -exec rm -rf {} +
62+
find . -type f -name "*.pyc" -delete
63+
find . -type f -name "*.pyo" -delete
64+
find . -type f -name "*.pyd" -delete

cert/gencert.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)