Skip to content

Commit 4381b39

Browse files
--
1 parent 4aee935 commit 4381b39

23 files changed

Lines changed: 4057 additions & 2 deletions
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
3+
name: Prepare Python and Poetry
4+
Description: Install Python, Poetry and dev dependencies, cached for speed
5+
6+
inputs:
7+
python-version:
8+
description: 'Python version to use'
9+
required: true
10+
default: '3.x'
11+
12+
runs:
13+
using: "composite"
14+
steps:
15+
- name: Set up Python
16+
id: setup-python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: ${{ inputs.python-version }}
20+
21+
- name: Load cached Poetry installation
22+
uses: actions/cache@v3
23+
with:
24+
path: ~/.local # the path depends on the OS
25+
key: poetry-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-0 # increment to reset cache
26+
27+
- name: Install Poetry
28+
uses: snok/install-poetry@v1
29+
with:
30+
version: 1.1.13
31+
virtualenvs-create: true
32+
virtualenvs-in-project: true
33+
34+
- name: Install Poetry Plugins
35+
run: |
36+
python -m pip install --upgrade pip
37+
pip install poetry-dynamic-versioning
38+
shell: bash
39+
40+
- name: Load cached venv
41+
id: cached-poetry-dependencies
42+
uses: actions/cache@v3
43+
with:
44+
path: .venv
45+
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-1
46+
47+
- name: Install dependencies and library
48+
# if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
49+
run: poetry install --no-interaction
50+
shell: bash
51+

.github/codecov.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
# Configuration for CodeCov
3+
# See https://docs.codecov.io/docs/codecov-yaml
4+
5+
codecov:
6+
require_ci_to_pass: yes
7+
8+
coverage:
9+
# Colour chart range
10+
# In future, aim to update range to stricter standard
11+
range: "20...80"
12+
13+
comment:
14+
# Only post a comment if coverage changes
15+
require_changes: true
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
---
2+
3+
on: [push,pull_request]
4+
5+
jobs:
6+
build:
7+
name: Build distribution
8+
runs-on: ubuntu-latest
9+
steps:
10+
11+
- name: Checkout code
12+
uses: actions/checkout@v3
13+
with:
14+
fetch-depth: 0
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: '3.9'
20+
21+
- name: Install Poetry
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install poetry
25+
pip install poetry-dynamic-versioning
26+
27+
- name: Build
28+
run: |
29+
poetry build
30+
31+
- name: Save build artifacts
32+
uses: actions/upload-artifact@v2
33+
with:
34+
name: dist-artifact
35+
path: dist/
36+
37+
test:
38+
name: Test
39+
needs: build
40+
runs-on: ubuntu-latest
41+
steps:
42+
43+
- name: Set up Python
44+
uses: actions/setup-python@v2
45+
with:
46+
python-version: '3.9'
47+
48+
- name: Checkout code
49+
uses: actions/checkout@v3
50+
with:
51+
fetch-depth: 0
52+
53+
- name: Get build artifacts
54+
uses: actions/download-artifact@v2
55+
with:
56+
name: dist-artifact
57+
path: dist/
58+
59+
- name: Install from build
60+
run: |
61+
python -m pip install --upgrade pip
62+
pip install pytest-mock
63+
pip install etpproto --pre --target=dist --find-links=dist/
64+
65+
- name: Copy tests and example data to dist folder for testing against artifacts
66+
run: |
67+
cp -R tests dist/
68+
# cp -R example_data dist/
69+
70+
- name: Run tests
71+
run: pytest dist/tests
72+
73+
publish:
74+
name: Publish to PyPI
75+
needs: [build, test]
76+
runs-on: ubuntu-latest
77+
steps:
78+
79+
- name: Set up Python
80+
uses: actions/setup-python@v2
81+
with:
82+
python-version: '3.9'
83+
84+
# Retrieve the code and GIT history so that poetry-dynamic-versioning knows which version to upload
85+
- name: Checkout code
86+
uses: actions/checkout@v3
87+
with:
88+
fetch-depth: 0
89+
90+
- name: Get build artifacts
91+
uses: actions/download-artifact@v2
92+
with:
93+
name: dist-artifact
94+
path: dist/
95+
96+
- name: Install Poetry
97+
run: |
98+
python -m pip install --upgrade pip
99+
pip install poetry
100+
pip install poetry-dynamic-versioning
101+
102+
- name: Upload to PyPI TEST
103+
run: |
104+
poetry config repositories.test https://test.pypi.org/legacy/
105+
poetry config http-basic.test ${{ secrets.POETRY_PYPI_TOKEN_USERNAME}} ${{ secrets.POETRY_TEST_PYPI_TOKEN_PASSWORD}}
106+
poetry publish --repository test

.github/workflows/ci-publish.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
---
2+
3+
name: Publish release
4+
5+
on:
6+
push:
7+
tags:
8+
# Run when a tag is pushed with a valid semantic version number
9+
- 'v[0-9]+.[0-9]+.[0-9]+'
10+
11+
jobs:
12+
build:
13+
name: Build distribution
14+
runs-on: ubuntu-latest
15+
steps:
16+
17+
- name: Checkout code
18+
uses: actions/checkout@v3
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v2
24+
with:
25+
python-version: '3.9'
26+
27+
- name: Install Poetry
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install poetry
31+
pip install poetry-dynamic-versioning
32+
33+
- name: Build
34+
run: |
35+
poetry build
36+
37+
- name: Save build artifacts
38+
uses: actions/upload-artifact@v2
39+
with:
40+
name: dist-artifact
41+
path: dist/
42+
43+
test:
44+
name: Test
45+
needs: build
46+
runs-on: ubuntu-latest
47+
steps:
48+
49+
- name: Set up Python
50+
uses: actions/setup-python@v2
51+
with:
52+
python-version: '3.9'
53+
54+
- name: Checkout code
55+
uses: actions/checkout@v3
56+
with:
57+
fetch-depth: 0
58+
59+
- name: Get build artifacts
60+
uses: actions/download-artifact@v2
61+
with:
62+
name: dist-artifact
63+
path: dist/
64+
65+
- name: Install from build
66+
run: |
67+
python -m pip install --upgrade pip
68+
pip install pytest-mock
69+
pip install etpproto --pre --target=dist --find-links=dist/
70+
71+
- name: Copy tests and example data to dist folder for testing against artifacts
72+
run: |
73+
cp -R tests dist/
74+
# cp -R example_data dist/
75+
76+
- name: Run tests
77+
run: pytest dist/tests
78+
79+
publish:
80+
name: Publish to PyPI
81+
needs: [build, test]
82+
runs-on: ubuntu-latest
83+
steps:
84+
85+
- name: Set up Python
86+
uses: actions/setup-python@v2
87+
with:
88+
python-version: '3.9'
89+
90+
# Retrieve the code and GIT history so that poetry-dynamic-versioning knows which version to upload
91+
- name: Checkout code
92+
uses: actions/checkout@v3
93+
with:
94+
fetch-depth: 0
95+
96+
- name: Get build artifacts
97+
uses: actions/download-artifact@v2
98+
with:
99+
name: dist-artifact
100+
path: dist/
101+
102+
- name: Install Poetry
103+
run: |
104+
python -m pip install --upgrade pip
105+
pip install poetry
106+
pip install poetry-dynamic-versioning
107+
108+
- name: Upload to PyPI
109+
run: |
110+
poetry config repositories.test https://test.pypi.org/legacy/
111+
poetry publish --username ${{ secrets.POETRY_PYPI_TOKEN_USERNAME}} --password ${{ secrets.POETRY_PYPI_TOKEN_PASSWORD}}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
3+
name: CodeQL
4+
5+
on:
6+
push:
7+
branches: [ master ]
8+
# pull_request:
9+
# The branches below must be a subset of the branches above
10+
# branches: [ master ]
11+
schedule:
12+
# 10:16 on Fridays
13+
- cron: '16 10 * * 5'
14+
15+
jobs:
16+
analyze:
17+
name: Analyze
18+
runs-on: ubuntu-latest
19+
permissions:
20+
actions: read
21+
contents: read
22+
security-events: write
23+
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
language: [ 'python' ]
28+
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v3
32+
33+
# Initializes the CodeQL tools for scanning.
34+
- name: Initialize CodeQL
35+
uses: github/codeql-action/init@v1
36+
with:
37+
languages: ${{ matrix.language }}
38+
# If you wish to specify custom queries, you can do so here or in a config file.
39+
# By default, queries listed here will override any specified in a config file.
40+
# Prefix the list here with "+" to use these queries and those in the config file.
41+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
42+
43+
- name: Perform CodeQL Analysis
44+
uses: github/codeql-action/analyze@v1

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
__pycache__
2+
.python-version
3+
.tox
4+
*.egg-info
5+
.cache
6+
.coverage
7+
coverage.xml
8+
*.pyc
9+
*.pyo
10+
.pytest_cache
11+
.mypy_cache
12+
*~
13+
docs/build
14+
build
15+
dist
16+
.venv
17+
.vscode
18+
*.sublime-project
19+
*.sublime-workspace
20+
venv/
21+
manip
22+
test-data/
23+
manip.txt
24+

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright [yyyy] [name of copyright owner]
189+
Copyright 2020 GEOSIRIS
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
# etpclient-python
1+
# etpclient
2+
3+
poetry run python .\src\etpclient\main.py --host rddms.centralus.cloudapp.azure.com --port 80 --sub-path etp -t https://rddms.centralus.cloudapp.azure.com/rest/Reservoir/v1/auth/token
4+
5+
poetry run python .\src\etpclient\main.py --host 127.0.0.1 --port 17000 --sub-path etp --username admin --password openSesame
6+
7+
poetry run python .\src\etpclient\main.py --host 127.0.0.1 --port 5432 --username tester --password tester

etpclient/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#https://florimond.dev/blog/articles/2020/05/structuring-starlette-projects/

etpclient/etp/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)