-
Notifications
You must be signed in to change notification settings - Fork 4
241 lines (236 loc) · 10.5 KB
/
cmake.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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# Copyright (c) 2019-2020 Luca Cappa
# Released under the term specified in file LICENSE.txt
# SPDX short identifier: MIT
name: abcranger-build
on: [push]
env:
VCPKG_REVISION: "2024.04.26"
PMM_VERSION: "2.1.0"
MKL_VERSION: "intel-oneapi-mkl-devel-2024.1"
jobs:
create_release:
if: ${{ !contains(toJSON(github.event.commits.*.message), '[skip-ci]') }}
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.new_release.outputs.upload_url }}
new_tag: ${{ steps.bump_version.outputs.new_tag }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Bump version and push tag
id: bump_version
uses: anothrNick/github-tag-action@1.67.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
INITIAL_VERSION: 1.2.9
DEFAULT_BUMP: patch
- name: Create release
id: new_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.bump_version.outputs.new_tag }}
release_name: Release ${{ steps.bump_version.outputs.new_tag }}
draft: true
prerelease: true
job:
name: diyabc-${{ matrix.os }}
needs: create_release
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: windows-latest
shortos: windows
cmakeargs: -DTEST:BOOL=FALSE -DUSE_MKL:BOOL=FALSE -DMAKE_STATIC_EXE:BOOL=TRUE -DVCPKG_TARGET_TRIPLET:STRING=x64-windows-static -DCMAKE_BUILD_TYPE:STRING=Release -G Ninja
- os: ubuntu-latest
shortos: linux
cmakeargs: "-DTEST:BOOL=FALSE -DUSE_MKL:BOOL=TRUE -DMAKE_STATIC_EXE:BOOL=TRUE -DLAPACK_ROOT:STRING=/opt/intel/oneapi/mkl/latest/lib '-DLAPACK_LIBRARIES:STRING=-Wl,--start-group /opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_intel_lp64.a /opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_tbb_thread.a /opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a -Wl,--end-group;pthread;m;dl' '-DBLAS_LIBRARIES:STRING=-Wl,--start-group /opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_intel_lp64.a /opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_tbb_thread.a /opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a -Wl,--end-group;pthread;m;dl' -DCMAKE_BUILD_TYPE:STRING=Release -G Ninja"
- os: macos-latest
shortos: macos-x64
cmakeargs: -DTEST:BOOL=FALSE -DCMAKE_OSX_ARCHITECTURES:STRING=x86_64 -DVCPKG_TARGET_TRIPLET:STRING=x64-osx -DUSE_MKL:BOOL=FALSE -DCMAKE_BUILD_TYPE:STRING=Release -G Ninja
- os: macos-latest
shortos: macos-arm64
cmakeargs: -DTEST:BOOL=FALSE -DCMAKE_OSX_ARCHITECTURES:STRING=arm64 -DVCPKG_TARGET_TRIPLET:STRING=arm64-osx -DUSE_MKL:BOOL=FALSE -DCMAKE_BUILD_TYPE:STRING=Release -G Ninja
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install R
uses: r-lib/actions/setup-r@v2
with:
r-version: '4.4'
- uses: lukka/get-cmake@latest
- name: Get R version
run: echo "R_VERSION=$(Rscript -e 'cat(as.character(getRversion()))')" >> $GITHUB_OUTPUT
id: get-r-version
- name: restore/cache vcpkg/ubuntu
uses: actions/cache@v2
with:
path: /home/runner/.local/share/pmm
key: ubuntu-vcpkg-${{ env.PMM_VERSION }}-${{ env.VCPKG_REVISION }}
if: matrix.os == 'ubuntu-latest'
- name: restore/cache vcpkg/macos
uses: actions/cache@v2
with:
path: /Users/runner/.local/share/pmm
key: macos-vcpkg5-${{ matrix.shortos }}-${{ env.PMM_VERSION }}-${{ env.VCPKG_REVISION }}
if: matrix.os == 'macos-latest'
- name: restore/cache vcpkg/windows
uses: actions/cache@v2
with:
path: C:/Users/runneradmin/AppData/Local/pmm
key: windows-vcpkg2-${{ env.PMM_VERSION }}-${{ env.VCPKG_REVISION }}
if: matrix.os == 'windows-latest'
- name: restore/cache mkl
uses: actions/cache@v2
with:
path: /opt/intel
key: ${{ env.MKL_VERSION }}
if: matrix.os == 'ubuntu-latest'
- name: setup x64-linux
run: |
if [ ! -d /opt/intel/lib/intel64 ]; then
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt-get update
sudo apt-get install -y ${{ env.MKL_VERSION }}
fi
echo "CC=gcc-12" >> $GITHUB_ENV
echo "CXX=g++-12" >> $GITHUB_ENV
if: matrix.os == 'ubuntu-latest'
- name: setup MacOS
run: |
brew install ninja
echo "CC=$(brew --prefix llvm@15)/bin/clang" >> $GITHUB_ENV
echo "CXX=$(brew --prefix llvm@15)/bin/clang++" >> $GITHUB_ENV
# echo "CC=gcc-14" >> $GITHUB_ENV
# echo "CXX=g++-14" >> $GITHUB_ENV
# echo "CXXFLAGS=-static-libstdc++ -static-libgcc" >> $GITHUB_ENV
if: matrix.os == 'macos-latest'
- name: Configure MSVC console (Windows)
if: matrix.os == 'windows-latest'
uses: ilammy/msvc-dev-cmd@v1
- name: setup windows
run: |
# Set these env vars so cmake picks the correct compiler
echo "CXX=cl.exe" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
echo "CC=cl.exe" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
if: matrix.os == 'windows-latest'
# - uses: actions/setup-python@v5
# name: Install Python
# if: matrix.os != 'ubuntu-latest'
- name: Run CMake+Ninja
uses: lukka/run-cmake@v3
id: runcmake_cmd
with:
cmakeGenerator: 'Ninja'
cmakeListsOrSettingsJson: 'CMakeListsTxtAdvanced'
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
buildWithCMakeArgs: '--target abcranger -- -v'
buildWithCMake: true
buildDirectory: ${{ runner.workspace }}/b/ninja/
cmakeAppendedArgs: '${{ matrix.cmakeargs }}'
- name: Minimal tests
run: |
python -m pip install pytest
pytest -s test/test.py --path ${{ runner.workspace }}/b/ninja/abcranger
- name: Failure standalone
if: failure()
uses: author/action-rollback@stable
with:
id: ${{ needs.create_release.id }}
tag: ${{ needs.create_release.outputs.new_tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Upload windows binary
# uses: actions/upload-artifact@v2
# with:
# name: diyabc-${{ matrix.os }}
# path: ${{ runner.workspace }}/b/ninja/install/
# if: contains( matrix.os, 'windows')
# - name: Upload binary
# uses: actions/upload-artifact@v2
# with:
# name: diyabc-${{ matrix.os }}
# path: ${{ runner.workspace }}/b/ninja/install/general
# if: "! contains( matrix.os, 'windows')"
- name: Get the version
id: get_version
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
shell: bash
- name: Upload Release Asset Unix
id: upload-release-asset-unix
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ${{ runner.workspace }}/b/ninja/abcranger
asset_name: abcranger-${{ matrix.shortos }}-${{ needs.create_release.outputs.new_tag }}
asset_content_type: application/octet-stream
if: matrix.os != 'windows-latest'
- name: Upload Release Asset Windows
id: upload-release-asset-windows
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ${{ runner.workspace }}/b/ninja/abcranger.exe
asset_name: abcranger-${{ matrix.shortos }}-${{ needs.create_release.outputs.new_tag }}.exe
asset_content_type: application/octet-stream
if: matrix.os == 'windows-latest'
- name: Build wheels
uses: pypa/cibuildwheel@v2.19.0
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl
build_sdist:
needs: [job]
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v2
name: Install Python
- name: restore/cache vcpkg/ubuntu
uses: actions/cache@v2
with:
path: /home/runner/.local/share/pmm
key: ubuntu-vcpkg-${{ env.VCPKG_REVISION }}
- name: Build sdist
run: |
pip install setuptools cmake ninja cmaketools wheel
python setup.py sdist
- uses: actions/upload-artifact@v2
if: failure()
with:
path: dist/*.tar.gz
- uses: actions/upload-artifact@v2
with:
path: dist/*.tar.gz
upload_pypi:
needs: [job, build_sdist]
if: ${{ contains(toJSON(github.event.commits.*.message), '[pypi]') }}
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
# alternatively, to publish when a GitHub Release is created, use the following rule:
# if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_password }}
# repository_url: https://test.pypi.org/legacy/