ci: Add test to github actions.

This commit is contained in:
tecnovert 2024-11-28 21:57:40 +02:00
parent 938c641736
commit 435e74f83a
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93
3 changed files with 61 additions and 28 deletions

58
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,58 @@
name: ci
on: [push, pull_request]
env:
BIN_DIR: /tmp/cached_bin
TEST_RELOAD_PATH: /tmp/test_basicswap1
jobs:
ci:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 codespell pytest
pip install -r requirements.txt --require-hashes
- name: Install
run: |
pip install .
- name: Running flake8
run: |
flake8 --ignore=E203,E501,W503 --exclude=basicswap/contrib,basicswap/interface/contrib,.eggs,.tox,bin/install_certifi.py
- name: Running codespell
run: |
codespell --check-filenames --disable-colors --quiet-level=7 --ignore-words=tests/lint/spelling.ignore-words.txt -S .git,.eggs,.tox,pgp,*.pyc,*basicswap/contrib,*basicswap/interface/contrib,*mnemonics.py,bin/install_certifi.py,*basicswap/static
- name: Running test_other
run: |
pytest tests/basicswap/test_other.py
- name: Cache coin cores
id: cache-cores
uses: actions/cache@v3
env:
cache-name: cache-cores
with:
path: "$BIN_DIR"
key: python bin/basicswap-prepare.py --version --withcoins=bitcoin,monero
- if: ${{ steps.cache-yarn.outputs.cache-hit != 'true' }}
name: Running basicswap-prepare
run: |
basicswap-prepare --bindir="$BIN_DIR" --preparebinonly --withcoins=particl,bitcoin,monero
- name: Running test_encrypted_xmr_reload
run: |
export PYTHONPATH=$(pwd)
export TEST_PATH=${TEST_RELOAD_PATH}
mkdir -p ${TEST_RELOAD_PATH}/bin
cp -r $BIN_DIR/* ${TEST_RELOAD_PATH}/bin/
pytest tests/basicswap/extended/test_encrypted_xmr_reload.py

View file

@ -1,26 +0,0 @@
name: lint
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 codespell
- name: Running flake8
run: |
flake8 --ignore=E203,E501,W503 --exclude=basicswap/contrib,basicswap/interface/contrib,.eggs,.tox,bin/install_certifi.py
- name: Running codespell
run: |
codespell --check-filenames --disable-colors --quiet-level=7 --ignore-words=tests/lint/spelling.ignore-words.txt -S .git,.eggs,.tox,pgp,*.pyc,*basicswap/contrib,*basicswap/interface/contrib,*mnemonics.py,bin/install_certifi.py,*basicswap/static

View file

@ -103,12 +103,13 @@ class Test(XmrTestBase):
waitForNumBids(self.delay_event, 12700, 1) waitForNumBids(self.delay_event, 12700, 1)
for i in range(10): for i in range(16):
bids = read_json_api(12700, "bids") bids = read_json_api(12700, "bids")
bid = bids[0] bid = bids[0]
if bid["bid_state"] == "Received": if bid["bid_state"] == "Received":
break break
self.delay_event.wait(1) self.delay_event.wait(2)
assert bid["bid_state"] == "Received"
assert bid["expire_at"] == bid["created_at"] + data["validmins"] * 60 assert bid["expire_at"] == bid["created_at"] + data["validmins"] * 60
data = {"accept": True} data = {"accept": True}