From e3cc49bc61f8de331428e6b36499af69ef46214a Mon Sep 17 00:00:00 2001 From: undeath Date: Mon, 28 Jun 2021 16:22:03 +0200 Subject: [PATCH] github action test runner --- .github/workflows/test1.yml | 30 -------- .github/workflows/unittests.yml | 54 +++++++++++++++ .travis.yml | 69 ------------------- .../install_bitcoind.sh | 0 4 files changed, 54 insertions(+), 99 deletions(-) delete mode 100644 .github/workflows/test1.yml create mode 100644 .github/workflows/unittests.yml delete mode 100644 .travis.yml rename test/{travis => testrunner}/install_bitcoind.sh (100%) diff --git a/.github/workflows/test1.yml b/.github/workflows/test1.yml deleted file mode 100644 index 998d0f0..0000000 --- a/.github/workflows/test1.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Python package - -on: [push] - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.6, 3.7, 3.8, 3.9] - - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements/base.txt - pip install -r requirements/testing.txt - - name: Lint with flake8 - run: | - flake8 -v jmclient jmbase jmbitcoin jmdaemon scripts - #- name: Test with pytest - #run: | - #pytest - diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml new file mode 100644 index 0000000..83f9d88 --- /dev/null +++ b/.github/workflows/unittests.yml @@ -0,0 +1,54 @@ +name: Python package + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.6, 3.7, 3.8, 3.9] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Cache venv + id: cache-venv + uses: actions/cache@v2 + env: + cache-name: venv + with: + path: jmvenv + key: ${{ runner.os }}-${{ matrix.python-version }}-${{ env.cache-name }}-${{ hashFiles('requirements/*.txt', 'install.sh', '*/setup.py') }} + - name: Setup joinmarket + virtualenv + if: steps.cache-venv.outputs.cache-hit != 'true' + run: | + sudo apt update + ./install.sh --develop --with-qt + ./jmvenv/bin/python -m pip install --upgrade pip + ./jmvenv/bin/pip install -r requirements/base.txt + ./jmvenv/bin/pip install -r requirements/testing.txt + - name: Lint with flake8 + run: ./jmvenv/bin/flake8 -v jmclient jmbase jmbitcoin jmdaemon scripts + - name: Cache bitcoind + uses: actions/cache@v2 + env: + cache-name: bitcoind + with: + path: ~/bitcoin/*/bin/bitcoin* + key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('test/testrunner/install_bitcoind.sh') }} + - name: Install bitcoind + run: ./test/testrunner/install_bitcoind.sh + - name: Cache miniircd + uses: actions/cache@v2 + env: + cache-name: miniircd + with: + path: miniircd/miniircd + key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('test/run_tests.sh') }} + - name: Run tests + run: source ./jmvenv/bin/activate && ./test/run_tests.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index dd6db65..0000000 --- a/.travis.yml +++ /dev/null @@ -1,69 +0,0 @@ -sudo: required -dist: xenial -matrix: - include: - - os: osx - env: PIP_DOWNLOAD_CACHE=$HOME/Library/Caches/pip - addons: - homebrew: - packages: - - bitcoin - - libsodium - update: true - - os: linux - env: PIP_DOWNLOAD_CACHE=$HOME/.cache/pip - addons: - apt: - packages: - - python3-dev - - python3-pip - - virtualenv - - libsodium18 - - os: linux - services: docker - env: DOCKER_IMG_JM=xenial-py3 - - os: linux - services: docker - env: DOCKER_IMG_JM=bionic-py3 - - os: linux - services: docker - env: DOCKER_IMG_JM=stretch-py3 - - os: linux - services: docker - env: DOCKER_IMG_JM=centos7-py3 - - os: linux - services: docker - env: DOCKER_IMG_JM=fedora27-py3 -before_install: - - do_on(){ if [ "$TRAVIS_OS_NAME" = "$1" ]; then shift; "$@" ; fi; } - - on_host(){ if [ -z "$DOCKER_IMG_JM" ]; then "$@" ; fi; } - - should_run_dockers(){ if [ "$TRAVIS_EVENT_TYPE" = cron ] || [ -n "$TRAVIS_TAG" ] || echo "${TRAVIS_COMMIT_MESSAGE[@]}" | grep -q "TRAVIS_RUN_DOCKERS"; then return 0; else return 1; fi; } - - on_docker(){ if [ -n "$DOCKER_IMG_JM" ]; then "$@" ; fi; } - - do_on osx pip install virtualenv -cache: - directories: - - $HOME/bitcoin/bitcoin-0.19.1/bin - - $HOME/downloads - - $HOME/.cache/pip - - $HOME/Library/Caches/pip - - $HOME/Library/Caches/Homebrew -before_cache: - - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then brew cleanup; fi -install: - - mkdir -p "$HOME/downloads" - - mkdir -p "$TRAVIS_BUILD_DIR/deps/cache/" - - find "$HOME/downloads" -type f -exec cp -v {} "$TRAVIS_BUILD_DIR/deps/cache/" \; - - on_host do_on linux ./test/travis/install_bitcoind.sh - - on_host do_on linux ./install.sh --develop --with-qt - - on_host do_on osx virtualenv --python=python3 jmvenv - - on_host find "$TRAVIS_BUILD_DIR/deps/cache/" -type f -exec cp -v {} "$HOME/downloads/" \; -before_script: - - on_host source jmvenv/bin/activate -script: - - on_host bitcoind --help | head -1 - - on_host ./test/run_tests.sh - - on_host do_on linux flake8 jmbase jmbitcoin jmclient jmdaemon scripts test - - on_docker ./test/Dockerfiles/build_docker.sh -after_success: - - on_docker echo "Success !" - - on_host coveralls diff --git a/test/travis/install_bitcoind.sh b/test/testrunner/install_bitcoind.sh similarity index 100% rename from test/travis/install_bitcoind.sh rename to test/testrunner/install_bitcoind.sh