-
Notifications
You must be signed in to change notification settings - Fork 36
183 lines (173 loc) · 5.79 KB
/
release-please.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
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
180
181
182
183
on:
push:
name: release-please
jobs:
linting:
name: Linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black ruff
- name: Autoformat with black
run: |
black .
- name: Lint with ruff
run: |
ruff check LoopStructural --fix
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "style: style fixes by ruff and autoformatting by black"
continuous-integration:
name: Continuous integration ${{ matrix.os }} python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ${{ fromJSON(vars.BUILD_OS)}}
python-version: ${{ fromJSON(vars.PYTHON_VERSIONS)}}
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python }}
- name: Installing dependencies
shell: bash -l {0}
run: |
conda install -c conda-forge numpy scipy scikit-image scikit-learn pytest networkx osqp matplotlib -y
- name: Building and install
shell: bash -l {0}
run: |
pip install . --user
- name: pytest
shell: bash -l {0}
run: |
pytest
documentation-test:
runs-on: ubuntu-latest
#needs: continuous-integration
steps:
- uses: actions/checkout@v4
- run: |
cp CHANGELOG.md docs/source/getting_started/CHANGELOG.md
docker build . -t=lsdocs -f docs/Dockerfile
docker run -v $(pwd):/LoopStructural lsdocs bash LoopStructural/docs/build_docs.sh
- name: upload artifacts
uses: actions/upload-artifact@v3
with:
path: docs/build/html
release-please:
runs-on: ubuntu-latest
needs: documentation-test
if: github.ref == 'refs/heads/master'
steps:
- uses: GoogleCloudPlatform/release-please-action@v4
id: release
with:
release-type: python
package-name: LoopStructural
version-file: LoopStructural/version.py
outputs:
release_created: ${{ steps.release.outputs.release_created }}
# if a release is created then run the deploy scripts for github.io, conda, pypi and docker
documentation-deploy:
runs-on: ubuntu-latest
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}
steps:
- uses: actions/checkout@v4
- run: |
cp CHANGELOG.md docs/source/getting_started/CHANGELOG.md
docker build . -t=lsdocs -f docs/Dockerfile
docker run -v $(pwd):/LoopStructural lsdocs bash LoopStructural/docs/build_docs.sh
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.3
with:
branch: gh-pages # The branch the action should deploy to.
folder: docs/build/html # The folder the action should deploy.
conda-deploy:
name: Building conda package for python ${{ matrix.os }})
needs: ["documentation-test", "continuous-integration"]
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ${{ fromJSON(vars.PYTHON_VERSIONS)}}
steps:
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v4
- name: update submodules
# shell: bash -l {0}
run: |
git submodule update --init --recursive
- name: Conda build
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
shell: bash -l {0}
run: |
conda install -c conda-forge conda-build scikit-build numpy cython anaconda-client -y
conda build -c anaconda -c conda-forge -c loop3d --output-folder conda conda
conda convert -p all conda/linux-64/*.tar.bz2 -f -o conda
conda install anaconda-client -y
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: conda-${{ matrix.os }}-${{ matrix.python-version }}
path: conda
make_sdist:
needs: ["documentation-test", "continuous-integration"]
name: Make SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build SDist
run: |
pip install build
python -m build
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
upload_to_conda:
needs: ["release-please", "conda-deploy"]
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ${{ fromJSON(vars.PYTHON_VERSIONS)}}
if: ${{ needs.release-please.outputs.release_created }}
steps:
- uses: actions/download-artifact@v4
with:
name: conda-${{ matrix.os }}-${{ matrix.python-version }}
path: conda
- uses: conda-incubator/setup-miniconda@v3
- name: upload all files to conda-forge
shell: bash -l {0}
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
run: |
conda install -c anaconda anaconda-client -y
anaconda upload --label main conda/*/*.tar.bz2
upload_to_pypi:
needs: ["release-please", "conda-deploy"]
runs-on: "ubuntu-latest"
if: ${{ needs.release-please.outputs.release_created }}
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
skip_existing: true
verbose: true
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_PASSWORD }}