Resolve deployment failure #386
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
name: Tests | |
# Only run on branches (e.g. not tags) | |
on: | |
push: | |
branches: | |
- "*" | |
pull_request: | |
branches: | |
- "*" | |
jobs: | |
tests: | |
name: Tests | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
python-version: [3.8, 3.9, "3.10", "3.11", "3.12", "3.13"] | |
# 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 ${{ matrix.python-version }} | |
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 pytest pytest-faulthandler hypothesis typing_extensions numpy | |
- name: Patch Doctests | |
run: python dev/patch-doctest.py | |
- name: Set Environment for Coverage | |
if: matrix.os == 'ubuntu-latest' | |
# Set flags for coverage | |
run: echo FN_COV=1 >> $GITHUB_ENV | |
- name: Build and Install | |
if: matrix.os != 'ubuntu-latest' | |
run: | | |
python -m pip install --editable . | |
- name: Build and Install With Coverage | |
if: matrix.os == 'ubuntu-latest' | |
# 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 | |
- name: Run Unit Tests | |
run: pytest --hypothesis-profile=standard --doctest-glob=README.rst | |
- name: Upload to CodeCov | |
if: matrix.os == 'ubuntu-latest' | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: true | |
test_no_numpy: | |
name: Try Without NumpPy | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.8, 3.9, "3.10", "3.11", "3.12", "3.13"] | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --editable . | |
- name: Ensure Run Without Error | |
run: python -c "import fastnumbers; print(fastnumbers.try_float('8.6'))" | |
tests_aarch64: | |
name: Tests on aarch64 | |
strategy: | |
matrix: | |
pyver: [cp38-cp38, cp39-cp39, cp310-cp310, cp311-cp311, cp312-cp312, cp313-cp313] | |
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@v4 | |
- name: Set up QEMU | |
id: qemu | |
uses: docker/setup-qemu-action@v2 | |
- name: Run tests on aarch64 | |
run: | | |
docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \ | |
${{ env.img }} \ | |
bash -exc '${{ env.py }} -m venv .env && \ | |
source .env/bin/activate && \ | |
echo -e "\e[1;34m Install Dependencies \e[0m" && \ | |
python -m pip install --upgrade pip && \ | |
python -m pip install pytest pytest-faulthandler hypothesis typing_extensions numpy && \ | |
echo -e "\e[1;34m Run Tests \e[0m" && \ | |
python -m pip install --editable . && \ | |
pytest --hypothesis-profile=fast && \ | |
deactivate' |