Skip to content

Commit 451fb2f

Browse files
authored
Init version (#1)
* Add .idea files Update .gitignore Add init commit * Add some logic * Some improvements * Pass some tests * Fix some tests * Add some logic * Add some logic * Fix more tests * Add test file * Update test logi * Update test logic * Update test logic * Update test logic * Fix revision * Fix args * Fix args * Fix args * Update codecov * Add test publish * Update code * Improve code a little bit * Improve code a little bit * Add attachment model * Add badges
1 parent 0252024 commit 451fb2f

File tree

21 files changed

+2586
-0
lines changed

21 files changed

+2586
-0
lines changed

.github/workflows/publish.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
# Semver versioning pattern
7+
- 'v[0-9]+.[0-9]+.[0-9]+'
8+
9+
jobs:
10+
build-and-publish:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Check out repository
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.9"
20+
21+
- name: Install build tools
22+
run: |
23+
python -m pip install --upgrade pip
24+
python -m pip install build twine
25+
26+
- name: Build package
27+
run: python -m build
28+
29+
- name: Publish package to PyPI
30+
run: |
31+
python -m twine upload dist/*
32+
env:
33+
TWINE_USERNAME: __token__
34+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}

.github/workflows/test-publish.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Test Publish to TestPyPI
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version_suffix:
7+
description: 'Version suffix for test release (e.g., .dev1, .rc1)'
8+
required: false
9+
default: '.dev1'
10+
type: string
11+
12+
jobs:
13+
test-publish:
14+
runs-on: ubuntu-latest
15+
environment: test-pypi
16+
17+
steps:
18+
- name: Check out repository
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.11"
25+
26+
- name: Install uv
27+
uses: astral-sh/setup-uv@v3
28+
29+
- name: Install build dependencies
30+
run: |
31+
uv sync --extra dev
32+
33+
- name: Build package
34+
run: |
35+
uv build
36+
37+
- name: Check package
38+
run: |
39+
uvx twine check dist/*
40+
41+
- name: List built packages
42+
run: |
43+
ls -la dist/
44+
45+
- name: Publish to TestPyPI
46+
env:
47+
TWINE_USERNAME: __token__
48+
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
49+
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
50+
run: |
51+
uvx twine upload dist/* --verbose
52+
53+
- name: Test installation from TestPyPI
54+
run: |
55+
sleep 30 # Wait for package to be available
56+
python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ temp-mail-io
57+
python -c "import tempmail; print('✓ Package installed successfully from TestPyPI')"
58+
python -c "from tempmail import TempMailClient; print('✓ TempMailClient imports successfully')"

.github/workflows/test.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-latest, windows-latest, macOS-latest]
16+
python-version: ["3.8", "3.9", "3.10", "3.11"]
17+
18+
steps:
19+
- name: Check out repository
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@v3
29+
with:
30+
enable-cache: true
31+
32+
- name: Install dependencies
33+
run: |
34+
uv sync --extra dev
35+
36+
- name: Run pre-commit
37+
run: |
38+
uvx pre-commit run --all-files
39+
40+
- name: Test with pytest
41+
run: |
42+
uv run pytest tests/ -v --cov=tempmail --cov-report=xml --cov-report=term-missing
43+
44+
- name: Upload coverage to Codecov
45+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
46+
uses: codecov/codecov-action@v5
47+
with:
48+
files: ./coverage.xml
49+
flags: unittests
50+
name: codecov-umbrella
51+
fail_ci_if_error: false
52+
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)