Skip to content

Commit 0ee4d43

Browse files
committed
merge done
2 parents d4b093a + 1ab4cba commit 0ee4d43

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+7290
-4635
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @pbs/core-services
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Release PyCaption on GitHub
2+
3+
on:
4+
push:
5+
tags:
6+
- "[0-9]+.[0-9]+.[0-9]+"
7+
8+
jobs:
9+
call-unit-tests-workflow:
10+
name: Run unit tests
11+
uses: pbs/pycaption/.github/workflows/unit_tests.yml@main
12+
secrets:
13+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
14+
SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID }}
15+
16+
create-release:
17+
name: Release PyCaption on GitHub
18+
needs: call-unit-tests-workflow
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v2
22+
23+
- name: Extract release notes for current version
24+
env:
25+
TAG: ${{ github.ref }}
26+
run: |
27+
sudo apt-get install -y --no-install-recommends pandoc
28+
pandoc docs/changelog.rst -f rst -t gfm -o changelog.md
29+
sed -n "/## ${TAG#refs/tags/}/,/## /p" changelog.md | sed -e "/## /d" >> notes.md
30+
31+
- name: Create release on GitHub
32+
run: gh release create ${{ github.ref }} --notes-file notes.md
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Publish PyCaption to PyPI
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
call-unit-tests-workflow:
7+
name: Run unit tests
8+
uses: pbs/pycaption/.github/workflows/unit_tests.yml@main
9+
secrets:
10+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
11+
SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID }}
12+
13+
build-n-publish:
14+
name: Build and publish PyCaption to PyPI
15+
needs: call-unit-tests-workflow
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v2
22+
with:
23+
python-version: 3.9
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install build
29+
python -m pip install --upgrade twine
30+
31+
- name: Build package
32+
run: python -m build
33+
timeout-minutes: 10
34+
35+
- name: Publish package on PyPI
36+
run: python -m twine upload --verbose dist/*
37+
env:
38+
TWINE_USERNAME: __token__
39+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Publish PyCaption to Test PyPI
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
call-unit-tests-workflow:
7+
name: Run unit tests
8+
uses: ./.github/workflows/unit_tests.yml
9+
secrets:
10+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
11+
SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID }}
12+
13+
build-n-publish:
14+
name: Build and publish PyCaption to Test PyPI
15+
needs: call-unit-tests-workflow
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v2
22+
with:
23+
python-version: 3.9
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install build
29+
python -m pip install --upgrade twine
30+
31+
- name: Build package
32+
run: python -m build
33+
timeout-minutes: 10
34+
35+
- name: Publish package on Test PyPI
36+
run: python -m twine upload --verbose dist/*
37+
env:
38+
TWINE_USERNAME: __token__
39+
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
40+
TWINE_REPOSITORY: "testpypi"

.github/workflows/unit_tests.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Unit Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_call:
9+
secrets:
10+
SLACK_BOT_TOKEN:
11+
required: true
12+
SLACK_CHANNEL_ID:
13+
required: true
14+
workflow_dispatch:
15+
16+
jobs:
17+
build:
18+
19+
runs-on: ubuntu-latest
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
python-version: ["py38", "py39", "py310", "py311", "py312"]
24+
25+
steps:
26+
- uses: actions/checkout@v2
27+
28+
- name: Run Test
29+
id: tests
30+
run: |
31+
./run_tests.sh test_${{ matrix.python-version }}
32+
continue-on-error: true
33+
34+
- name: Archive production artifacts
35+
uses: actions/upload-artifact@v3
36+
with:
37+
name: test-report-${{ matrix.python-version }}
38+
path: junit.xml
39+
40+
- name: Archive code coverage results
41+
uses: actions/upload-artifact@v3
42+
with:
43+
name: code-coverage-report-${{ matrix.python-version }}
44+
path: coverage.xml
45+
46+
- name: Add context info to env
47+
run: |
48+
sudo apt-get install -y --no-install-recommends libxml-xpath-perl
49+
COVERAGE=`xpath -q -e "floor(/coverage/@line-rate * 100)" coverage.xml`
50+
FAILED_AMOUNT=`xpath -q -e "number(/testsuites/testsuite/@failures)" junit.xml`
51+
SKIPPED_AMOUNT=`xpath -q -e "number(/testsuites/testsuite/@skipped)" junit.xml`
52+
PASSED_AMOUNT=`xpath -q -e "/testsuites/testsuite/@tests - $SKIPPED_AMOUNT - $FAILED_AMOUNT" junit.xml`
53+
echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV
54+
echo "FAILED_AMOUNT=$FAILED_AMOUNT" >> $GITHUB_ENV
55+
echo "PASSED_AMOUNT=$PASSED_AMOUNT" >> $GITHUB_ENV
56+
${{ contains(github.ref, 'tags/') }} \
57+
&& BRANCH='refs/heads/main' \
58+
|| BRANCH=${{ github.head_ref || github.ref }}
59+
echo "BRANCH=${BRANCH#refs/*/}" >> $GITHUB_ENV
60+
61+
- name: Notify if test FAILED
62+
uses: archive/[email protected]
63+
with:
64+
slack-bot-user-oauth-access-token: ${{ secrets.SLACK_BOT_TOKEN }}
65+
slack-channel: ${{ secrets.SLACK_CHANNEL_ID }}
66+
slack-text: ":boom: *${{ env.FAILED_AMOUNT }}* Pycaption test(s) failed for Python *${{ matrix.python-version }}* on the *${{ env.BRANCH }}* branch (triggered by *${{ github.actor }}*)"
67+
if: steps.tests.outcome == 'failure' && !github.event.pull_request.head.repo.fork
68+
69+
- name: Mark test failure
70+
run: exit 1
71+
if: steps.tests.outcome == 'failure'
72+
73+
- name: Slack notify tests PASSED
74+
uses: archive/[email protected]
75+
with:
76+
slack-bot-user-oauth-access-token: ${{ secrets.SLACK_BOT_TOKEN }}
77+
slack-channel: ${{ secrets.SLACK_CHANNEL_ID }}
78+
slack-text: ":rocket: All (*${{ env.PASSED_AMOUNT }}*) Pycaption tests passed for Python *${{ matrix.python-version }}* covering *${{ env.COVERAGE }}%* of code on the *${{ env.BRANCH }}* branch (triggered by *${{ github.actor }}*)"
79+
if: steps.tests.outcome == 'success' && !github.event.pull_request.head.repo.fork

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pip-log.txt
2121
# Unit test / coverage reports
2222
.coverage
2323
.tox
24+
coverage.xml
2425

2526
#Translations
2627
*.mo
@@ -30,3 +31,13 @@ pip-log.txt
3031

3132
# Sphinx documentation build
3233
docs/_build
34+
35+
# PyCharm files
36+
.idea/
37+
38+
# Environments
39+
env/
40+
venv/
41+
42+
# Pyenv files
43+
.python-version

.pre-commit-config.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
repos:
2+
- repo: git://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.0.1
4+
hooks:
5+
- id: end-of-file-fixer
6+
- id: trailing-whitespace
7+
- id: debug-statements
8+
9+
- repo: git://github.com/PyCQA/flake8
10+
rev: 3.9.2
11+
hooks:
12+
- id: flake8
13+
args: [
14+
'--exclude=tests/fixtures*',
15+
'--ignore=W503,C901',
16+
'--max-line-length=80',
17+
]

.readthedocs.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: 2
2+
3+
build:
4+
os: "ubuntu-22.04"
5+
tools:
6+
python: "3.11"
7+
8+
# Build from the docs/ directory with Sphinx
9+
sphinx:
10+
configuration: docs/conf.py
11+
12+
# Explicitly set the version of Python and its requirements
13+
python:
14+
install:
15+
- requirements: docs/requirements.txt

.travis.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)