Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,22 @@ jobs:

lint-checks:
needs: pre_job
name: Make requirements and lint check on Python3.6
runs-on: ubuntu-18.04
name: Make requirements and lint checks
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout st2tests repository
uses: actions/checkout@v2
- name: Checkout st2 repository
uses: actions/checkout@v2
with:
repository: "StackStorm/st2"
- name: Set up Python3.6
uses: actions/setup-python@v2
- name: "Set up Python ${{ matrix.python-version }}"
uses: actions/setup-python@v4
with:
python-version: '3.6.13'
python-version: "${{ matrix.python-version }}"
- name: Install apt dependencies
run: |
sudo apt install -y libldap2-dev libsasl2-dev
Expand Down
28 changes: 21 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ space_char +=
comma := ,
COMPONENT_PYTHONPATH = $(subst $(space_char),:,$(realpath $(COMPONENTS)))

PYTHON_TARGET := 3.6

REQUIREMENTS := test-requirements.txt requirements.txt
# Extract the Python major/minor version to target the correct test requirements file.
PYTHON_VERSION := $(shell python3 --version | sed -r 's/.*([[0-9]+\.[0-9]+)\.[0-9]+.*/\1/g')
REQUIREMENTS := test-requirements-$(PYTHON_VERSION).txt requirements.txt
# Grab the version of pip from the Makefile in the st2 repository
#
# 1. Grab the st2 branch name from ST2_BRANCH
Expand Down Expand Up @@ -73,7 +73,7 @@ pylint: requirements .pylint
. $(VIRTUALENV_DIR)/bin/activate; pylint -E --rcfile=./lint-configs/python/.pylintrc packs/fixtures/actions/scripts/*/*.py || exit 1;
. $(VIRTUALENV_DIR)/bin/activate; pylint -E --rcfile=./lint-configs/python/.pylintrc packs/fixtures/sensors/*.py || exit 1;
. $(VIRTUALENV_DIR)/bin/activate; pylint -E --rcfile=./lint-configs/python/.pylintrc packs/asserts/actions/*.py || exit 1;

.PHONY: flake8
flake8: requirements .flake8

Expand Down Expand Up @@ -107,8 +107,8 @@ requirements: virtualenv

# Install requirements
for req in $(REQUIREMENTS); do \
echo "Installing $$req..." ; \
$(VIRTUALENV_DIR)/bin/pip install $(PIP_OPTIONS) -r $$req ; \
echo "Installing $$req..." ; \
$(VIRTUALENV_DIR)/bin/pip install $(PIP_OPTIONS) -r $$req ; \
done

.PHONY: virtualenv
Expand All @@ -117,7 +117,7 @@ $(VIRTUALENV_DIR)/bin/activate:
@echo
@echo "==================== virtualenv ===================="
@echo
test -d $(VIRTUALENV_DIR) || virtualenv $(VIRTUALENV_DIR)
test -d $(VIRTUALENV_DIR) || python3 -m venv $(VIRTUALENV_DIR)

# Setup PYTHONPATH in bash activate script...
echo '' >> $(VIRTUALENV_DIR)/bin/activate
Expand All @@ -140,3 +140,17 @@ $(VIRTUALENV_DIR)/bin/activate:
echo ' functions -e old_deactivate' >> $(VIRTUALENV_DIR)/bin/activate.fish
echo 'end' >> $(VIRTUALENV_DIR)/bin/activate.fish
touch $(VIRTUALENV_DIR)/bin/activate.fish

.PHONY: piptools
piptools: virtualenv
@echo
@echo "================== Install pip-tools ===================="
@echo
"$(VIRTUALENV_DIR)/bin/pip" install pip-tools

.PHONY: generate_requirements
generate_requirements: piptools
@echo
@echo "================== Generate requirements file ===================="
@echo
"$(VIRTUALENV_DIR)/bin/pip-compile" --output-file=$(ROOT_DIR)/test-requirements-$(PYTHON_VERSION).txt $(ROOT_DIR)/test-requirements.in
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,9 @@ For example:
git subtree pull --prefix test_helpers/bats-assert https://github.com/ztombol/bats-assert.git master --squash
git subtree pull --prefix test_helpers/bats-support https://github.com/ztombol/bats-support.git master --squash
```

## Supported Python versions

StackStorm supports mulitple versions of python across numerous GNU/Linux distributions. To define python dependencies in a
reproducible fashion, the `pip-compile` tool is used to resolve dependencies from the `requirements.in` file. The requirements
are kept up to date with the `st2` repository and should be regenerated when requirements are updated.
82 changes: 82 additions & 0 deletions test-requirements-3.10.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --output-file=/root/workspace/st2tests/test-requirements-3.10.txt /root/workspace/st2tests/test-requirements.in
#
aiohappyeyeballs==2.6.1
# via aiohttp
aiohttp==3.12.15
# via slackclient
aiosignal==1.4.0
# via aiohttp
astroid==3.1.0
# via pylint
async-timeout==5.0.1
# via aiohttp
attrs==25.3.0
# via
# aiohttp
# pytest
dill==0.4.0
# via pylint
flake8==7.0.0
# via -r /root/workspace/st2tests/test-requirements.in
frozenlist==1.7.0
# via
# aiohttp
# aiosignal
idna==3.10
# via yarl
iniconfig==2.1.0
# via pytest
isort==5.13.2
# via pylint
mccabe==0.7.0
# via
# flake8
# pylint
multidict==6.6.4
# via
# aiohttp
# yarl
packaging==25.0
# via pytest
platformdirs==4.3.8
# via pylint
pluggy==1.6.0
# via pytest
propcache==0.3.2
# via
# aiohttp
# yarl
py==1.11.0
# via pytest
pycodestyle==2.11.1
# via flake8
pyflakes==3.2.0
# via flake8
pylint==3.1.1
# via -r /root/workspace/st2tests/test-requirements.in
pytest==7.0.1
# via -r /root/workspace/st2tests/test-requirements.in
slackclient==2.9.4
# via -r /root/workspace/st2tests/test-requirements.in
tomli==2.2.1
# via
# pylint
# pytest
tomlkit==0.13.3
# via pylint
typing-extensions==4.14.1
# via
# aiosignal
# astroid
# multidict
wheel==0.45.1
# via -r /root/workspace/st2tests/test-requirements.in
yarl==1.20.1
# via aiohttp

# The following packages are considered to be unsafe in a requirements file:
# setuptools
75 changes: 75 additions & 0 deletions test-requirements-3.11.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --output-file=/root/workspace/st2tests/test-requirements-3.11.txt /root/workspace/st2tests/test-requirements.in
#
aiohappyeyeballs==2.6.1
# via aiohttp
aiohttp==3.12.15
# via slackclient
aiosignal==1.4.0
# via aiohttp
astroid==3.1.0
# via pylint
attrs==25.3.0
# via
# aiohttp
# pytest
dill==0.4.0
# via pylint
flake8==7.0.0
# via -r /root/workspace/st2tests/test-requirements.in
frozenlist==1.7.0
# via
# aiohttp
# aiosignal
idna==3.10
# via yarl
iniconfig==2.1.0
# via pytest
isort==5.13.2
# via pylint
mccabe==0.7.0
# via
# flake8
# pylint
multidict==6.6.4
# via
# aiohttp
# yarl
packaging==25.0
# via pytest
platformdirs==4.3.8
# via pylint
pluggy==1.6.0
# via pytest
propcache==0.3.2
# via
# aiohttp
# yarl
py==1.11.0
# via pytest
pycodestyle==2.11.1
# via flake8
pyflakes==3.2.0
# via flake8
pylint==3.1.1
# via -r /root/workspace/st2tests/test-requirements.in
pytest==7.0.1
# via -r /root/workspace/st2tests/test-requirements.in
slackclient==2.9.4
# via -r /root/workspace/st2tests/test-requirements.in
tomli==2.2.1
# via pytest
tomlkit==0.13.3
# via pylint
typing-extensions==4.14.1
# via aiosignal
wheel==0.45.1
# via -r /root/workspace/st2tests/test-requirements.in
yarl==1.20.1
# via aiohttp

# The following packages are considered to be unsafe in a requirements file:
# setuptools
80 changes: 80 additions & 0 deletions test-requirements-3.8.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile --output-file=/root/workspace/st2tests/test-requirements-3.8.txt /root/workspace/st2tests/test-requirements.in
#
aiohappyeyeballs==2.4.4
# via aiohttp
aiohttp==3.10.11
# via slackclient
aiosignal==1.3.1
# via aiohttp
astroid==3.1.0
# via pylint
async-timeout==5.0.1
# via aiohttp
attrs==25.3.0
# via
# aiohttp
# pytest
dill==0.4.0
# via pylint
flake8==7.0.0
# via -r /root/workspace/st2tests/test-requirements.in
frozenlist==1.5.0
# via
# aiohttp
# aiosignal
idna==3.10
# via yarl
iniconfig==2.1.0
# via pytest
isort==5.13.2
# via pylint
mccabe==0.7.0
# via
# flake8
# pylint
multidict==6.1.0
# via
# aiohttp
# yarl
packaging==25.0
# via pytest
platformdirs==4.3.6
# via pylint
pluggy==1.5.0
# via pytest
propcache==0.2.0
# via yarl
py==1.11.0
# via pytest
pycodestyle==2.11.1
# via flake8
pyflakes==3.2.0
# via flake8
pylint==3.1.1
# via -r /root/workspace/st2tests/test-requirements.in
pytest==7.0.1
# via -r /root/workspace/st2tests/test-requirements.in
slackclient==2.9.4
# via -r /root/workspace/st2tests/test-requirements.in
tomli==2.2.1
# via
# pylint
# pytest
tomlkit==0.13.3
# via pylint
typing-extensions==4.13.2
# via
# astroid
# multidict
# pylint
wheel==0.45.1
# via -r /root/workspace/st2tests/test-requirements.in
yarl==1.15.2
# via aiohttp

# The following packages are considered to be unsafe in a requirements file:
# setuptools
Loading
Loading