-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (47 loc) · 1.45 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
# .github/workflows/ci.yml
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
# 1. Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3
# 2. Set up Python environment
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10' # Specify your Python version
# 3. Install Poetry
- name: Install Poetry
uses: abatilo/[email protected]
with:
poetry-version: '1.8.3' # Specify your Poetry version
# 4. Cache Poetry dependencies (Optional but recommended)
- name: Cache Poetry dependencies
uses: actions/cache@v3
with:
path: |
~/.cache/pypoetry
~/.cache/pip
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
# 5. Install dependencies
- name: Install dependencies
run: poetry install --no-interaction --no-ansi
# 6. Run tests
- name: Run tests
run: poetry run pytest -v
# 7. Build the package
- name: Build package
run: poetry build
# 8. Publish to PyPI
- name: Publish to PyPI
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: poetry publish -u __token__ -p ${{ secrets.PYPI_TOKEN }} -vvv