Files

157 lines
4.4 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch: # https://docs.github.com/en/actions/how-tos/manage-workflow-runs/manually-run-a-workflow
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# if a PR gets force pushed, cancel the current run and run the new one
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
unittests:
name: unittests (${{ matrix.os }})
# amd64 and arm64 runners
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install system packages
run: |
sudo apt-get -qq update
sudo apt-get install -yq libsnappy-dev zlib1g-dev libbz2-dev libgflags-dev liblz4-dev librocksdb-dev libleveldb-dev libboost-all-dev libsodium-dev
- uses: actions/setup-python@v6
with:
python-version: '3.14'
cache: 'pip'
cache-dependency-path: 'pyproject.toml'
- name: Log Python version
run: python3 --version
- name: Install Python deps
run: |
# test framework -related deps
pip install pycodestyle
pip install pytest-asyncio
pip install pytest-cov
pip install Sphinx
# e-x itself
# - install both leveldb and rocksdb bindings
pip install ".[leveldb,rocksdb]"
- name: Run pytest
run: pytest --cov=electrumx
pycodestyle:
name: pycodestyle
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.14'
cache: 'pip'
- name: Install pycodestyle
run: pip install pycodestyle
- name: Run pycodestyle
run: |
pycodestyle \
--max-line-length=140 \
src
build_docs:
# note: this build task is not related to read-the-docs; it is only here to sanity-check the docs can be built.
# For the read-the-docs build, see .readthedocs.yml
name: build_docs
runs-on: ubuntu-24.04
env:
LC_ALL: "C"
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.14'
cache: 'pip'
cache-dependency-path: 'docs/requirements-docs.txt'
- name: Install docs deps
run: pip install -r docs/requirements-docs.txt
- name: Build docs
run: |
cd docs
make html
docker:
# builds the image and checks the SSL handling of its entrypoint (contrib/docker-smoke-test.sh)
name: docker (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm]
steps:
- uses: actions/checkout@v6
- name: Build image
run: docker build -t plm-electrumx .
- name: Smoke test
run: contrib/docker-smoke-test.sh plm-electrumx
integration:
# ElectrumX against a real Palladium node in regtest mode (tests/integration), with each DB engine
name: integration (${{ matrix.db_engine }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
db_engine: [leveldb, rocksdb]
os: [ubuntu-24.04, ubuntu-24.04-arm]
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.14'
cache: 'pip'
cache-dependency-path: 'pyproject.toml'
- name: Install system packages
run: |
sudo apt-get -qq update
sudo apt-get install -yq libsnappy-dev zlib1g-dev libbz2-dev libgflags-dev liblz4-dev librocksdb-dev libleveldb-dev
- name: Install Python deps
run: |
pip install pytest
pip install ".[${{ matrix.db_engine }}]"
- name: Start the regtest node
run: docker compose -f tests/integration/docker-compose.yml up -d --build --wait
- name: Run integration tests
env:
PLM_TEST_DAEMON_URL: http://plmtest:plmtest@127.0.0.1:28443/
PLM_TEST_DB_ENGINE: ${{ matrix.db_engine }}
run: pytest tests/integration
- name: Node log
if: failure()
run: docker compose -f tests/integration/docker-compose.yml logs palladiumd | tail -100