Skip to content

Allowed to pass an instance on RegexEnum to RegexValidator directly #325

Allowed to pass an instance on RegexEnum to RegexValidator directly

Allowed to pass an instance on RegexEnum to RegexValidator directly #325

name: Build and Test Library
on: [push]
jobs:
build-and-test-pure:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Remove g++ compiler
run: sudo apt-get remove --purge -y g++
- uses: actions/setup-python@v6
with:
python-version: 3.11
- name: Install build tools and test dependencies
run: pip install build pytest
- name: Build the library
run: python -m build
id: build
- name: Install built library
run: |
pip install "$(ls dist/*.tar.gz | head -n 1)[optional]"
rm -rf flask_inputfilter
- name: Verify library usage - Part I - installation
run: |
python -c "from flask_inputfilter import InputFilter"
- name: Verify library usage - Part II - functional test
run: pytest tests/
- name: Verify library usage - Part III - correct version
run: |
output=$(python -c "from flask_inputfilter import InputFilter; print(InputFilter)")
if [ "$output" = "<class 'flask_inputfilter.input_filter.InputFilter'>" ]; then
echo "Test passed: Correct class returned"
else
echo "Test failed: Unexpected output - $output"
exit 1
fi
build-and-test-cython:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install compilers
run: sudo apt-get install -y g++
- uses: actions/setup-python@v6
with:
python-version: 3.11
- name: Install build tools and test dependencies
run: pip install build pytest
- name: Build the library
run: python -m build
id: build
- name: Install built library
run: |
pip install "$(ls dist/*.tar.gz | head -n 1)[optional]"
rm -rf flask_inputfilter
- name: Verify library usage - Part I - installation
run: |
python -c "from flask_inputfilter import InputFilter"
- name: Verify library usage - Part II - functional test
run: pytest tests/
- name: Verify library usage - Part III - correct version
run: |
output=$(python -c "from flask_inputfilter import InputFilter; print(InputFilter)")
if [ "$output" = "<class 'flask_inputfilter._input_filter.InputFilter'>" ]; then
echo "Test passed: Correct class returned"
else
echo "Test failed: Unexpected output - $output"
exit 1
fi
# Creates and uses compiled file instead of pyximport
module_path=$(python -c "import flask_inputfilter; print(flask_inputfilter.__file__)")
module_dir=$(dirname "$module_path")
so_files=$(find "$module_dir" -maxdepth 1 -name "*.so")
if [ -n "$so_files" ]; then
echo ".so-files found:"
echo "$so_files"
else
echo "No .so-files found."
fi