Skip to content

Commit b1f377e

Browse files
Ci (#1)
merge
1 parent aadc61b commit b1f377e

7 files changed

Lines changed: 297 additions & 7 deletions

File tree

.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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ docs/html
2626
build
2727
dist
2828
*.egg-info
29+
venv/
2930

3031
# Dynamically-generated version
3132
resqpy/version.py

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ETP Protocol Implementation
22
==========
33

4-
[![License](https://img.shields.io/pypi/l/etpproto-python)](https://github.com/geosiris-technologies/etpproto-python/blob/main/LICENSE)
4+
[![License](https://img.shields.io/pypi/l/etpproto)](https://github.com/geosiris-technologies/etpproto-python/blob/main/LICENSE)
55
[![Documentation Status](https://readthedocs.org/projects/etpproto-python/badge/?version=latest)](https://etpproto-python.readthedocs.io/en/latest/?badge=latest)
66
[![Python CI](https://github.com/geosiris-technologies/etpproto-python/actions/workflows/ci-tests.yml/badge.svg)](https://github.com/geosiris-technologies/etpproto-python/actions/workflows/ci-tests.yml)
77
![Python version](https://img.shields.io/pypi/pyversions/etpproto-python)
88
[![PyPI](https://img.shields.io/pypi/v/etpproto-python)](https://badge.fury.io/py/etpproto-python)
99
![Status](https://img.shields.io/pypi/status/etpproto-python)
10-
[![codecov](https://codecov.io/gh/bp/etpproto-python/branch/master/graph/badge.svg)](https://codecov.io/gh/bp/etpproto-python)
10+
[![codecov](https://codecov.io/gh/geosiris-technologies/etpproto-python/branch/main/graph/badge.svg)](https://codecov.io/gh/geosiris-technologies/etpproto-python)
1111

1212

1313

pyproject.toml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["poetry>=1.0.2", "poetry-dynamic-versioning"]
2+
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"]
33
build-backend = "poetry.masonry.api"
44

55
[tool.poetry]
@@ -16,11 +16,10 @@ maintainers = [
1616
license = "Apache-2.0"
1717
readme = "README.md"
1818
repository = "https://github.com/bp/resqpy"
19-
homepage = "www.geosiris.com"
19+
homepage = "http://www.geosiris.com"
2020
classifiers = [
21-
"License :: OSI Approved :: Apache Software License",
2221
"Programming Language :: Python :: 3.9",
23-
"License :: OSI Approved :: Apache Software License"
22+
"License :: OSI Approved :: Apache Software License",
2423
]
2524
keywords = ["ETP"]
2625

@@ -63,7 +62,7 @@ exclude = '''
6362
'''
6463

6564
[tool.pytest.ini_options]
66-
addopts = "-v --cache-clear -rf --cov=etpproto/ --cov-report=term --cov-report=html --junitxml=pytest.xml"
65+
addopts = ""
6766
console_output_style = "count"
6867
python_classes = "Test"
6968
python_files = "test_*.py"
@@ -77,3 +76,17 @@ source = ["etpproto"]
7776

7877
[tool.pylint.format]
7978
max-line-length = "88"
79+
80+
[tool.poetry-dynamic-versioning]
81+
enable = true
82+
vcs = "git"
83+
style = "pep440"
84+
format-jinja = """
85+
{%- if distance == 0 -%}
86+
{{ serialize_pep440(base, stage, revision) }}
87+
{%- elif revision is not none -%}
88+
{{ serialize_pep440(base, stage, revision + 1, dev=distance) }}
89+
{%- else -%}
90+
{{ serialize_pep440(bump_version(base), stage, revision, dev=distance) }}
91+
{%- endif -%}
92+
"""

0 commit comments

Comments
 (0)