Fix github actions v4. #247
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CMake | |
on: [push] | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Release | |
jobs: | |
build: | |
strategy: | |
matrix: | |
platform: [windows-latest, ubuntu-latest] | |
arch: [x64] | |
python-version: ['3.9.x', '3.10.x', '3.11.x', '3.12.x'] | |
# 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 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 x64 | |
if: matrix.arch == 'x64' | |
working-directory: ${{runner.workspace}}/ENigMA/release/ENigMApy | |
shell: bash | |
run: | | |
if [ "$RUNNER_OS" == "Windows" ]; then | |
pip install wheel | |
pip install setuptools | |
python setup.py bdist_wheel --python-tag py${{matrix.python-version}} --plat-name win_amd64 | |
else | |
pip install wheel | |
pip install setuptools | |
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-latest' | |
working-directory: ${{runner.workspace}}/ENigMA/release/ENigMAcs | |
shell: bash | |
run: | | |
if [ "$RUNNER_OS" == "Windows" ]; then | |
python setup.py ${{matrix.arch}} | |
fi | |
save_artifacts: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Save Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ENigMA | |
path: | | |
${{runner.workspace}}/ENigMA/release/ENigMApy/dist/*.whl | |
${{runner.workspace}}/ENigMA/release/ENigMAcs/dist/*.zip | |
retention-days: 3 | |