-
Notifications
You must be signed in to change notification settings - Fork 0
179 lines (152 loc) · 4.72 KB
/
Copy pathCICD.yml
File metadata and controls
179 lines (152 loc) · 4.72 KB
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: CI-CD
on:
push:
release:
pull_request:
jobs:
test:
name: Py${{ matrix.PYTHON_VERSION }}
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
env:
CI: 'true'
OS: 'linux'
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
strategy:
fail-fast: false
matrix:
PYTHON_VERSION: ['3.9', '3.10', '3.11']
steps:
- name: Checkout Pull Requests
uses: actions/checkout@v6
- name: Install Environment Dependencies
run: |
sudo apt-get update --fix-missing
sudo apt-get install -y libgit2-dev xvfb x11-utils libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 xdotool
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v4
with:
miniconda-version: "latest"
python-version: ${{ matrix.PYTHON_VERSION }}
channel-priority: false # "strict"
channels: "conda-forge"
mamba-version: "*"
show-channel-urls: true
- name: Setup environment
run: |
mamba install spyder
pip install -e .
conda list
generate_artifacts:
needs: test
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout Pull Requests
uses: actions/checkout@v6
- name: Install Environment Dependencies
shell: bash
run: |
sudo apt-get update --fix-missing
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v4
with:
miniconda-version: "latest"
python-version: 3.9
channel-priority: false # "strict"
channels: "conda-forge"
mamba-version: "*"
show-channel-urls: true
- name: Compute Version
id: computed_version
run: |
if [[ ${{ github.event.release.tag_name != '' }} != false ]]
then
echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
else
echo ::set-output name=VERSION::$(echo "0.0.0")
fi
- name: Apply version
run: |
echo Version is ${{ steps.computed_version.outputs.VERSION }}
cd scripts
python package_tool.py --tag-version ${{ steps.computed_version.outputs.VERSION }}
cd ..
- name: Setup environment
run: |
pip install sphinx sphinx-rtd-theme myst-parser sphinx-markdown-tables
pip install --upgrade myst-parser
pip install PyQt5 qdarkstyle lxml qtawesome
pip install check-manifest
pip install twine
pip install -e .
- name: Run Manifest Check
run: |
echo 'Check manifest of Pylab-ML'
check-manifest
- name: Build Sphinx
run: |
sphinx-build -b html docs/source/ docs/build/html
touch docs/build/html/.nojekyll
- name: Fix output file permissions
run: |
sudo chown -R $USER:$USER docs
- name: Upload docs to Github artifact
uses: actions/upload-artifact@v7
with:
path: docs/build/html/
name: docs-output
- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./docs/build/html
- uses: JamesIves/github-pages-deploy-action@v4
with:
folder: ./docs/build/html
branch: gh-pages
clean-exclude: pr-preview
- name: Generate distribution sdist files
run: |
cd scripts
python -m pip install build
python package_tool.py
cd ..
- name: Check distribution files
run: |
twine check output/*
- name: Upload Build Artifacts
uses: actions/upload-artifact@v7
with:
name: output
path: ./output
publish:
if: ${{ github.event.release.tag_name != '' }}
needs: generate_artifacts
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Install
run: |
python -m pip install twine
- name: Get artifacts from build job
uses: actions/download-artifact@v3
with:
name: output
path: |
output
- name: Extend Release Assets
uses: alexellis/upload-assets@0.3.0
env:
GITHUB_TOKEN: ${{ github.token }}
with:
asset_paths: '["output/*"]'
- name: Upload to PyPi using twine
run: |
for i in `find output/ -type f`; do twine upload -u __token__ -p ${{ secrets.PYPI_TOKEN }} $i; done