47 add beautifulsoupwebloader #88
Workflow file for this run
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: Python package workflow | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
pip install poetry | |
poetry install | |
- name: Run critical tests | |
env: | |
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }} | |
run: poetry run pytest tests/critical/ -v | |
- name: Build package | |
run: poetry build | |
- name: Check version change | |
id: check_version | |
run: | | |
git fetch origin main | |
# Extract version from current pyproject.toml | |
current_version=$(poetry version -s) | |
# Extract version from main branch pyproject.toml | |
main_version=$(git show origin/main:pyproject.toml | grep "^version = " | cut -d'"' -f2) | |
if [ "$current_version" != "$main_version" ]; then | |
echo "Version changed from $main_version to $current_version" | |
echo "version_changed=true" >> $GITHUB_OUTPUT | |
else | |
echo "Version unchanged" | |
echo "version_changed=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Publish to PyPI | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.check_version.outputs.version_changed == 'true' | |
uses: pypa/gh-action-pypi-publish@v1.4.2 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
test-python-versions: | |
name: Test Python ${{ matrix.python-version }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Verify Python version | |
run: | | |
python_version=$(python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))') | |
if python -c "import sys; exit(0 if sys.version_info >= (3, 9) and sys.version_info < (4, 0) else 1)"; then | |
echo "Python version $python_version meets requirements (>=3.9, <4.0)" | |
else | |
echo "Python version $python_version does not meet requirements (>=3.9, <4.0)" | |
exit 1 | |
fi | |
- name: Test installation | |
run: | | |
pip install poetry | |
poetry install |