Skip to content

Commit b3d0adc

Browse files
PLAT-10187: Implemented automated publication using GitHub actions (#125)
1 parent 9df6e03 commit b3d0adc

File tree

7 files changed

+128
-85
lines changed

7 files changed

+128
-85
lines changed

.circleci/config.yml

-73
This file was deleted.

.github/workflows/build.yml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches: [ "2.0" ]
6+
pull_request:
7+
branches: [ "2.0" ]
8+
9+
jobs:
10+
build:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [ ubuntu-latest, macos-latest, windows-latest ]
15+
include:
16+
- os: ubuntu-latest
17+
path: ~/.cache/pypoetry/virtualenvs
18+
- os: macos-latest
19+
path: ~/Library/Caches/pypoetry/virtualenvs
20+
- os: windows-latest
21+
path: ~\AppData\Local\pypoetry\Cache\virtualenvs
22+
23+
steps:
24+
- uses: actions/checkout@v2
25+
26+
- name: Set up Python 3.8
27+
uses: actions/setup-python@v2
28+
with:
29+
python-version: 3.8
30+
31+
- name: Install Poetry
32+
run: pip install poetry
33+
34+
- name: Cache poetry
35+
uses: actions/cache@v2
36+
with:
37+
path: ${{ matrix.path }}
38+
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
39+
restore-keys: |
40+
${{ runner.os }}-poetry-
41+
42+
- name: Install dependencies
43+
run: poetry install
44+
45+
- name: Run tests with coverage
46+
run: poetry run pytest
47+
48+
- name: Run pylint
49+
run: poetry run pylint symphony tests
50+
51+
- name: Upload test results
52+
uses: actions/upload-artifact@v2
53+
with:
54+
name: pytest-results-${{ matrix.os }}
55+
path: test-results/junit.xml
56+
if: ${{ always() }}
57+
58+
- name: Upload test coverage
59+
uses: actions/upload-artifact@v2
60+
with:
61+
name: pytest-coverage-${{ matrix.os }}
62+
path: htmlcov
63+
if: ${{ always() }}

.github/workflows/release.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
name: "Release"
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
16+
- name: Set up Python 3.8
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: 3.8
20+
21+
- name: Install Poetry
22+
run: pip install poetry
23+
24+
- name: Install dependencies
25+
run: poetry install
26+
27+
- name: Run tests with coverage
28+
run: poetry run pytest
29+
30+
- name: publish
31+
env:
32+
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
33+
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
34+
run: poetry publish --build --username "$PYPI_USERNAME" --password "$PYPI_PASSWORD"

.github/workflows/snyk.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Snyk scan
2+
3+
on:
4+
push:
5+
branches: [ "2.0" ]
6+
7+
jobs:
8+
security:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@master
12+
- name: Run Snyk to check for vulnerabilities
13+
uses: snyk/actions/python@master
14+
env:
15+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
16+
with:
17+
args: --severity-threshold=high

poetry.lock

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "sym_api_client_python"
33
version = "2.0.dev0"
44
description = "Symphony Bot Development Kit for Python"
5+
readme = "README.md"
56
authors = ["Symphony Platform Solutions <platformsolutions@symphony.com>"]
67
packages = [
78
{ include = "symphony" }

tests/core/config/test_bdk_config_loader.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from symphony.bdk.core.config.model.bdk_server_config import BdkProxyConfig
1+
import re
2+
23
from tests.utils.resource_utils import get_config_resource_filepath
34
from symphony.bdk.core.config.loader import BdkConfigLoader
45
from symphony.bdk.core.config.exception import BdkConfigError
@@ -38,12 +39,12 @@ def test_load_from_content(simple_config_path):
3839

3940
def test_load_from_file_not_found(wrong_path):
4041
fail_error_message = f"Config file has not been found at: {Path(wrong_path).absolute()}"
41-
with pytest.raises(BdkConfigError, match=fail_error_message):
42-
config = BdkConfigLoader.load_from_file(wrong_path)
42+
with pytest.raises(BdkConfigError, match=re.escape(fail_error_message)):
43+
BdkConfigLoader.load_from_file(wrong_path)
4344

4445

45-
@pytest.mark.skipif(os.environ.get("CIRCLECI") == "true",
46-
reason="CircleCI does not allow to create file in the home directory")
46+
@pytest.mark.skipif(os.environ.get("CI") == "true",
47+
reason="GitHub actions does not allow to create file in the home directory")
4748
def test_load_from_symphony_directory(simple_config_path):
4849
tmp_config_filename = str(uuid.uuid4()) + "-config.yaml"
4950
tmp_config_path = Path.home() / ".symphony" / tmp_config_filename

0 commit comments

Comments
 (0)