66 lines
1.7 KiB
YAML
66 lines
1.7 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: '3.10'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install poetry
|
|
|
|
- name: Run setup script
|
|
run: |
|
|
/bin/bash .devcontainer/setup.sh ${{ github.workspace }}
|
|
|
|
- name: Run unit tests
|
|
run: |
|
|
cdir=$(pwd)
|
|
cd $HOME/lnbits
|
|
poetry_env_path=$(poetry env info --path)
|
|
source $poetry_env_path/bin/activate
|
|
pip install pytest-asyncio
|
|
cd $cdir
|
|
pytest tests/unit/*.py -s
|
|
|
|
- name: Setup integration tests
|
|
run: |
|
|
export HEADLESS=1
|
|
bash tests/integration/start.sh
|
|
|
|
- name: Run integration tests
|
|
run: |
|
|
cdir=$(pwd)
|
|
cd $HOME/lnbits
|
|
poetry_env_path=$(poetry env info --path)
|
|
source $poetry_env_path/bin/activate
|
|
pip install pytest-asyncio
|
|
cd $cdir
|
|
pytest tests/integration/*.py -s
|
|
|
|
- name: Show integration service logs
|
|
if: failure()
|
|
run: |
|
|
docker ps -a
|
|
docker logs --tail 200 lnbits_nwcprovider_ext_nostr_test || true
|
|
docker exec lnbits_nwcprovider_ext_lnbits_test tail -n 200 /tmp/lnbits.log || true
|
|
|
|
- name: Stop integration services
|
|
if: always()
|
|
run: |
|
|
docker rm -f lnbits_nwcprovider_ext_lnbits_test lnbits_nwcprovider_ext_nostr_test || true
|
|
docker network rm lnbits_nwcprovider_ext_test_network || true
|