Migrate from rye to uv #107
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: Run tests | |
on: | |
pull_request: | |
workflow_dispatch: | |
env: | |
NATS_TOKEN: test | |
jobs: | |
test: | |
name: Run tests on Python ${{ matrix.python-version }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.11", "3.12"] | |
steps: | |
- name: 👀 Checkout code | |
uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: Setup apt cache | |
uses: actions/cache@v2 | |
with: | |
path: /var/cache/apt/archives | |
key: ${{ runner.os }}-apt-${{ hashFiles('/etc/apt/sources.list') }} | |
- name: 😭 Install system dependencies | |
run: | | |
sudo apt-get update && sudo apt-get install -y \ | |
netcat-traditional \ | |
unzip \ | |
libgeos-dev \ | |
libcurl4-openssl-dev \ | |
libssl-dev \ | |
binutils \ | |
curl \ | |
git \ | |
autoconf \ | |
automake \ | |
build-essential \ | |
libtool \ | |
gcc \ | |
libmagic-dev \ | |
poppler-utils \ | |
tesseract-ocr \ | |
libreoffice \ | |
libpq-dev \ | |
pandoc | |
- name: 🐍 Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: 🔽 Install uv | |
run: | | |
pip install uv | |
- name: 🔽 Download and Install NATS Server | |
run: | | |
curl -L https://github.com/nats-io/nats-server/releases/download/v2.10.22/nats-server-v2.10.22-linux-amd64.zip -o nats-server.zip | |
unzip nats-server.zip -d nats-server && sudo cp nats-server/nats-server-v2.10.22-linux-amd64/nats-server /usr/bin | |
- name: 🛠️ Set up NATS arguments | |
run: | | |
nohup nats-server \ | |
--addr 0.0.0.0 \ | |
--port 4222 \ | |
--auth "$NATS_TOKEN" > nats.log 2>&1 & | |
- name: 🔍 Verify NATS Server is Running | |
run: | | |
sleep 1 # Give the server some time to start | |
if nc -zv localhost 4222; then | |
echo "✅ NATS Server is running on port 4222." | |
else | |
echo "❌ Failed to start NATS Server." | |
cat nats.log | |
exit 1 | |
fi | |
- name: 🔨 Install dependencies with uv | |
run: | | |
uv venv | |
source .venv/bin/activate | |
UV_INDEX_STRATEGY=unsafe-first-match uv pip install -e ./libs/megaparse[test] | |
UV_INDEX_STRATEGY=unsafe-first-match uv pip install -e ./libs/megaparse_sdk[test] | |
UV_INDEX_STRATEGY=unsafe-first-match uv pip install pytest pytest-cov | |
- name: 🚀 Run tests | |
run: | | |
python -m pytest libs/megaparse_sdk/tests/ |