[CI] upgrade GitHub actions #106
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: Matlab Package | |
on: | |
workflow_dispatch: | |
push: | |
tags-ignore: | |
- '**' | |
branches: | |
- '**' | |
release: | |
types: ['released', 'prereleased'] | |
jobs: | |
build-linux: | |
runs-on: ubuntu-latest | |
env: | |
HOST: 'x86_64-centos7-linux-gnu' | |
TOOLS_VERSION: '0.1.0-beta3' | |
TOOLS_URL: 'https://github.com/tttapa/cross-python/releases/download' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up MATLAB | |
uses: matlab-actions/setup-matlab@5b825d0ad4205ef03dc40ba3b24cad22674e9ca3 | |
with: | |
release: R2020a | |
- name: Download toolchain | |
run: wget "${{ env.TOOLS_URL }}/${{ env.TOOLS_VERSION }}/full-${{ env.HOST }}.tar.xz" -O- | sudo tar xJ -C /opt | |
- name: Configure | |
run: | | |
host="${{ env.HOST }}" | |
staging="/opt/$host" | |
cmake -B build -S QPALM \ | |
-D CMAKE_BUILD_TYPE=RelWithDebInfo \ | |
-D QPALM_WITH_MEX=On \ | |
-D CMAKE_POSITION_INDEPENDENT_CODE=On \ | |
-D CMAKE_C_COMPILER="$staging/x-tools/$host/bin/$host-gcc" \ | |
-D CMAKE_CXX_COMPILER="$staging/x-tools/$host/bin/$host-g++" \ | |
-D CMAKE_Fortran_COMPILER="$staging/x-tools/$host/bin/$host-gfortran" | |
env: | |
CXXFLAGS: "-march=skylake -static-libstdc++ -static-libgcc" | |
LDFLAGS: "-static-libstdc++ -static-libgcc" | |
CFLAGS: "-march=skylake -static-libgcc" | |
- name: Build | |
run: | | |
cmake --build build \ | |
--config RelWithDebInfo \ | |
-j | |
- name: Install | |
run: | | |
cmake --install build \ | |
--config RelWithDebInfo \ | |
--component mex_interface \ | |
--prefix staging | |
- name: Package | |
run: | | |
zip -r ../qpalm-matlab-linux.zip ./* | |
working-directory: staging | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: qpalm-matlab-linux | |
path: qpalm-matlab-linux.zip | |
- name: Release | |
if: ${{ github.event.action == 'released' || github.event.action == 'prereleased' }} | |
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 | |
with: | |
files: qpalm-matlab-linux.zip | |
build-macos: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up MATLAB | |
uses: matlab-actions/setup-matlab@5b825d0ad4205ef03dc40ba3b24cad22674e9ca3 | |
with: | |
release: latest | |
- name: Configure | |
run: | | |
cmake -B build -S QPALM \ | |
-D CMAKE_BUILD_TYPE=RelWithDebInfo \ | |
-D QPALM_WITH_MEX=On \ | |
-D CMAKE_POSITION_INDEPENDENT_CODE=On | |
env: | |
CXXFLAGS: "-march=skylake" | |
CFLAGS: "-march=skylake" | |
- name: Build | |
run: | | |
cmake --build build \ | |
--config RelWithDebInfo \ | |
-j | |
- name: Install | |
run: | | |
cmake --install build \ | |
--config RelWithDebInfo \ | |
--component mex_interface \ | |
--prefix staging | |
- name: Package | |
run: | | |
zip -r ../qpalm-matlab-macos.zip ./* | |
working-directory: staging | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: qpalm-matlab-macos | |
path: qpalm-matlab-macos.zip | |
- name: Release | |
if: ${{ github.event.action == 'released' || github.event.action == 'prereleased' }} | |
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 | |
with: | |
files: qpalm-matlab-macos.zip | |
build-windows: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up MATLAB | |
uses: matlab-actions/setup-matlab@5b825d0ad4205ef03dc40ba3b24cad22674e9ca3 | |
with: | |
release: R2021a | |
- name: Configure | |
shell: pwsh | |
run: | | |
cmake -B build -S QPALM ` | |
-D CMAKE_BUILD_TYPE=RelWithDebInfo ` | |
-D QPALM_WITH_MEX=On ` | |
-D CMAKE_POSITION_INDEPENDENT_CODE=On | |
- name: Build | |
shell: pwsh | |
run: | | |
cmake --build build ` | |
--config RelWithDebInfo ` | |
-j | |
- name: Install | |
shell: pwsh | |
run: | | |
cmake --install build ` | |
--config RelWithDebInfo ` | |
--component mex_interface ` | |
--prefix staging | |
- name: Package | |
shell: pwsh | |
run: | | |
Compress-Archive -Path staging\* qpalm-matlab-windows.zip | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: qpalm-matlab-windows | |
path: qpalm-matlab-windows.zip | |
- name: Release | |
if: ${{ github.event.action == 'released' || github.event.action == 'prereleased' }} | |
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 | |
with: | |
files: qpalm-matlab-windows.zip |