Skip to content

Add module tests and add new stage in pipeline #27

Add module tests and add new stage in pipeline

Add module tests and add new stage in pipeline #27

Workflow file for this run

name: Build, Test, Deploy
on: [push]
jobs:
info:
runs-on: ubuntu-latest
steps:
- name: Print node info
run: |
cat /etc/os-release
build:
runs-on: ubuntu-latest
needs: info
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.10
- name: Install dependencies
run: |
python -m pip install --upgrade pip
sudo apt install pycodestyle
pip install pylint build
- name: Build package
run: |
python -m build .
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: built-artifacts
path: dist
retention-days: 1
test:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
python -m pip install --upgrade pip
sudo apt install pycodestyle pylint
pip install -r py-requirements.txt
pip install pytest
- name: Analysing the code with pycodestyle
run: |
pycodestyle src/**/*.py
- name: Analysing the code with pylint
run: |
pylint src/**/*.py
- name: Run Module tests
run: |
python3 -m pytest -sr tests/test_c*.py
deploy:
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: built-artifacts
path: dist