Skip to content

Commit 548b23c

Browse files
committed
feat: release config
1 parent 00e5af1 commit 548b23c

File tree

9 files changed

+293
-149
lines changed

9 files changed

+293
-149
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
## Description
2+
Brief description of the changes in this PR.
3+
4+
## Type of Change
5+
- [ ] Bug fix (non-breaking change which fixes an issue)
6+
- [ ] New feature (non-breaking change which adds functionality)
7+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
8+
- [ ] Documentation update
9+
- [ ] Performance improvement
10+
- [ ] Code refactoring
11+
12+
## Testing
13+
- [ ] Tests pass locally
14+
- [ ] New tests added for new functionality
15+
- [ ] Integration tests pass
16+
17+
## Checklist
18+
- [ ] My code follows the style guidelines of this project
19+
- [ ] I have performed a self-review of my own code
20+
- [ ] I have commented my code, particularly in hard-to-understand areas
21+
- [ ] I have made corresponding changes to the documentation
22+
- [ ] My changes generate no new warnings
23+
- [ ] New and existing unit tests pass locally with my changes
24+
25+
## Commit Message Format
26+
Please ensure your commit messages follow the conventional commits format:
27+
- `feat: add new feature`
28+
- `fix: resolve bug`
29+
- `docs: update documentation`
30+
- `style: format code`
31+
- `refactor: refactor code`
32+
- `test: add tests`
33+
- `chore: update dependencies`

.github/workflows/pr.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Pull Request
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
jobs:
8+
test:
9+
name: Test Python ${{ matrix.python-version }}
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Cache pip dependencies
25+
uses: actions/cache@v3
26+
with:
27+
path: ~/.cache/pip
28+
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
29+
restore-keys: |
30+
${{ runner.os }}-pip-
31+
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install -e ".[dev]"
36+
37+
- name: Lint with flake8
38+
run: |
39+
# Stop the build if there are Python syntax errors or undefined names
40+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
41+
# Exit-zero treats all errors as warnings
42+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
43+
44+
- name: Check code formatting with black
45+
run: |
46+
black --check --diff .
47+
48+
- name: Type check with mypy
49+
run: |
50+
mypy src/lingodotdev
51+
52+
- name: Test with pytest
53+
run: |
54+
pytest --cov=src/lingodotdev --cov-report=xml --cov-report=term-missing
55+
56+
- name: Upload coverage to Codecov
57+
if: matrix.python-version == '3.11'
58+
uses: codecov/codecov-action@v3
59+
with:
60+
file: ./coverage.xml
61+
flags: unittests
62+
name: codecov-umbrella
63+
fail_ci_if_error: false
64+
65+
build:
66+
name: Build package
67+
runs-on: ubuntu-latest
68+
needs: test
69+
70+
steps:
71+
- name: Checkout code
72+
uses: actions/checkout@v4
73+
74+
- name: Set up Python
75+
uses: actions/setup-python@v4
76+
with:
77+
python-version: '3.11'
78+
79+
- name: Install build dependencies
80+
run: |
81+
python -m pip install --upgrade pip
82+
pip install build
83+
84+
- name: Build package
85+
run: |
86+
python -m build
87+
88+
- name: Upload build artifacts
89+
uses: actions/upload-artifact@v3
90+
with:
91+
name: dist
92+
path: dist/

.github/workflows/publish.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 85 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,98 @@ name: Release
22

33
on:
44
push:
5-
tags:
6-
- 'v*'
5+
branches: [main]
76

87
jobs:
9-
create-release:
8+
test:
9+
name: Test Python ${{ matrix.python-version }}
1010
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Cache pip dependencies
25+
uses: actions/cache@v3
26+
with:
27+
path: ~/.cache/pip
28+
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
29+
restore-keys: |
30+
${{ runner.os }}-pip-
31+
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install -e ".[dev]"
36+
37+
- name: Lint with flake8
38+
run: |
39+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
40+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
41+
42+
- name: Check code formatting with black
43+
run: |
44+
black --check --diff .
45+
46+
- name: Type check with mypy
47+
run: |
48+
mypy src/lingodotdev
49+
50+
- name: Test with pytest
51+
run: |
52+
pytest --cov=src/lingodotdev --cov-report=xml --cov-report=term-missing
53+
54+
release:
55+
name: Release
56+
runs-on: ubuntu-latest
57+
needs: test
58+
concurrency: release
1159
permissions:
12-
contents: write
13-
60+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
61+
contents: write # IMPORTANT: this permission is mandatory for creating releases
62+
1463
steps:
15-
- uses: actions/checkout@v4
64+
- name: Checkout code
65+
uses: actions/checkout@v4
1666
with:
1767
fetch-depth: 0
68+
token: ${{ secrets.GITHUB_TOKEN }}
69+
70+
- name: Set up Python
71+
uses: actions/setup-python@v4
72+
with:
73+
python-version: '3.11'
1874

19-
- name: Create Release
20-
uses: actions/create-release@v1
75+
- name: Install dependencies
76+
run: |
77+
python -m pip install --upgrade pip
78+
pip install python-semantic-release build
79+
80+
- name: Run semantic release (version)
2181
env:
22-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83+
run: |
84+
semantic-release version
85+
86+
- name: Build package
87+
run: |
88+
python -m build
89+
90+
- name: Publish to PyPI
91+
uses: pypa/gh-action-pypi-publish@release/v1
2392
with:
24-
tag_name: ${{ github.ref }}
25-
release_name: Release ${{ github.ref }}
26-
body: |
27-
## Changes in this release
28-
29-
See the [changelog](CHANGELOG.md) for detailed information.
30-
31-
## Installation
32-
33-
```bash
34-
pip install lingo-dev-sdk
35-
```
36-
37-
## Documentation
38-
39-
For detailed usage instructions, see the [README](README.md).
40-
draft: false
41-
prerelease: false
93+
print-hash: true
94+
95+
- name: Create GitHub release
96+
env:
97+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
98+
run: |
99+
semantic-release publish --skip-pypi

.github/workflows/test.yml

Lines changed: 0 additions & 54 deletions
This file was deleted.

.releaserc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"branches": [
3+
"main"
4+
],
5+
"plugins": [
6+
"@semantic-release/commit-analyzer",
7+
"@semantic-release/release-notes-generator",
8+
"@semantic-release/changelog",
9+
"@semantic-release/github"
10+
]
11+
}

0 commit comments

Comments
 (0)