This repository was archived by the owner on Mar 21, 2025. It is now read-only.
ci: update to actions/upload-artifact@v4 #47
This file contains hidden or 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: Build and Test | |
on: | |
pull_request: | |
push: | |
release: | |
types: | |
- created | |
env: | |
BUILD_TYPE: Release | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
use_eigen: [ON] | |
build_type: [Release] | |
os: [ubuntu-18.04, windows-latest] | |
use_single_precision: [ON, OFF] | |
include: | |
- os: ubuntu-18.04 | |
build_type: Debug | |
use_eigen: OFF | |
use_single_precision: ON | |
- os: ubuntu-18.04 | |
build_type: Debug | |
use_eigen: ON | |
use_single_precision: ON | |
- os: ubuntu-18.04 | |
build_type: Debug | |
use_eigen: ON | |
use_single_precision: OFF | |
- os: windows-latest | |
build_type: Debug | |
use_eigen: ON | |
steps: | |
- uses: actions/checkout@42 | |
with: | |
fetch-depth: 0 | |
- if: contains(matrix.os, 'ubuntu') | |
name: Get Dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install p7zip-full build-essential zlib1g-dev liblapacke-dev libopenblas-dev libatlas-base-dev python3 python3-pip apt-transport-https python-virtualenv ninja-build libeigen3-dev ${{ matrix.deps }} | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Setup windows flags | |
if: contains(matrix.os, 'windows') && matrix.build_type == 'Release' | |
id: flags | |
run: echo "::set-output name=SETUP_PY_FLAGS::-G 'Visual Studio 16 2019'" | |
- name: Get mac dependencies | |
if: contains(matrix.os, 'macos') | |
run: | | |
brew install freeglut lapack openblas | |
- 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 CMake | |
shell: bash | |
working-directory: ${{runner.workspace}}/build | |
run: cmake $GITHUB_WORKSPACE -DUSE_EIGEN=${{matrix.use_eigen}} -DDOWNLOAD_EIGEN=${{matrix.use_eigen}} -DUSE_SINGLE_PRECISION=${{matrix.use_single_precision}} -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENABLE_TESTS=ON -DCMAKE_INSTALL_PREFIX=install_root ${{matrix.config_flags}} | |
- name: Build | |
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 -v | |
- name: Install | |
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 --target install | |
- name: Set bundle name | |
id: bundle | |
run: echo "::set-output name=BUNDLE_FILE_NAME::cnmatrix-$(git describe --tags)-${{ matrix.os }}.zip" | |
- name: Bundle | |
if: matrix.build_type == 'Release' | |
working-directory: ${{runner.workspace}}/cnmatrix | |
run: 7z a ${{runner.workspace}}/build/${{ steps.bundle.outputs.BUNDLE_FILE_NAME }} ${{runner.workspace}}/build/install_root/* | |
- uses: actions/upload-artifact@v4 | |
name: Upload | |
if: matrix.build_type == 'Release' | |
with: | |
name: cnmatrix-${{ matrix.os }}-${{ matrix.build_type }} | |
path: | | |
${{runner.workspace}}/build/${{steps.bundle.outputs.BUNDLE_FILE_NAME}} | |
- name: Get release | |
id: get_release | |
if: github.event_name == 'release' | |
uses: bruceadams/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload Release Asset | |
id: upload-release-asset | |
continue-on-error: true | |
if: github.event_name == 'release' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.get_release.outputs.upload_url }} | |
asset_path: ${{runner.workspace}}/build/${{steps.bundle.outputs.BUNDLE_FILE_NAME}} | |
asset_name: ${{steps.bundle.outputs.BUNDLE_FILE_NAME}} | |
asset_content_type: application/zip | |
- name: Test | |
working-directory: ${{runner.workspace}}/build | |
shell: bash | |
# Execute tests defined by the CMake configuration. | |
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | |
run: ctest -C $BUILD_TYPE --output-on-failure -j30 |