A Python port of the Invisible Internet Project (I2P)
1name: Build & Package
2
3on:
4 push:
5 tags: ['v*']
6 workflow_dispatch:
7
8permissions:
9 contents: read
10
11jobs:
12 test:
13 runs-on: ubuntu-latest
14 container: python:3.11-slim
15 steps:
16 - uses: actions/checkout@v4
17 - run: pip install .[dev]
18 - run: python -m pytest tests/ -q
19
20 security:
21 runs-on: ubuntu-latest
22 container: python:3.11-slim
23 needs: test
24 steps:
25 - uses: actions/checkout@v4
26 - run: pip install .[security] .
27 - run: bandit -c bandit.yaml -r src/ -f json -o bandit-results.json --exit-zero
28 - run: pip-audit -f json -o pip-audit-results.json --desc || true
29 - run: python tools/security/check_results.py
30 --bandit bandit-results.json
31 --pip-audit pip-audit-results.json
32 - uses: actions/upload-artifact@v4
33 if: always()
34 with:
35 name: security-reports
36 path: |
37 bandit-results.json
38 pip-audit-results.json
39
40 build-sdist:
41 runs-on: ubuntu-latest
42 container: python:3.11-slim
43 needs: test
44 steps:
45 - uses: actions/checkout@v4
46 - run: pip install build
47 - run: python -m build --outdir dist/
48 - uses: actions/upload-artifact@v4
49 with:
50 name: dist-sdist
51 path: dist/
52
53 build-deb:
54 runs-on: ubuntu-latest
55 container: debian:bookworm-slim
56 needs: test
57 steps:
58 - uses: actions/checkout@v4
59 - name: Install build dependencies
60 run: |
61 apt-get update -qq
62 apt-get install -y --no-install-recommends \
63 python3 python3-pip python3-venv \
64 ruby ruby-dev gcc make libffi-dev
65 gem install fpm --no-document
66 - name: Build .deb
67 run: |
68 mkdir -p dist
69 ln -sf "$(pwd)/dist" /out
70 bash build/linux-deb/build.sh
71 - uses: actions/upload-artifact@v4
72 with:
73 name: dist-deb
74 path: dist/*.deb
75
76 build-rpm:
77 runs-on: ubuntu-latest
78 container: fedora:41
79 needs: test
80 steps:
81 - uses: actions/checkout@v4
82 - name: Install build dependencies
83 run: |
84 dnf install -y --setopt=install_weak_deps=False \
85 python3 python3-pip python3-devel \
86 ruby ruby-devel gcc gcc-c++ make rpm-build \
87 libffi-devel redhat-rpm-config git
88 gem install fpm --no-document
89 - name: Build .rpm
90 run: |
91 mkdir -p dist
92 ln -sf "$(pwd)/dist" /out
93 bash build/linux-rpm/build.sh
94 - uses: actions/upload-artifact@v4
95 with:
96 name: dist-rpm
97 path: dist/*.rpm
98
99 build-windows:
100 runs-on: ubuntu-latest
101 container: python:3.12-slim
102 needs: test
103 steps:
104 - uses: actions/checkout@v4
105 - name: Install build dependencies
106 run: |
107 apt-get update -qq
108 apt-get install -y --no-install-recommends nsis
109 pip install pynsist
110 - name: Build Windows installer
111 run: |
112 mkdir -p dist
113 ln -sf "$(pwd)/dist" /out
114 bash build/windows/build.sh
115 - uses: actions/upload-artifact@v4
116 with:
117 name: dist-windows
118 path: dist/*.exe
119
120 release:
121 runs-on: ubuntu-latest
122 needs: [build-sdist, build-deb, build-rpm, build-windows, security]
123 if: startsWith(github.ref, 'refs/tags/v')
124 permissions:
125 contents: write
126 steps:
127 - uses: actions/download-artifact@v4
128 with:
129 pattern: dist-*
130 merge-multiple: true
131 path: dist/
132 - uses: softprops/action-gh-release@v2
133 with:
134 files: dist/*
135 generate_release_notes: true