diff --git a/.github/actions/setup-python-bindings/action.yml b/.github/actions/setup-python-bindings/action.yml new file mode 100644 index 0000000..57a1fa9 --- /dev/null +++ b/.github/actions/setup-python-bindings/action.yml @@ -0,0 +1,24 @@ +name: Setup Python bindings +description: Install Python headers, create venv, install maturin, and build the taxonomy Python extension + +runs: + using: composite + steps: + - name: Install python headers + run: sudo apt-get update && sudo apt-get install -y python3-dev python3-pip python3-venv + shell: bash + + - name: Install maturin + run: | + python3 -m venv venv + . venv/bin/activate + pip install --upgrade pip + pip install maturin downloads pytest + pip show maturin + shell: bash + + - name: Add library to venv + run: | + . venv/bin/activate + maturin develop --features=python + shell: bash diff --git a/.github/workflows/test_ncbi.yml b/.github/workflows/test_ncbi.yml index c01204a..b2ece7f 100644 --- a/.github/workflows/test_ncbi.yml +++ b/.github/workflows/test_ncbi.yml @@ -20,20 +20,8 @@ jobs: toolchain: stable override: true - - name: Install python headers - run: sudo apt-get update && sudo apt-get install python3-dev python3-pip python3-venv - - - name: Install python dependencies - run: | - python3 -m venv venv - . venv/bin/activate - pip3 install maturin downloads pytest - pip3 show maturin - - - name: Add library to venv - run: | - . venv/bin/activate - maturin develop --features=python + - name: Setup Python bindings + uses: ./.github/actions/setup-python-bindings - name: Test Python bindings with latest NCBI taxonomy run: | diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b7cba3a..447513c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,24 +39,12 @@ jobs: - name: version info run: rustc --version; cargo --version; + - name: Setup Python bindings + uses: ./.github/actions/setup-python-bindings + - name: Run all tests run: cargo test --features=python_test - - name: Install python headers - run: sudo apt-get update && sudo apt-get install python3-dev python3-pip python3-venv - - - name: Install maturin - run: | - python3 -m venv venv - . venv/bin/activate - pip3 install maturin downloads pytest - pip3 show maturin - - - name: add library to venv - run: | - . venv/bin/activate - maturin develop --features=python - - name: Run the python tests run: | . venv/bin/activate