-
Notifications
You must be signed in to change notification settings - Fork 6
147 lines (111 loc) · 4.16 KB
/
CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# All CI tasks (testing, building) are maintained in this workflow file
# and their inter-dependencies controlled with job-level `if` and `needs` until
# GitHub Actions allows for them to be factored out into separate, inter-dependent
# workflow files.
# See https://github.community/t/depend-on-another-workflow/16311/8.
name: CI
on: [push, pull_request, release] # runs on all branches
env:
PYTHON_VERSION: 3.12
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: false
- name: Install biopeaks
run: poetry install --no-interaction --without build
- name: Install system dependencies for headless testing
run: sudo ./.devcontainer/install_system_dependencies.sh
- name: Test and collect coverage
run: pytest -v --cov-config=.coveragerc --cov-report=xml --cov=biopeaks
- name: Upload coverage report
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
build_distribution:
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-pip-wheelsy
uses: actions/cache@v4
with:
path: ~/.cache
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Build and upload distribution
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
poetry publish -u $PYPI_USERNAME -p $PYPI_PASSWORD --build
build_executable:
needs: test
runs-on: windows-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-pip-wheels
uses: actions/cache@v4
with:
path: ~/.cache
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: |
poetry install --no-interaction --no-root --no-dev --extras "pyinstaller"
- name: Build executable
shell: bash -l {0}
run: |
source $VENV
pyinstaller --onefile --windowed --name=biopeaks --paths=D:\\a\\biopeaks\\biopeaks \
--hidden-import=distutils --hidden-import=distutils.version --hidden-import=distutils.unixccompiler \
--hidden-import=numpy.distutils --collect-all=numpy.distutils \
--icon=biopeaks\\images\\python_icon.ico biopeaks\\__main__.py
- name: Upload executable
uses: actions/upload-artifact@v4
with:
name: biopeaks_windows
path: dist/biopeaks.exe
upload_executable_to_release: # separate job on Ubuntu since JasonEtco/upload-to-release@master only runs on Linux
needs: build_executable
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- name: Download executable
uses: actions/download-artifact@v4
with:
name: biopeaks_windows
- name: Upload executable to release
uses: JasonEtco/upload-to-release@master
with:
args: biopeaks.exe application/octet-stream
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # token generated implicitly