Skip to content

Commit 442f630

Browse files
committed
Merge branch 'workflow_test'
2 parents f678dd9 + 8047539 commit 442f630

File tree

4 files changed

+145
-16
lines changed

4 files changed

+145
-16
lines changed
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: Test and Deploy
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags:
7+
- 'v*'
8+
pull_request:
9+
branches: [main, "release/*", "dev"]
10+
11+
permissions:
12+
contents: read
13+
packages: write
14+
15+
jobs:
16+
test:
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
os: ["ubuntu-latest", "windows-latest"]
22+
python-version: ["3.11"]
23+
timeout-minutes: 20
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Set up Python ${{ matrix.python-version }}
30+
uses: actions/setup-python@v4
31+
with:
32+
python-version: ${{ matrix.python-version }}
33+
34+
- name: Install dependencies
35+
run: |
36+
python -m pip install --upgrade pip
37+
pip install -r requirements.txt
38+
shell: bash
39+
40+
- name: Install sh (Ubuntu only)
41+
if: matrix.os == 'ubuntu-latest'
42+
run: pip install sh
43+
44+
- name: List dependencies
45+
run: python -m pip list
46+
47+
- name: Run pytest
48+
run: pytest -v
49+
50+
build-and-push:
51+
needs: test
52+
runs-on: ubuntu-latest
53+
# Only run on pushes to main/workflow_test or tags, not on PRs
54+
if: github.event_name == 'push'
55+
56+
steps:
57+
- name: Checkout
58+
uses: actions/checkout@v4
59+
60+
- name: Set up Docker Buildx
61+
uses: docker/setup-buildx-action@v3
62+
63+
- name: Log in to GHCR
64+
uses: docker/login-action@v3
65+
with:
66+
registry: ghcr.io
67+
username: ${{ github.actor }}
68+
password: ${{ secrets.PASSWORD }}
69+
70+
- name: Create dummy .env for CI
71+
run: |
72+
echo "host_config_dir=/tmp/configs" >> .env
73+
echo "host_data_dir=/tmp/data" >> .env
74+
echo "host_log_dir=/tmp/logs" >> .env
75+
76+
- name: Extract Docker metadata
77+
id: meta
78+
uses: docker/metadata-action@v5
79+
with:
80+
images: |
81+
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}
82+
tags: |
83+
type=raw,value=latest
84+
85+
- name: Build and push
86+
uses: docker/bake-action@v5
87+
with:
88+
files: |
89+
docker-compose.yaml
90+
push: true
91+
set: |
92+
*.platform=linux/amd64
93+
*.cache-from=type=gha
94+
*.cache-to=type=gha,mode=max
95+
deepvisionxplain.tags=${{ steps.meta.outputs.tags }}
96+
97+
cleanup-old-packages:
98+
needs: build-and-push
99+
runs-on: ubuntu-latest
100+
if: github.event_name == 'push'
101+
102+
steps:
103+
- name: Delete old packages
104+
uses: actions/delete-package-versions@v4
105+
with:
106+
package-name: 'deepvisionxplain'
107+
package-type: 'container'
108+
min-versions-to-keep: 4
109+
delete-only-untagged-versions: false
110+
token: ${{ secrets.PASSWORD }}

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Tests
22

33
on:
44
push:
5-
branches: [main]
5+
branches: ["dev"]
66

77
pull_request:
88
branches: [main, "release/*", "dev"]

.pre-commit-config.yaml

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

docker-compose.prod.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
version: '3.8'
2+
3+
services:
4+
deepvisionxplain:
5+
image: ghcr.io/lus105/deepvisionxplain:latest
6+
7+
ports:
8+
- "9090:8000"
9+
10+
env_file:
11+
- .env
12+
13+
volumes:
14+
# Mount config and data directories
15+
- ${host_config_dir}:/app/configs
16+
- ${host_data_dir}:/app/data
17+
- ${host_log_dir}:/app/logs
18+
19+
environment:
20+
- PYTHONPATH=/app
21+
- NVIDIA_VISIBLE_DEVICES=all
22+
- TZ=Europe/Vilnius
23+
24+
# Fix for PyTorch DataLoader shared memory using host IPC
25+
ipc: host
26+
27+
# Enable GPU support
28+
runtime: nvidia
29+
30+
restart: unless-stopped
31+
32+
networks:
33+
deepvision_network:
34+
driver: bridge

0 commit comments

Comments
 (0)