-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
112 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
name: Python package | ||
|
||
on: | ||
release: | ||
types: [ created ] | ||
|
||
jobs: | ||
lint: | ||
name: Lint Code | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.12" | ||
- name: Install flake8 | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install flake8 | ||
- name: Lint with flake8 | ||
run: | | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
build: | ||
name: Build | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ ubuntu-latest, windows-latest, macos-latest ] | ||
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Cache pip | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install flake8 pytest pytest-cov | ||
python -m pip install -r requirements.txt | ||
- name: Build | ||
shell: bash | ||
run: | | ||
if [[ "$RUNNER_OS" == "Windows" ]]; then | ||
./build.cmd | ||
else | ||
chmod +x ./build.sh && ./build.sh | ||
fi | ||
- name: Find Correct Build | ||
id: findbuild | ||
shell: bash | ||
run: | | ||
if [[ "$RUNNER_OS" == "Windows" ]]; then | ||
output=__pyfastutil.pyd | ||
else | ||
output=__pyfastutil.so | ||
fi | ||
echo "::set-output name=libname::$output" | ||
- name: Upload Build Artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.os }}_py${{ matrix.python-version }}-${{ steps.findbuild.outputs.libname }} | ||
path: pyfastutil/${{ steps.findbuild.outputs.libname }} | ||
|
||
- name: Test with pytest and generate coverage report | ||
run: | | ||
pytest --cov=your_package_name --cov-report=xml | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
file: ./coverage.xml | ||
flags: unittests | ||
name: codecov-umbrella | ||
|
||
- name: Upload to PyPI | ||
shell: bash | ||
run: | | ||
if [[ "$RUNNER_OS" == "Windows" ]]; then | ||
./upload.cmd | ||
else | ||
chmod +x ./upload.sh && ./upload.sh | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
python ./setup.py clean | ||
python ./setup.py sdist bdist_wheel | ||
twine upload --repository pypi dist/* |