Skip to content

Commit c05c92a

Browse files
committed
Add github workflows and example test.
1 parent bb1c986 commit c05c92a

File tree

8 files changed

+123
-0
lines changed

8 files changed

+123
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# This workflow will install Python dependencies, run tests and lint with a single version of Python
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Linux
5+
6+
on:
7+
push:
8+
paths-ignore:
9+
- '**.md'
10+
- '**.rst'
11+
12+
jobs:
13+
build:
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
os: [ubuntu-latest]
18+
python-version: ["3.8","3.9","3.10","3.11"]
19+
steps:
20+
- uses: actions/checkout@v3
21+
22+
- name: Set up Python 3
23+
uses: actions/setup-python@v3
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Install dependencies with pip
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install .
31+
- name: Test with pytest
32+
run: |
33+
pytest -v tests/ --html=test-results.html --self-contained-html --cov=xradio --no-cov-on-fail --cov-report=html --doctest-modules
34+
35+
- name: Upload pytest test results and coverage reports
36+
uses: actions/upload-artifact@v3
37+
with:
38+
name: pytest-results-${{ matrix.python-version }}
39+
path: |
40+
./test-results.html
41+
./htmlcov
42+
# Use always() to always run this step to publish test results when there are test failures
43+
if: ${{ always() }}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: MacOS
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- '**.md'
9+
- '**.rst'
10+
11+
jobs:
12+
build:
13+
name: macos (${{ matrix.python-version }}, ${{ matrix.os }})
14+
runs-on: ${{ matrix.os }}
15+
defaults:
16+
run:
17+
shell: bash -l {0}
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
os: ["macos-latest"]
22+
python-version: ["3.8", "3.9", "3.10","3.11"]
23+
steps:
24+
- name: Setup Conda
25+
uses: conda-incubator/setup-miniconda@v2
26+
with:
27+
auto-activate-base: false
28+
activate-environment: xradiotest
29+
auto-update-conda: true
30+
python-version: ${{ matrix.python-version }}
31+
channels: conda-forge
32+
33+
- run: conda install python-casacore
34+
35+
- uses: actions/checkout@v3
36+
37+
- name: Install dependencies with pip
38+
run: |
39+
python -m pip install --upgrade pip
40+
python -m pip install .
41+
42+
- name: Test with pytest
43+
run: pytest

.github/workflows/pythonpublish.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# This workflows will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
# https://www.caktusgroup.com/blog/2021/02/11/automating-pypi-releases/
4+
5+
name: Published
6+
7+
on:
8+
release:
9+
types: [created]
10+
11+
jobs:
12+
deploy:
13+
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: Set up Python
19+
uses: actions/setup-python@v3
20+
with:
21+
python-version: '3.11'
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install setuptools wheel twine build
26+
- name: Build and publish
27+
env:
28+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
29+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
30+
run: |
31+
python -m build
32+
twine upload dist/*

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.DS_Store
2+
13
# Byte-compiled / optimized / DLL files
24
__pycache__/
35
*.py[cod]

tests/__init__.py

Whitespace-only changes.

tests/stakeholder/__init__.py

Whitespace-only changes.

tests/unit/__init__.py

Whitespace-only changes.

tests/unit/test_example.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
def test_simple():
3+
assert True

0 commit comments

Comments
 (0)