Skip to content

Commit 145ac98

Browse files
committed
Merge branch 'master' of github.com:newpanjing/simpleui
2 parents d52d322 + 6e51de5 commit 145ac98

File tree

4 files changed

+167
-2
lines changed

4 files changed

+167
-2
lines changed

.github/workflows/Dockerfile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Use official Python image with correct version
2+
FROM python:3.11.8-slim
3+
4+
# Install system dependencies: PostgreSQL client and Redis
5+
RUN apt-get update \
6+
&& apt-get install -y --no-install-recommends \
7+
gcc \
8+
libpq-dev \
9+
redis-server \
10+
&& rm -rf /var/lib/apt/lists/*
11+
12+
# Set work directory
13+
WORKDIR /app/api/tacticalrmm
14+
15+
# Copy requirements files first (for efficient build caching)
16+
COPY api/tacticalrmm/requirements*.txt ./
17+
COPY api/tacticalrmm/settings.py ./
18+
19+
# Extract/set setuptools and wheel versions dynamically (optional: set defaults here if needed)
20+
ARG SETUPTOOLS_VER=latest
21+
ARG WHEEL_VER=latest
22+
23+
# Install pip, setuptools, wheel (use values from settings.py if automated, or set fixed versions below)
24+
RUN pip install --upgrade pip==25.1 \
25+
&& pip install setuptools==$SETUPTOOLS_VER wheel==$WHEEL_VER \
26+
&& pip install -r requirements.txt -r requirements-test.txt
27+
28+
# Copy rest of the source code
29+
COPY . /app
30+
31+
# Start Redis server in background (for local/dev use)
32+
RUN service redis-server start
33+
34+
# Expose port if running server
35+
EXPOSE 8000
36+
37+
# Default CMD (customize for your app)
38+
CMD ["pytest"]
39+
# Or, if you want to run Django by default: ["python", "manage.py", "runserver", "0.0.0.0:8000"]

.github/workflows/cicd.yaml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Tests CI
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- "main"
8+
pull_request:
9+
branches:
10+
- develop
11+
- "main"
12+
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
name: Tests
17+
strategy:
18+
matrix:
19+
python-version: ["3.11.8"]
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- uses: harmon758/postgresql-action@v1
25+
with:
26+
postgresql version: "15"
27+
postgresql db: "pipeline"
28+
postgresql user: "pipeline"
29+
postgresql password: "pipeline123456"
30+
31+
- name: Setup Python ${{ matrix.python-version }}
32+
uses: actions/setup-python@v4
33+
with:
34+
python-version: ${{ matrix.python-version }}
35+
check-latest: true
36+
37+
- name: Install redis
38+
run: |
39+
sudo apt update
40+
sudo apt install -y redis
41+
redis-server --version
42+
43+
- name: Install requirements
44+
working-directory: api/tacticalrmm
45+
run: |
46+
python --version
47+
SETTINGS_FILE="tacticalrmm/settings.py"
48+
SETUPTOOLS_VER=$(grep "^SETUPTOOLS_VER" "$SETTINGS_FILE" | awk -F'[= "]' '{print $5}')
49+
WHEEL_VER=$(grep "^WHEEL_VER" "$SETTINGS_FILE" | awk -F'[= "]' '{print $5}')
50+
pip install pip==25.1
51+
pip install setuptools==${SETUPTOOLS_VER} wheel==${WHEEL_VER}
52+
pip install -r requirements.txt -r requirements-test.txt
53+
54+
- name: Codestyle black
55+
working-directory: api
56+
run: |
57+
black --exclude migrations/ --check --diff tacticalrmm
58+
if [ $? -ne 0 ]; then
59+
exit 1
60+
fi
61+
62+
- name: Lint with flake8
63+
working-directory: api/tacticalrmm
64+
run: |
65+
flake8 --config .flake8 .
66+
if [ $? -ne 0 ]; then
67+
exit 1
68+
fi
69+
70+
- name: Run django tests
71+
env:
72+
GHACTIONS: "yes"
73+
working-directory: api/tacticalrmm
74+
run: |
75+
pytest
76+
if [ $? -ne 0 ]; then
77+
exit 1
78+
fi
79+
80+
- uses: codecov/codecov-action@v3
81+
with:
82+
directory: ./api/tacticalrmm
83+
files: ./api/tacticalrmm/coverage.xml
84+
verbose: true

.github/workflows/my-new-cicd.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: CI Pipeline
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.9'
20+
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install -r requirements.txt
25+
26+
- name: Run tests
27+
run: |
28+
python -m pytest tests/
29+
30+
- name: Build package
31+
run: |
32+
python setup.py sdist bdist_wheel
33+
34+
- name: Upload artifact
35+
uses: actions/upload-artifact@v3
36+
with:
37+
name: package
38+
path: dist/
39+
- name: Lint code
40+
run: |
41+
pip install flake8
42+
flake8 .

.github/workflows/python-package.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ name: Python package
55

66
on:
77
push:
8-
branches: [ master ]
8+
branches: [master]
99
pull_request:
10-
branches: [ master ]
10+
branches: [master]
1111

1212
jobs:
1313
build:

0 commit comments

Comments
 (0)