Skip to content

Revamp the build system #982

Revamp the build system

Revamp the build system #982

Workflow file for this run

name: Run Unit Tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build_cpp:
runs-on: Linux
steps:
- name: Checkout RAT
uses: actions/checkout@v4
- name: Generate CPP
uses: matlab-actions/run-command@v2
with:
command: addPaths; generateCpps;
- name: Upload cppDeploy
uses: actions/upload-artifact@v4
with:
name: cppDeploy
retention-days: 1
path: compile/fullCompile/cppDeploy/
- name: Upload cppDeploy
uses: actions/upload-artifact@v4
with:
name: codegen
retention-days: 1
path: compile/fullCompile/codegen/
build_and_test_mex:
strategy:
matrix:
platform: [windows-latest, ubuntu-latest, macos-15-intel, macos-latest]
runs-on: ${{ matrix.platform }}
needs: [build_cpp]
steps:
- name: Checkout RAT
uses: actions/checkout@v4
- name: Download Mex CPP
uses: actions/download-artifact@v4
with:
name: codegen
path: compile/fullCompile/codegen/
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v2
with:
release: R2023a
products: Parallel_Computing_Toolbox
- name: Build Mex and Run Tests
uses: matlab-actions/run-command@v2
with:
command: addPaths; generateMexFromCpp; testScript
- name: Create build archive (Windows and macOS)
if: runner.os != 'Linux'
run: tar --exclude="**/-lang:c++.zip" --exclude=".git*/" --exclude="**/codegen/" --exclude="htmlcov/" -acvf ../${{ runner.os }}-${{ runner.arch }}.zip *
- name: Create build archive (Linux)
if: runner.os == 'Linux'
run: zip -r ../${{ runner.os }}-${{ runner.arch }}.zip * -x "**/-lang:c++.zip" ".git*/" "htmlcov/*" "**/codegen/*"
- run: mv ../${{ runner.os }}-${{ runner.arch }}.zip ${{ runner.os }}-${{ runner.arch }}.zip
- name: Upload releases
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-${{ runner.arch }}
retention-days: 1
path: ${{ runner.os }}-${{ runner.arch }}.zip
deploy-nightly:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
needs: [build_and_test_mex]
permissions:
contents: write
steps:
- name: Get artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Create nightly release
run: |
output=$(gh release delete nightly --cleanup-tag --yes --repo ${{ github.repository }} 2>&1) || [[ "${output}" == "release not found" ]]
gh release create nightly Windows-X64.zip Linux-X64.zip macOS-X64.zip macOS-ARM64.zip --prerelease --title "Nightly Build" --latest=false --repo ${{ github.repository }}
env:
GH_TOKEN: ${{ github.token }}
cpp-deploy:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
needs: [build_and_test_mex]
steps:
- name: Checkout Source
uses: actions/checkout@v4
with:
ref: generated_source
path: rat_source
- name: Get cppDeploy
uses: actions/download-artifact@v4
with:
name: cppDeploy
path: cppDeploy/
- name: Deploy Source
run: |
rm -rf rat_source/*.c rat_source/*.cpp rat_source/*.h rat_source/*.hpp
rsync -av cppDeploy/ rat_source/
cd rat_source
git config user.name github-actions
git config user.email [email protected]
git add -A
git commit -m "Deploy Source Code" || true
git push