Skip to content

Updates

Updates #32

name: Build Python Package
on:
push:
branches: [ "**" ]
tags-ignore: [ "**" ]
jobs:
build-package:
runs-on: ubuntu-latest
steps:
# 1. Initialize the build
# -------------------------------------------------------------------------------------------
- name: Checkout
uses: actions/checkout@v4
# Without this option, we don't get the tag information
with:
fetch-depth: 0
- name: Initialise the build system
run: |
chmod u+x $GITHUB_WORKSPACE/build/bin/*.sh
$GITHUB_WORKSPACE/build/bin/initbuild.sh
source $GITHUB_WORKSPACE/build/bin/.functions.sh
# 2. Python Package Build
# -------------------------------------------------------------------------------------------
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Build the Python package
run: |
sed -i "s#__version__ = \"100.0.0\"#__version__ = \"${{ env.VERSION_NOPREREL }}\"#g" ${GITHUB_WORKSPACE}/src/wiotp/sdk/__init__.py
cat ${GITHUB_WORKSPACE}/src/wiotp/sdk/__init__.py
python -m pip install --upgrade pip
pip install .[dev]
python -m pytest
env:
ONE_JOB_ONLY_TESTS: "true"
WIOTP_API_KEY: ${{ secrets.WIOTP_API_KEY }}
WIOTP_API_TOKEN: ${{ secrets.WIOTP_API_TOKEN }}
WIOTP_ORG_ID: ${{ secrets.WIOTP_ORG_ID }}
CLOUDANT_HOST: ${{ secrets.CLOUDANT_HOST }}
CLOUDANT_PORT: ${{ secrets.CLOUDANT_PORT }}
CLOUDANT_USERNAME: ${{ secrets.CLOUDANT_USERNAME }}
CLOUDANT_PASSWORD: ${{ secrets.CLOUDANT_PASSWORD }}
EVENTSTREAMS_API_KEY: ${{ secrets.EVENTSTREAMS_API_KEY }}
EVENTSTREAMS_ADMIN_URL: ${{ secrets.EVENTSTREAMS_ADMIN_URL }}
EVENTSTREAMS_BROKER1: ${{ secrets.EVENTSTREAMS_BROKER1 }}
EVENTSTREAMS_BROKER2: ${{ secrets.EVENTSTREAMS_BROKER2 }}
EVENTSTREAMS_BROKER3: ${{ secrets.EVENTSTREAMS_BROKER3 }}
EVENTSTREAMS_BROKER4: ${{ secrets.EVENTSTREAMS_BROKER4 }}
EVENTSTREAMS_BROKER5: ${{ secrets.EVENTSTREAMS_BROKER5 }}
EVENTSTREAMS_BROKER6: ${{ secrets.EVENTSTREAMS_BROKER6 }}
EVENTSTREAMS_USER: ${{ secrets.EVENTSTREAMS_USER }}
EVENTSTREAMS_PASSWORD: ${{ secrets.EVENTSTREAMS_PASSWORD }}
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 src --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings.
flake8 src --count --exit-zero --max-complexity=10 --max-line-length=200 --statistics