Merge pull request #12 from irfu/dependabot/github_actions/master/mat… #35
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
# This is a basic CI build workflow using GitHub Actions | |
name: ci-build | |
# Controls when the action will run. | |
on: | |
# Triggers this workflow on push or pull request events but only for the master branch | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a job called "build" and a job called "matlab" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
# Runs a set of commands using the runners shell | |
- name: Compile Fortran code | |
run: | | |
cd src | |
make | |
# Upload artifact | |
- name: Upload Build Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
# Artifact name | |
name: builtWhamp | |
path: | | |
src/libwhamp.a | |
src/comcout.mod | |
src/comin.mod | |
src/comoutput.mod | |
# And only keep it for 1 day | |
retention-days: 1 | |
matlab: | |
# Runs Matlab | |
runs-on: ubuntu-latest | |
# But require artificat from "build" job | |
needs: build | |
steps: | |
# Check-out repository | |
- uses: actions/checkout@v4 | |
# Install MATLAB (GitHub action provided by MathWorks) | |
- name: Install MATLAB | |
uses: matlab-actions/setup-matlab@v2 | |
# Download artifact from "build" | |
- name: Download artifact from build | |
uses: actions/download-artifact@v4 | |
with: | |
name: builtWhamp | |
path: src/ | |
# in dir "src", try to build the mex file with help of the artifact | |
# and verify it works as inteded (by test_whamp_module.m) | |
- name: Run commands | |
uses: matlab-actions/run-command@v2 | |
with: | |
command: cd('src'); mex -R2017b libwhamp.a mexwhamp.F; movefile('mexwhamp.mexa64', '../matlab/+whamp/mexwhamp.mexa64'); cd('../matlab'); addpath(pwd); test=whamp.test_whamp_module; assertSuccess(test.run); | |