Skip to content

Automated testing pipeline #3

Automated testing pipeline

Automated testing pipeline #3

Workflow file for this run

name: Development Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
- name: Build wheel
run: |
pip install build
python3 -m build
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: wheel
path: dist
retention-days: 1
install:
runs-on: ubuntu-latest
needs: build
steps:
- name: prepare system
run: |
sudo apt-get update
sudo apt-get install -y build-essential
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Setting up virtual env
run: |
python -m pip install --upgrade pip
pip install virtualenv
virtualenv .venv
- name: Activate virtual env
run: |
source .venv/bin/activate
- name: Install dependencies
run: |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Getting build wheel
uses: actions/download-artifact@v4
with:
name: wheel
- name: Install package
run: |
pip install dist/*.whl
- name: Upload virtual env
uses: actions/upload-artifact@v4
with:
name: venv
path: ./.venv
retention-days: 1
test:
runs-on: ubuntu-latest
needs: install
steps:
- name: prepare system
run: |
sudo apt-get update
sudo apt-get install -y build-essential
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Getting the virtual env
uses: actions/download-artifact@v4
with:
name: venv
- name: Activate virtual env
run: |
ls -ahl
source .venv/bin/activate
- name: Install test dependencies
run: |
if [ -f tests/requirements.txt ]; then pip install -r tests/requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
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: Test with pytest
run: |
pytest