Skip to content

Commit 0a2b9db

Browse files
First Commit
0 parents  commit 0a2b9db

25 files changed

+1907
-0
lines changed

.flake8

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[flake8]
2+
max-line-length = 88
3+
extend-ignore = E203,E501

.github/codeql/config.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: "StreamFlow CodeQL configuration"
2+
queries:
3+
- uses: security-and-quality
4+
paths-ignore:
5+
- tests
6+
query-filters:
7+
# Reason: this rule targets XSS, which is not a concern here
8+
- exclude:
9+
id: py/jinja2/autoescape-false
10+
# Reason: false positive on function body ellipsis (issue 11351)
11+
- exclude:
12+
id: py/ineffectual-statement

.github/dependabot.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
- package-ecosystem: "pip"
8+
directory: "/"
9+
schedule:
10+
interval: "daily"

.github/workflows/ci-tests.yaml

+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: "CI Tests"
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- master
9+
concurrency:
10+
group: build-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
12+
jobs:
13+
code-ql-check:
14+
name: "CodeQL check"
15+
runs-on: ubuntu-22.04
16+
permissions:
17+
security-events: write
18+
steps:
19+
- uses: actions/checkout@v3
20+
- uses: github/codeql-action/init@v2
21+
with:
22+
config-file: .github/codeql/config.yml
23+
languages: python
24+
- uses: github/codeql-action/analyze@v2
25+
static-checks:
26+
name: "Static checks"
27+
runs-on: ubuntu-22.04
28+
strategy:
29+
matrix:
30+
step: [ "bandit", "lint" ]
31+
env:
32+
TOXENV: ${{ matrix.step }}
33+
steps:
34+
- uses: actions/checkout@v3
35+
- uses: actions/setup-python@v4
36+
with:
37+
python-version: "3.11"
38+
cache: pip
39+
cache-dependency-path: |
40+
requirements.txt
41+
test-requirements.txt
42+
tox.ini
43+
- name: "Install Python Dependencies and plugin"
44+
run: |
45+
python -m pip install tox --user
46+
python -m pip install . --user
47+
- name: "Run static analysis via Tox"
48+
run: tox
49+
unit-tests:
50+
name: "Unit tests"
51+
strategy:
52+
matrix:
53+
on: [ "ubuntu-22.04"]
54+
python: [ "3.8", "3.9", "3.10", "3.11" ]
55+
include:
56+
- on: "macos-12"
57+
python: "3.11"
58+
runs-on: ${{ matrix.on }}
59+
env:
60+
POSTGRES_DB: streamflow
61+
POSTGRES_PASSWORD: streamflow
62+
POSTGRES_USER: streamflow
63+
POSTGRES_HOST: 127.0.0.1
64+
TOXENV: ${{ format('py{0}-unit', matrix.python) }}
65+
steps:
66+
- uses: actions/checkout@v3
67+
- uses: actions/setup-python@v4
68+
with:
69+
python-version: ${{ matrix.python }}
70+
cache: pip
71+
cache-dependency-path: |
72+
requirements.txt
73+
tox.ini
74+
- uses: actions/setup-node@v3
75+
with:
76+
node-version: "15"
77+
- name: "Install Docker (MacOs X)"
78+
uses: douglascamata/setup-docker-macos-action@v1-alpha
79+
if: ${{ startsWith(matrix.on, 'macos-') }}
80+
- uses: docker/setup-qemu-action@v2
81+
- name: "Start PostgreSQL Docker container"
82+
run: |
83+
docker run \
84+
--rm \
85+
--detach \
86+
--env POSTGRES_DB=${{ env.POSTGRES_DB }} \
87+
--env POSTGRES_PASSWORD=${{ env.POSTGRES_DB }} \
88+
--env POSTGRES_USER=${{ env.POSTGRES_DB }} \
89+
--publish 5432:5432 \
90+
postgres:15.2-alpine
91+
- name: "Install Python Dependencies and plugin"
92+
run: |
93+
python -m pip install tox --user
94+
python -m pip install . --user
95+
- name: "Run tests via Tox"
96+
run: python -m tox
97+
- name: "Upload coverage report for unit tests"
98+
uses: actions/upload-artifact@v3
99+
with:
100+
name: ${{ format('py{0}-unit-tests', matrix.python) }}
101+
path: ./coverage.xml
102+
retention-days: 1
103+
if-no-files-found: error
104+
upload-to-codecov:
105+
name: "Codecov report upload"
106+
needs: [ "unit-tests" ]
107+
runs-on: ubuntu-22.04
108+
steps:
109+
- uses: actions/checkout@v3
110+
- name: "Download artifacts"
111+
uses: actions/download-artifact@v3
112+
- name: "Upload coverage to Codecov"
113+
uses: codecov/codecov-action@v3
114+
with:
115+
fail_ci_if_error: true
116+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/release.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: "Release new version"
2+
on:
3+
workflow_run:
4+
workflows:
5+
- "CI Tests"
6+
branches:
7+
- master
8+
types:
9+
- completed
10+
jobs:
11+
github:
12+
name: "Create GitHub Release"
13+
runs-on: ubuntu-22.04
14+
permissions:
15+
contents: write
16+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: "Get version"
20+
run: echo "PLUGIN_VERSION=$(cat postgresql/version.py | grep -oP '(?<=VERSION = \")(.*)(?=\")')" >> $GITHUB_ENV
21+
- name: "Check tag existence"
22+
uses: mukunku/[email protected]
23+
id: check-tag
24+
with:
25+
tag: ${{ env.PLUGIN_VERSION }}
26+
- name: "Create Release"
27+
id: create-release
28+
uses: actions/create-release@v1
29+
if: ${{ steps.check-tag.outputs.exists == 'false' }}
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
with:
33+
tag_name: ${{ env.PLUGIN_VERSION }}
34+
release_name: ${{ env.PLUGIN_VERSION }}
35+
draft: false
36+
prerelease: false
37+
pypi:
38+
name: "Publish on PyPI"
39+
runs-on: ubuntu-22.04
40+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
41+
steps:
42+
- uses: actions/checkout@v3
43+
- uses: actions/setup-python@v4
44+
with:
45+
python-version: "3.10"
46+
- name: "Get local version"
47+
run: echo "PLUGIN_VERSION=$(cat streamflow/version.py | grep -oP '(?<=VERSION = \")(.*)(?=\")')" >> $GITHUB_ENV
48+
- name: "Get PyPI version"
49+
run: echo "PYPI_VERSION=$(pip index versions --pre streamflow | grep streamflow | sed 's/.*(\(.*\))/\1/')" >> $GITHUB_ENV
50+
- name: "Build Python packages"
51+
if: ${{ env.PLUGIN_VERSION != env.PYPI_VERSION }}
52+
run: |
53+
python -m pip install build --user
54+
python -m build --sdist --wheel --outdir dist/ .
55+
- name: "Publish package to PyPI"
56+
uses: pypa/gh-action-pypi-publish@release/v1
57+
if: ${{ env.PLUGIN_VERSION != env.PYPI_VERSION }}
58+
with:
59+
user: __token__
60+
password: ${{ secrets.PYPI_TOKEN }}

.gitignore

+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
.hypothesis/
51+
.pytest_cache/
52+
53+
# Translations
54+
*.mo
55+
*.pot
56+
57+
# Django stuff:
58+
*.log
59+
local_settings.py
60+
db.sqlite3
61+
db.sqlite3-journal
62+
63+
# Flask stuff:
64+
instance/
65+
.webassets-cache
66+
67+
# Scrapy stuff:
68+
.scrapy
69+
70+
# Sphinx documentation
71+
docs/_build/
72+
73+
# PyBuilder
74+
target/
75+
76+
# Jupyter Notebook
77+
.ipynb_checkpoints
78+
79+
# IPython
80+
profile_default/
81+
ipython_config.py
82+
83+
# pyenv
84+
.python-version
85+
86+
# pipenv
87+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
88+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
89+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
90+
# install all needed dependencies.
91+
#Pipfile.lock
92+
93+
# celery beat schedule file
94+
celerybeat-schedule
95+
96+
# SageMath parsed files
97+
*.sage.py
98+
99+
# Environments
100+
.env
101+
.venv
102+
env/
103+
venv/
104+
ENV/
105+
env.bak/
106+
venv.bak/
107+
108+
# Spyder project settings
109+
.spyderproject
110+
.spyproject
111+
112+
# Rope project settings
113+
.ropeproject
114+
115+
# mkdocs documentation
116+
/site
117+
118+
# mypy
119+
.mypy_cache/
120+
.dmypy.json
121+
dmypy.json
122+
123+
# Pyre type checker
124+
.pyre/
125+
126+
# IDE
127+
.idea
128+
129+
# Mac OS X
130+
.DS_Store
131+
132+
# StreamFlow
133+
.streamflow

0 commit comments

Comments
 (0)