-
Notifications
You must be signed in to change notification settings - Fork 14
142 lines (124 loc) · 4.1 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Classifier Release
run-name: Build classifier
on: [push]
jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
architecture: 'x64'
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- run: sudo apt-get update
- run: python -m pip install --upgrade pip
- run: pip install black --upgrade
- run: ./check-style
- name: Install dependencies
run: |
pip install cmake freezegun gdown
sudo apt install -y python3-dbus ffmpeg build-essential libdbus-glib-1-dev libgirepository1.0-dev tzdata libcairo2-dev libjpeg-dev python3-cairo libhdf5-dev libopencv-dev cmake
pip install -r requirements.txt
- name: Run tests
run: |
pip install pytest
pytest -s
- name: Test Build
run: python3 src/build.py -c tests/test-config.yaml tests --ext ".cptv"
- name: Test Classify
run: |
sudo mkdir /var/spool/cptv
sudo chmod -R 777 /var/spool/cptv
wget -O thermal-model.tar https://github.com/TheCacophonyProject/AI-Model/releases/download/v0.5/inc3-19012023-tflite.tar
mkdir thermal-model
tar xzvf thermal-model.tar -C thermal-model --strip-components=1
pip install tflite-runtime==2.14.0
python3 src/classify.py -c tests/test-config.yaml ./tests/clips/
python3 src/piclassify.py --file tests/clips/possum.cptv --thermal-config-file tests/config.toml -c tests/test-config.yaml
pypi-build:
name: Build distribution 📦
runs-on: ubuntu-latest
needs:
- tests
if: github.ref == 'refs/heads/pi-classifier'
steps:
- name: Check out repository code
uses: actions/checkout@v4
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
architecture: 'x64'
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
pypi-publish:
name: Upload release to PyPI
needs:
- pypi-build
if: github.ref == 'refs/heads/pi-classifier'
runs-on: ubuntu-latest
environment:
name: release
url: https://pypi.org/project/classifier-pipeline/
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
docker:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
environment:
name: docker
needs:
- tests
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: cacophonyproject/classifier
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Build and push
uses: docker/build-push-action@v6
with:
file: ./docker/Dockerfile
push: true
# tags: cacophonyproject/classifier:latest
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}