Automatically create and upload release artifacts #192
Workflow file for this run
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: Test matHELICS | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
jobs: | |
ci-test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-2019,macos-12,ubuntu-20.04] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Install latest HELICS release | |
uses: gmlc-tdc/helics-action/install@main | |
- name: Set up MATLAB (macOS) | |
if: runner.os == 'macOS' | |
uses: matlab-actions/setup-matlab@v2.2.0 | |
with: | |
release: R2022b | |
- name: Set up MATLAB | |
if: runner.os != 'macOS' | |
uses: matlab-actions/setup-matlab@v2.2.0 | |
with: | |
release: R2021a | |
- name: Set up MEX | |
uses: matlab-actions/run-command@v2 | |
with: | |
command: mex -setup | |
- name: Build matHELICS | |
uses: matlab-actions/run-command@v2 | |
with: | |
command: buildHelicsInterface('helics',true) | |
- name: Rename artifact (Windows) | |
if: runner.os == 'Windows' | |
run: mv matHELICS.zip matHELICS-${{ matrix.os }}.zip | |
- name: Rename artifact | |
if: runner.os != 'Windows' | |
run: mv matHELICS.tar.gz matHELICS-${{ matrix.os }}.tar.gz | |
- name: store package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.os }}-matHELICS | |
path: matHELICS-${{ matrix.os }}.* | |
- name: run startup | |
uses: matlab-actions/run-command@v2 | |
with: | |
command: addpath('helics'), helicsStartup | |
- name: run tests | |
uses: matlab-actions/run-command@v2 | |
with: | |
command: addpath('tests'),addpath('helics'),runAllTests | |
release: | |
if: github.event_name == 'release' && github.event.action == 'published' | |
runs-on: ubuntu-latest | |
needs: ci-test | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: # no name specified, so all artifacts will be downloaded | |
path: ./artifacts | |
merge-multiple: true | |
- name: List files in artifacts | |
run: ls ./artifacts | |
- name: Create Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
body: Release for [HELICS ${{ github.ref }}](https://github.com/GMLC-TDC/HELICS/releases/tag/${{ github.ref }}) | |
files: ./artifacts/matHELICS-${{ matrix.os }}.* |