Skip to content

Commit 3ec3915

Browse files
authored
Merge pull request #4 from TaskarCenterAtUW/dev
Dev to Main
2 parents e58aba5 + 225cf92 commit 3ec3915

22 files changed

+3721
-35
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Check and Publish to PyPi
2+
on:
3+
push:
4+
tags:
5+
- '*.*.*' # Eg. 0.0.1
6+
workflow_dispatch:
7+
8+
jobs:
9+
PublishToPyPi:
10+
environment:
11+
name: Production
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout source code
15+
uses: actions/checkout@v3
16+
17+
- name: Installing python 3.10
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: '3.10'
21+
22+
- name: Installing git
23+
run: pip install gitpython
24+
25+
- name: Installing Packages
26+
run: pip install -r requirements.txt
27+
28+
- name: Generate local version
29+
run: python freeze_version.py
30+
31+
- name: Fetch local package version
32+
run: |
33+
packageLocalVersion=$(python -c 'from version import version; print(version);')
34+
echo "localVersion=$packageLocalVersion" >> $GITHUB_ENV
35+
36+
- name: Fetch remote package version
37+
run: |
38+
packageRemoteVersion=$(python -c "exec(\"import pkg_resources\\ntry: print(pkg_resources.get_distribution('osw-incline').version)\\n except pkg_resources.DistributionNotFound: print('0.0.0');\")")
39+
echo "remoteVersion=$packageRemoteVersion" >> $GITHUB_ENV
40+
41+
- name: Printing local and remote versions
42+
run: echo "Local version ${{env.localVersion}} and remote version ${{env.remoteVersion}}"
43+
44+
- name: Compare local and remote version with dpkg
45+
run: dpkg --compare-versions ${{env.localVersion}} "gt" ${{env.remoteVersion}}
46+
47+
48+
- name: Setup python wheel
49+
run: pip install wheel
50+
51+
- name: Building Package
52+
run: python setup.py bdist_wheel
53+
54+
- name: Publish package
55+
uses: pypa/gh-action-pypi-publish@release/v1
56+
with:
57+
password: ${{ secrets.PYPI_API_TOKEN }}
58+
Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,43 @@
1-
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3-
4-
name: Python package
1+
name: Publish to Test.PyPI.org
52

63
on:
74
push:
8-
branches: [ "main" ]
9-
pull_request:
10-
branches: [ "main" ]
5+
branches:
6+
- dev
117

128
jobs:
13-
build:
14-
9+
publish:
10+
environment:
11+
name: Development
12+
name: Publish distribution 📦 to Test PyPI
1513
runs-on: ubuntu-latest
16-
strategy:
17-
fail-fast: false
18-
matrix:
19-
python-version: ["3.9", "3.10", "3.11"]
20-
2114
steps:
22-
- uses: actions/checkout@v4
23-
- name: Set up Python ${{ matrix.python-version }}
24-
uses: actions/setup-python@v3
25-
with:
26-
python-version: ${{ matrix.python-version }}
27-
- name: Install dependencies
28-
run: |
29-
python -m pip install --upgrade pip
30-
python -m pip install flake8 pytest
31-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
32-
- name: Lint with flake8
33-
run: |
34-
# stop the build if there are Python syntax errors or undefined names
35-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
36-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
37-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
38-
- name: Test with pytest
39-
run: |
40-
pytest
15+
- name: Checkout source code
16+
uses: actions/checkout@v3
17+
18+
- name: Installing python
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: '3.10'
22+
23+
- name: Installing git
24+
run: pip install gitpython
25+
26+
- name: Installing Packages
27+
run: pip install -r requirements.txt
28+
29+
- name: Generating version file
30+
run: python freeze_version.py
31+
32+
- name: Setup python wheel
33+
run: pip install wheel
34+
35+
- name: Building Package
36+
run: python setup.py bdist_wheel
37+
38+
- name: Publish package
39+
uses: pypa/gh-action-pypi-publish@release/v1
40+
with:
41+
skip_existing: true
42+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
43+
repository_url: https://test.pypi.org/legacy/

.github/workflows/unit_tests.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Unit Tests
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches-ignore:
6+
- '**'
7+
pull_request:
8+
branches: [main, dev, stage]
9+
10+
jobs:
11+
UnitTest:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v2
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: '3.10'
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install -r requirements.txt
27+
28+
- name: Run tests with coverage
29+
run: |
30+
coverage run --source=src -m unittest discover -s tests/
31+
coverage xml
32+
33+
- name: Check coverage
34+
run: |
35+
coverage report --fail-under=85

0 commit comments

Comments
 (0)