Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dev infrastructure #79

Merged
merged 11 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 44 additions & 18 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.8

- name: Install deps
run: |
pip install black clang-format
run: python -m pip install ruff clang-format

- name: Run formatting checks
run: python dev/formatting.py --check
Expand All @@ -34,28 +33,28 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.8

- name: Install Flake8
run: pip install flake8 flake8-import-order flake8-bugbear pep8-naming
- name: Install ruff
run: python -m pip install ruff

- name: Run Flake8
run: flake8
- name: Run ruff
run: ruff check

type-checking:
name: Type Checking
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.8

Expand All @@ -64,26 +63,53 @@ jobs:

- name: Run MyPy
run: |
python setup.py install
python -m pip install --editable .
mypy --strict tests

package-validation:
name: Package Validation
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.8

- name: Install Validators
run: pip install twine check-manifest
run: python -m pip install twine build

- name: Run Validation
run: |
check-manifest --ignore ".github*,*.md,.coveragerc"
python setup.py sdist
python -m build
twine check dist/*

warning-free-compilation:
name: Warning-free Compilation
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Note, clang is used on macos, even though it says gcc
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build

- name: Set Environment
run: echo FN_WARNINGS_AS_ERRORS=1 >> $GITHUB_ENV

- name: Compile
run: python -m build --wheel
8 changes: 4 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.11"

Expand All @@ -40,7 +40,7 @@ jobs:

- name: Build Source Distribution
if: matrix.os == 'ubuntu-latest' && matrix.arch != 'aarch64'
run: python setup.py sdist --format=gztar
run: python -m build --sdist

- name: Build Wheel
run: python -m cibuildwheel --output-dir dist
Expand All @@ -62,7 +62,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Download artifacts
uses: actions/download-artifact@v3
Expand Down
40 changes: 21 additions & 19 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,43 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12"]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
# Note, clang is used on macos, even though it says gcc
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install setuptools
python -m pip install pytest pytest-faulthandler hypothesis typing_extensions numpy

- name: Patch Doctests
run: python dev/patch_doctest.py
run: python dev/patch-doctest.py

- name: Set CFLAGS
- name: Set Environment for Coverage
if: matrix.os == 'ubuntu-latest'
# Need no optimization for code coverage
run: echo CFLAGS="--coverage -Og" >> $GITHUB_ENV
# Set flags for coverage
run: echo FN_COV=1 >> $GITHUB_ENV

- name: Build and Install Using pip
- name: Build and Install
if: matrix.os != 'ubuntu-latest'
run: |
python setup.py build # to see compilation output
python -m pip install --editable .

- name: Build and Install Using setuptools
- name: Build and Install With Coverage
if: matrix.os == 'ubuntu-latest'
run: python setup.py install # to see the compilation output and get coverage
# We'll use this legacy method till coverage is supported with pip
run: |
python -m pip install "setuptools>=64" "setuptools-scm>=8.0"
python setup.py install

- name: Run Doctests
run: python -m doctest fastnumbers
Expand All @@ -60,23 +61,24 @@ jobs:

- name: Upload to CodeCov
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
gcov: true
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true

test_no_numpy:
name: Try Without NumpPy
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12"]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]

steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -92,15 +94,15 @@ jobs:
name: Tests on aarch64
strategy:
matrix:
pyver: [cp37-cp37m, cp38-cp38, cp39-cp39, cp310-cp310, cp311-cp311, cp312-cp312]
pyver: [cp38-cp38, cp39-cp39, cp310-cp310, cp311-cp311, cp312-cp312]
runs-on: ubuntu-latest
env:
py: /opt/python/${{ matrix.pyver }}/bin/python
img: quay.io/pypa/manylinux2014_aarch64

steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up QEMU
id: qemu
Expand Down
9 changes: 4 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
*.py[co]
.venv
_version.py

# Packages
*.egg
Expand All @@ -24,12 +24,14 @@ MANIFEST
pip-log.txt

# Unit test / coverage reports
.hypothesis
.coverage
.tox
.cache
.pytest_cache
.hypothesis
.pytest
.envrc
.venv

#Translations
*.mo
Expand All @@ -40,8 +42,5 @@ pip-log.txt
# PyCharm
.idea

# Jupyter
.ipynb_checkpoints/

# VSCode
.vscode
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ a good reason not to be).
Located in the `dev/` folder is development collateral such as formatting and
patching scripts. The only development collateral not in the `dev/`
folder are those files that are expected to exist in the the top-level directory
(such as `setup.py`, `tox.ini`, and CI configuration). All of these scripts
(such as `pyproject.toml`, `tox.ini`, and CI configuration). All of these scripts
can either be run with the python stdandard library, or have hooks in `tox`.

I do not have strong opinions on how one should contribute, so
Expand Down
17 changes: 0 additions & 17 deletions MANIFEST.in

This file was deleted.

Loading
Loading