Skip to content

Testing logic

Testing logic #56

name: Ubuntu 22.04 Python 3.11-12
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
# Copied from snewpy. ;)
build:
# The type of runner that the job will run on.
runs-on: ubuntu-latest
strategy:
# Add a list of python versions we want to use for testing.
matrix:
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Check python version
run: python --version
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
pip install flake8
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Install hop-client
run: |
pip install setuptools wheel
wget https://files.pythonhosted.org/packages/64/d1/108cea042128c7ea7790e15e12e3e5ed595bfcf4b051c34fe1064924beba/hop-client-0.9.0.tar.gz
tar -xzf hop-client-0.9.0.tar.gz
cd hop-client-0.9.0
python setup.py install
cd /home/runner/work/SNEWS_Publishing_Tools/SNEWS_Publishing_Tools
- name: Install requirements
run: |
python -m pip install --upgrade pip
pip install wheel
pip install python-dotenv click tabulate
- shell: bash
env:
USERNAME: ${{ secrets.username }}
PASSWORD: ${{ secrets.password }}
run: |
sudo apt-get install -y expect
which expect
/usr/bin/expect << HOP
spawn hop auth add
expect "Username:"
send "$USERNAME\n"
expect "Password:"
send "$PASSWORD\n"
expect "Hostname (may be empty):"
send "kafka.scimma.org\n"
expect "Token endpoint (empty if not applicable):"
send "\n"
expect eof
HOP
hop auth locate
- name: Install snews-pt
run: pip install .
- name: Check version
run: snews_pt --version
- name: Run pytest
run: |
pip install pytest
pytest snews_pt