-
Notifications
You must be signed in to change notification settings - Fork 10
91 lines (87 loc) · 2.59 KB
/
Copy pathtests.yml
File metadata and controls
91 lines (87 loc) · 2.59 KB
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
name: tests
on:
push:
branches:
- stable
- dev
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
services:
mongo:
image: mongo
ports:
- 127.0.0.1:27017:27017
redis:
image: redis
ports:
- 127.0.0.1:6379:6379
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync
- name: Lint
run: |
uv run ruff check
uv run ruff format --diff
- name: Run tests
run: |
NO_COLOR=true uv run pytest --reruns 2 --disable-warnings --log-cli-level=INFO --cov-report xml:cov.xml --cov=bbot_server .
- name: Upload Code Coverage
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./cov.xml
verbose: true
publish_pypi:
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
continue-on-error: true
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Get version
id: calc_version
run: |
VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
- name: Build PyPI package
run: uv build
- name: Publish PyPI package
uses: pypa/gh-action-pypi-publish@release/v1.13
with:
password: ${{ secrets.PYPI_API_TOKEN }}
outputs:
VERSION: ${{ steps.calc_version.outputs.VERSION }}
tag_commit:
needs: publish_pypi
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Configure git
run: |
git config --local user.email "info@blacklanternsecurity.com"
git config --local user.name "GitHub Actions"
- name: Tag commit
run: |
VERSION="${{ needs.publish_pypi.outputs.VERSION }}"
git tag -a "$VERSION" -m "Stable Release $VERSION"
git push origin "$VERSION"