Skip to content

Commit 23b53b3

Browse files
committed
dev: added ci/cd for unittests, docs and pypi publishing.
1 parent 5fac0b0 commit 23b53b3

File tree

3 files changed

+121
-0
lines changed

3 files changed

+121
-0
lines changed

.github/workflows/build-sphinx.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: docs
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- 'v*'
7+
pull_request:
8+
branches: [ main ]
9+
10+
jobs:
11+
build_docs:
12+
runs-on: ubuntu-latest
13+
defaults:
14+
run:
15+
shell: bash -l {0}
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
- uses: mamba-org/setup-micromamba@v1
20+
with:
21+
generate-run-shell: true
22+
environment-file: environment.yml
23+
create-args: >-
24+
python=${{ matrix.python-version }}
25+
26+
- name: Install pip dependencies
27+
run: |
28+
pip install -r requirements_dev.txt
29+
30+
- name: Install floatCSEP
31+
run: |
32+
pip install --no-deps -e .
33+
python -c "import dbcsep; print('Version: ', dbcsep.__version__)"
34+
35+
- name: Build documentation
36+
run: |
37+
make -C docs clean
38+
make -C docs html

.github/workflows/build-test.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- 'v*'
7+
pull_request:
8+
9+
jobs:
10+
build:
11+
if: github.repository == 'cseptesting/dbcsep'
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: [ubuntu-latest, macos-latest]
17+
python-version: ['3.11']
18+
defaults:
19+
run:
20+
shell: bash -l {0}
21+
22+
steps:
23+
- uses: actions/checkout@v2
24+
- uses: mamba-org/setup-micromamba@v1
25+
with:
26+
generate-run-shell: true
27+
environment-file: environment.yml
28+
create-args: >-
29+
python=${{ matrix.python-version }}
30+
31+
32+
- name: Install floatCSEP
33+
run: |
34+
pip install pytest pytest-cov
35+
pip install --no-deps -e .
36+
python -c "import dbcsep; print('Version: ', dbcsep.__version__)"
37+
38+
- name: Test with pytest
39+
run: |
40+
pytest --cov=./ --cov-config=.coveragerc
41+
42+
- name: Upload coverage
43+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
44+
run: |
45+
bash <(curl -s https://codecov.io/bash) || echo 'Codecov failed to upload'

.github/workflows/publish-pypi.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build and upload to PyPI
2+
3+
# Only build on tagged releases
4+
on:
5+
push:
6+
tags:
7+
- '*'
8+
9+
jobs:
10+
build:
11+
name: Build and upload sdist
12+
runs-on: ubuntu-latest
13+
defaults:
14+
run:
15+
shell: bash -l {0}
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
- uses: mamba-org/setup-micromamba@v1
20+
with:
21+
generate-run-shell: true
22+
environment-file: environment.yml
23+
create-args: >-
24+
python=3.10
25+
26+
- name: Install py-build
27+
run: |
28+
python3 -m pip install --upgrade build
29+
30+
- name: Build
31+
run: |
32+
python3 -m build --sdist --wheel --outdir dist/
33+
34+
- name: Publish Package
35+
uses: pypa/gh-action-pypi-publish@master
36+
with:
37+
user: __token__
38+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)