Skip to content

Commit 6186af5

Browse files
committed
ci: adding in gh actions
1 parent a25b546 commit 6186af5

4 files changed

Lines changed: 154 additions & 0 deletions

File tree

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "pip"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"

.github/workflows/build.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: "Build Tests"
2+
on:
3+
pull_request:
4+
push:
5+
6+
jobs:
7+
buildpackage:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python-version: ["3.11", "3.12"]
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
python -m pip install --no-cache-dir -r requirements.txt
26+
27+
- run: python -m build

.github/workflows/lint.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Lint Checks
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
commit:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 3
18+
fetch-tags: true
19+
- uses: actions/setup-node@v3
20+
- run: npm install -g @commitlint/cli @commitlint/config-conventional
21+
- run: commitlint --from=HEAD~2 --verbose
22+
23+
lint:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v3
27+
with:
28+
fetch-depth: 3
29+
fetch-tags: true
30+
- uses: actions/setup-python@v4
31+
with:
32+
python-version: 3.12
33+
- run: sudo apt-get update && sudo apt-get install -y git
34+
- run: pip install isort black flake8
35+
- run: |
36+
isort servc
37+
black servc
38+
flake8 --ignore=E501,W503 servc
39+
- run: |
40+
git status
41+
git diff --exit-code servc
42+
43+
tag:
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v3
47+
with:
48+
fetch-depth: 3
49+
fetch-tags: true
50+
- uses: actions/setup-node@v3
51+
- run: npm install -g semantic-release @semantic-release/gitlab @semantic-release/changelog @semantic-release/git
52+
- run: semantic-release --tag-format '${version}' --dry-run

.github/workflows/unittests.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: "Unit Tests"
2+
on:
3+
pull_request:
4+
push:
5+
6+
jobs:
7+
unittest:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python-version: ["3.11", "3.12"]
12+
13+
services:
14+
rabbitmq:
15+
image: rabbitmq:3
16+
env:
17+
RABBITMQ_DEFAULT_USER: guest
18+
RABBITMQ_DEFAULT_PASS: guest
19+
ports:
20+
- 5672:5672
21+
22+
redis:
23+
image: redis
24+
options: >-
25+
--health-cmd "redis-cli ping"
26+
--health-interval 10s
27+
--health-timeout 5s
28+
--health-retries 5
29+
ports:
30+
- 6379:6379
31+
32+
postgres:
33+
image: postgres:13
34+
env:
35+
POSTGRES_PASSWORD: postgres
36+
POSTGRES_DB: postgres
37+
options: >-
38+
--health-cmd pg_isready
39+
--health-interval 10s
40+
--health-timeout 5s
41+
--health-retries 5
42+
ports:
43+
- 5432:5432
44+
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v3
48+
49+
- name: Set up Python ${{ matrix.python-version }}
50+
uses: actions/setup-python@v4
51+
with:
52+
python-version: ${{ matrix.python-version }}
53+
54+
- name: Install dependencies
55+
run: |
56+
python -m pip install --upgrade pip
57+
python -m pip install --no-cache-dir -r requirements.txt
58+
python -m pip install coverage
59+
60+
- name: Run tests
61+
env:
62+
DATABASE_URL: postgres://postgres:postgres@localhost/postgres
63+
REDIS_URL: redis://localhost
64+
CLOUDAMQP_URL: amqp://guest:guest@localhost
65+
COVERAGE: ${{ secrets.COVERAGE }}
66+
run: |
67+
coverage run --concurrency=multiprocessing -m unittest tests/*.py
68+
coverage combine
69+
coverage report -m --fail-under ${COVERAGE:-80}

0 commit comments

Comments
 (0)