-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (134 loc) · 4.84 KB
/
ci.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: CI
on:
workflow_dispatch:
push:
paths-ignore:
- .gitignore
- "*.md"
pull_request:
paths-ignore:
- .gitignore
- "*.md"
jobs:
test:
runs-on: ubuntu-latest
container: docker.io/luigi311/low-power-image-processing-base-image:latest
steps:
- uses: actions/checkout@v3
- name: Install deps
run: |
pip install -r requirements.txt
pip install py pytest-parallel
chmod +x download_models.sh
./download_models.sh
- name: Run tests
run: |
python test/generate_images.py
pytest --workers auto
bench:
needs:
- test
runs-on: ubuntu-latest
container:
image: docker.io/luigi311/low-power-image-processing-base-image:latest
options: --privileged
steps:
# Install git so checkout will clone via git
- name: Apt deps
run: |
apt-get update
apt-get install -y valgrind git
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Install deps
run: |
pip install -r requirements.txt
chmod +x download_models.sh
./download_models.sh
- name: Run benchmarks
run: |
python test/benchmarking/cachegrind.py python all_in_one.py test/images --internal_image_extension png --histogram_method histogram_clahe --scale_down 540 --auto_stack --stack_method ECC --stack_amount 2 2> /dev/null > /dev/null
mv benchmark.txt /tmp/current.txt
cat /tmp/current.txt
# If commit is not a pull request checkout previous commit
- name: Checkout previous commit (push)
if: github.event_name == 'push'
run: |
git config --global --add safe.directory /__w/Low-Power-Image-Processing/Low-Power-Image-Processing
git checkout HEAD^1
# If commit is a pull request checkout base branch
- name: Checkout base branch (pull request)
if: github.event_name == 'pull_request'
uses: actions/checkout@v3
with:
ref: ${{ github.base_ref }}
- name: Install deps
run: |
pip install -r requirements.txt
chmod +x download_models.sh
./download_models.sh
- name: Run benchmarks
run: |
rm -f test/images/*.hdf5 test/images/*.png
python test/benchmarking/cachegrind.py python all_in_one.py test/images --internal_image_extension png --histogram_method histogram_clahe --scale_down 540 --auto_stack --stack_method ECC --stack_amount 2 2> /dev/null > /dev/null
cat benchmark.txt
- name: Compare benchmarks
run: python test/benchmarking/compare.py benchmark.txt /tmp/current.txt
docker:
needs:
- test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker meta
id: docker_meta
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
if: "${{ env.DOCKERHUB_USERNAME != '' }}"
uses: docker/metadata-action@v4
with:
images: ${{ secrets.DOCKERHUB_USERNAME }}/low-power-image-processing
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
if: "${{ steps.docker_meta.outcome == 'success' }}"
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build
id: build
if: "${{ steps.docker_meta.outcome == 'skipped' }}"
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: false
tags: low-power-image-processing:action
- name: Build Push
id: build_push
if: "${{ steps.docker_meta.outcome == 'success' }}"
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
# Echo digest so users can validate their image
- name: Image digest
if: "${{ steps.docker_meta.outcome == 'success' }}"
run: echo "${{ steps.build_push.outputs.digest }}"