Skip to content

feat: megaparse sdk tests #10

feat: megaparse sdk tests

feat: megaparse sdk tests #10

Workflow file for this run

name: Run Tests API and Worker
on:
pull_request:
workflow_dispatch:
env:
NATS_TOKEN: test
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
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 \
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: 🔨 Install the latest version of rye
uses: eifinger/setup-rye@v4
with:
enable-cache: true
- name: 🎯 Cache hit!
if: steps.setup-rye.outputs.cache-hit == 'true'
run: echo "Rye cache was restored"
- name: 🔄 Sync dependencies
run: |
UV_INDEX_STRATEGY=unsafe-first-match rye sync --no-lock
- name: 🔽 Download and Install NATS Server
run: |
curl -sf https://binaries.nats.dev/nats-io/nats-server/[email protected] | sh
- name: 🛠️ Set up NATS arguments
run: |
nohup nats-server \
--addr 0.0.0.0 \
--port 4222 \
--auth "$NATS_TOKEN" \
--tls \
--tlscert "./libs/megaparse_sdk/tests/certs/client-cert.pem" \
--tlskey "./libs/megaparse_sdk/tests/certs/client-key.pem" \
--tlsverify \
--max_payload 20MB \
--max_pending 200MB \
--http_port 8222 > nats.log 2>&1 &
- name: 🔍 Verify NATS Server is Running
run: |
sleep 1 # Give the server some time to start
if nc -zv 127.0.0.1 4222; then
echo "✅ NATS Server is running on port 4222."
else
echo "❌ Failed to start NATS Server."
cat nats.log
exit 1
fi
- name: 🚀 Run tests
run: |
rye test -p megaparse-sdk