-
Notifications
You must be signed in to change notification settings - Fork 8
137 lines (120 loc) · 5.8 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
name: CMake
on: [push]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build:
strategy:
matrix:
platform: [windows-2022, ubuntu-22.04]
arch: [x86, x64]
python-version: ['3.7.x', '3.8.x', '3.9.x', '3.10.x']
exclude:
- platform: ubuntu-22.04
arch: x86
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ${{matrix.platform}}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{matrix.python-version}}
architecture: ${{matrix.arch}}
- name: Install Dependencies
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
curl -L --output $GITHUB_WORKSPACE/swigwin-4.0.2.zip --url http://prdownloads.sourceforge.net/swig/swigwin-4.0.2.zip
unzip $GITHUB_WORKSPACE/swigwin-4.0.2.zip
else
sudo apt install swig
fi
- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{runner.workspace}}/build
- name: Configure Project x32
if: matrix.arch == 'x86'
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
working-directory: ${{runner.workspace}}/build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
cmake $GITHUB_WORKSPACE/trunk -A Win32 -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENIGMA_BUILD_UNIT_TESTS:BOOL=ON -DENIGMA_BUILD_WRAPPERS_SWIG:BOOL=ON -DWRAP_SWIG_PYTHON:BOOL=ON -DWRAP_SWIG_CSHARP:BOOL=ON -DENIGMA_PYTHON_VERSION=${{matrix.python-version}} -DSWIG_EXECUTABLE=$GITHUB_WORKSPACE/swigwin-4.0.2/swig.exe
else
cmake $GITHUB_WORKSPACE/trunk -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENIGMA_BUILD_UNIT_TESTS:BOOL=ON -DENIGMA_BUILD_WRAPPERS_SWIG:BOOL=ON -DWRAP_SWIG_PYTHON:BOOL=ON -DENIGMA_PYTHON_VERSION=${{matrix.python-version}}
fi
- name: Configure Project x64
if: matrix.arch == 'x64'
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
working-directory: ${{runner.workspace}}/build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
cmake $GITHUB_WORKSPACE/trunk -A x64 -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENIGMA_BUILD_UNIT_TESTS:BOOL=ON -DENIGMA_BUILD_WRAPPERS_SWIG:BOOL=ON -DWRAP_SWIG_PYTHON:BOOL=ON -DWRAP_SWIG_CSHARP:BOOL=ON -DENIGMA_PYTHON_VERSION=${{matrix.python-version}} -DSWIG_EXECUTABLE=$GITHUB_WORKSPACE/swigwin-4.0.2/swig.exe
else
cmake $GITHUB_WORKSPACE/trunk -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENIGMA_BUILD_UNIT_TESTS:BOOL=ON -DENIGMA_BUILD_WRAPPERS_SWIG:BOOL=ON -DWRAP_SWIG_PYTHON:BOOL=ON -DENIGMA_PYTHON_VERSION=${{matrix.python-version}}
fi
- name: Build Project
working-directory: ${{runner.workspace}}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config $BUILD_TYPE
- name: Install Project
working-directory: ${{runner.workspace}}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --install . --prefix $GITHUB_WORKSPACE/release
- name: Run Tests
working-directory: ${{runner.workspace}}/build/bin
shell: bash
run: ./UnitTests
- name: Build Python Package x86
if: matrix.arch == 'x86'
working-directory: ${{runner.workspace}}/ENigMA/release/ENigMApy
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
pip install wheel
python setup.py bdist_wheel --python-tag py${{matrix.python-version}} --plat-name win32
fi
- name: Build Python Package x64
if: matrix.arch == 'x64'
working-directory: ${{runner.workspace}}/ENigMA/release/ENigMApy
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
pip install wheel
python setup.py bdist_wheel --python-tag py${{matrix.python-version}} --plat-name win_amd64
else
pip install wheel
python setup.py bdist_wheel --python-tag py${{matrix.python-version}} --plat-name linux_x86_64
fi
- name: Build CSharp Package
if: matrix.platform == 'windows-2022'
working-directory: ${{runner.workspace}}/ENigMA/release/ENigMAcs
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
python setup.py ${{matrix.arch}}
fi
- name: Save Artifacts
uses: actions/upload-artifact@v3
with:
name: ENigMA
path: |
${{runner.workspace}}/ENigMA/release/ENigMApy/dist/*.whl
${{runner.workspace}}/ENigMA/release/ENigMAcs/dist/*.zip
retention-days: 3