diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..9e428e0 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @jorisbelierasml @watermarkhu diff --git a/.github/workflows/release-matfrostmex.yml b/.github/workflows/release-matfrostmex.yml index 7eb262f..a335bd6 100644 --- a/.github/workflows/release-matfrostmex.yml +++ b/.github/workflows/release-matfrostmex.yml @@ -11,7 +11,7 @@ jobs: build-mex-binary: strategy: matrix: - matlab-version: ['2021b', '2022a', '2022b', '2023a', '2023b', '2024a'] + matlab-version: ['2021b', '2022a', '2022b', '2023a', '2023b', '2024a', '2024b', '2025a'] runs-on: windows-latest name: windows-R${{ matrix.matlab-version }} steps: @@ -34,26 +34,27 @@ jobs: with: path: src/matfrostjuliacall/bin name: matfrost-mex-win-r${{ matrix.matlab-version }}-x64 - release-mex-binary: - needs: build-mex-binary - runs-on: ubuntu-latest - name: Release-MEX-Binary - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Download MEX artifacts - uses: actions/download-artifact@v4 - with: - path: mexbinwin - merge-multiple: true - - name: Display structure of downloade MEX binaries. - run: ls -R mexbinwin - - name: Upload MEX binaries - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - cd mexbinwin - tar -czvf ../matfrost-mex-v${{ inputs.matfrost-mex-version }}-win-x64.tar.gz * - cd .. - gh release create matfrost-mex-v${{ inputs.matfrost-mex-version }} --latest=false matfrost-mex-v${{ inputs.matfrost-mex-version }}-win-x64.tar.gz + + # release-mex-binary: + # needs: build-mex-binary + # runs-on: ubuntu-latest + # name: Release-MEX-Binary + # steps: + # - name: Checkout code + # uses: actions/checkout@v4 + # - name: Download MEX artifacts + # uses: actions/download-artifact@v4 + # with: + # path: mexbinwin + # merge-multiple: true + # - name: Display structure of downloade MEX binaries. + # run: ls -R mexbinwin + # - name: Upload MEX binaries + # env: + # GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # run: | + # cd mexbinwin + # tar -czvf ../matfrost-mex-v${{ inputs.matfrost-mex-version }}-win-x64.tar.gz * + # cd .. + # gh release create matfrost-mex-v${{ inputs.matfrost-mex-version }} --latest=false matfrost-mex-v${{ inputs.matfrost-mex-version }}-win-x64.tar.gz diff --git a/.github/workflows/run-tests-dispatch.yml b/.github/workflows/run-tests-dispatch.yml index 769cc9a..95ba70a 100644 --- a/.github/workflows/run-tests-dispatch.yml +++ b/.github/workflows/run-tests-dispatch.yml @@ -22,6 +22,8 @@ on: - 'R2023a' - 'R2023b' - 'R2024a' + - 'R2024b' + - 'R2025a' julia-version: required: true description: "Julia version" @@ -31,6 +33,7 @@ on: - '1.8' - '1.9' - '1.10' + - '1.11' jobs: test: diff --git a/.github/workflows/run-tests-reusable.yml b/.github/workflows/run-tests-reusable.yml index bc3fe3a..e4552b7 100644 --- a/.github/workflows/run-tests-reusable.yml +++ b/.github/workflows/run-tests-reusable.yml @@ -19,12 +19,43 @@ on: default: "1.10" type: string +jobs: + config: + runs-on: ubuntu-latest + steps: + - name: Parse MATLAB version + id: parse_matlab_version + run: | + VERSION="${{ inputs.matlab-version }}" + YEAR=$(echo "$VERSION" | grep -oP 'R\K[0-9]{4}') + RELEASE=$(echo "$VERSION" | grep -oP '[ab]$') + echo "MATLAB_YEAR=$YEAR" >> $GITHUB_ENV + echo "MATLAB_RELEASE=$RELEASE" >> $GITHUB_ENV -env: - GCC_VERSION: ${{ (startsWith(inputs.matlab-version, 'R2022') && '9' || '10') }} + - name: Set GCC version + id: set_gcc_version + run: | + if [[ "${{ env.MATLAB_YEAR }}" -le 2021 ]]; then + echo "gcc_version=9" >> $GITHUB_OUTPUT + else + echo "gcc_version=10" >> $GITHUB_OUTPUT + fi + + - name: Set Windows GCC products + id: set_windows_products + run: | + if [[ "${{ env.MATLAB_YEAR }}" -ge 2024 ]]; then + echo "windows_products=MATLAB_Support_for_MinGW-w64_C/C++/Fortran_Compiler" >> $GITHUB_OUTPUT + else + echo "windows_products=MATLAB_Support_for_MinGW-w64_C/C++_Compiler" >> $GITHUB_OUTPUT + fi + + outputs: + gcc_version: ${{ steps.set_gcc_version.outputs.gcc_version }} + windows_products: ${{ steps.set_windows_products.outputs.windows_products }} -jobs: test: + needs: [config] runs-on: ${{ inputs.os }} name: ${{ inputs.os }}-${{ inputs.matlab-version }}-${{ inputs.julia-version }} steps: @@ -32,10 +63,10 @@ jobs: - name: Configure compatible linux GCC compiler for MATLAB. if: ${{ startsWith(inputs.os , 'ubuntu') }} run: | - sudo apt-get install g++-${{ env.GCC_VERSION }} - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${{ env.GCC_VERSION }} 100 + sudo apt-get install g++-${{ needs.config.outputs.gcc_version }} + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${{ needs.config.outputs.gcc_version }} 100 sudo update-alternatives --config g++ - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ env.GCC_VERSION }} 100 + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ needs.config.outputs.gcc_version }} 100 sudo update-alternatives --config gcc g++ --version gcc --version @@ -47,9 +78,9 @@ jobs: with: channel: ${{ inputs.julia-version }} - - name: Set up MATLAB on Unix/Mac + - name: Set up MATLAB on Unix uses: matlab-actions/setup-matlab@v2 - if: ${{ !contains( inputs.os, 'windows') }} + if: ${{ startsWith(inputs.os , 'ubuntu') }} with: release: ${{ inputs.matlab-version }} cache: true @@ -60,12 +91,10 @@ jobs: with: release: ${{ inputs.matlab-version }} cache: true - products: > - ${{ contains(inputs.matlab-version, '2024') && 'MATLAB_Support_for_MinGW-w64_C/C++/Fortran_Compiler' || 'MATLAB_Support_for_MinGW-w64_C/C++_Compiler' }} + products: ${{ needs.config.outputs.windows_products }} - - - name: Run tests + id: tests uses: matlab-actions/run-tests@v2 env: JULIA_VERSION: ${{ inputs.julia-version }} @@ -73,12 +102,32 @@ jobs: source-folder: 'src/matlab' select-by-folder: 'test' strict: false - test-results-junit: test-reults/results.xml - code-coverage-cobertura: test-reults/coverage.xml + test-results-junit: test-results/results.xml + code-coverage-cobertura: test-results/coverage.xml + + - name: Write test result status + shell: python + if: always() + env: + outcome: ${{ steps.tests.outcome }} + run: | + import os + os.makedirs('test-results', exist_ok=True) + outcome = os.environ.get('outcome', '').lower() + if outcome == 'success': + symbol = '✅' + elif outcome == 'failure': + symbol = '❌' + elif outcome == 'skipped': + symbol = '⏭️' + else: + symbol = '❔' + with open('test-results/outcome.txt', 'w', encoding='utf-8') as f: + f.write(symbol) - name: Upload artifacts if: always() uses: actions/upload-artifact@v4 with: - path: test-reults + path: test-results name: results-${{ inputs.os }}-${{ inputs.matlab-version }}-${{ inputs.julia-version }} diff --git a/.github/workflows/run-tests-ubuntu.yml b/.github/workflows/run-tests-ubuntu.yml deleted file mode 100644 index 46a3c3e..0000000 --- a/.github/workflows/run-tests-ubuntu.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: "ubuntu" - -on: - workflow_call: - workflow_dispatch: - -jobs: - test-ubuntu: - uses: ./.github/workflows/run-tests-reusable.yml - secrets: inherit - strategy: - fail-fast: false - matrix: - matlab-version: ['R2022a', 'R2022b', 'R2023b'] - julia-version: ['1.7', '1.8', '1.9', '1.10'] - with: - os: ubuntu-latest - matlab-version: ${{ matrix.matlab-version }} - julia-version: ${{ matrix.julia-version }} diff --git a/.github/workflows/run-tests-windows.yml b/.github/workflows/run-tests-windows.yml deleted file mode 100644 index c57d159..0000000 --- a/.github/workflows/run-tests-windows.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: "windows" - -on: - workflow_call: - workflow_dispatch: - -jobs: - test-windows: - uses: ./.github/workflows/run-tests-reusable.yml - secrets: inherit - strategy: - fail-fast: false - matrix: - matlab-version: ['R2021b', 'R2022b', 'R2023b'] - julia-version: ['1.7', '1.8', '1.9', '1.10', '1.11'] - with: - os: windows-latest - matlab-version: ${{ matrix.matlab-version }} - julia-version: ${{ matrix.julia-version }} diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 13fe899..2eb34c8 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -1,16 +1,6 @@ -name: Run Tests Automation +name: Testing on: - workflow_dispatch: - push: - branches: - - main - paths: - - 'src/**' - - 'test/**' - - 'Project.toml' - - '.github/workflows/run-tests.yml' - - '.github/workflows/run-tests-reusable.yml' pull_request: branches: - main @@ -19,21 +9,134 @@ on: - reopened - synchronize - ready_for_review - paths: - - 'src/**' - - 'test/**' - - 'Project.toml' - - '.github/workflows/run-tests.yml' - - '.github/workflows/run-tests-reusable.yml' + +concurrency: + group: "${{ github.workflow }}-${{ github.ref }}-${{ github.event.pull_request.merged }}" + cancel-in-progress: true jobs: - # Linux disabled due to incompatability. - # - # ubuntu: - # uses: ./.github/workflows/run-tests-ubuntu.yml - # if: ${{ ((github.event_name == 'pull_request') && !github.event.pull_request.draft) || (github.event_name == 'push') || (github.event_name == 'workflow_dispatch') }} - # secrets: inherit - windows: - uses: ./.github/workflows/run-tests-windows.yml - if: ${{ ((github.event_name == 'pull_request') && !github.event.pull_request.draft) || (github.event_name == 'push') || (github.event_name == 'workflow_dispatch') }} - secrets: inherit + changed-files: + name: Check for changed files + runs-on: ubuntu-latest + permissions: + contents: read + outputs: + changed-workflows: ${{ steps.changed-files.outputs.workflows_any_changed }} + changed-src: ${{ steps.changed-files.outputs.src_any_changed }} + changed-test: ${{ steps.changed-files.outputs.test_any_changed }} + changed-examples: ${{ steps.changed-files.outputs.examples_any_changed }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v46 + with: + files_yaml: | + workflows: + - .github/workflows/run-tests*.yml + src: + - src/** + - Project.toml + - Artifacts.toml + test: + - test/** + examples: + - examples/** + + test-single: + needs: [changed-files] + if: ${{ needs.changed-files.outputs.changed-workflows || needs.changed-files.outputs.changed-src || needs.changed-files.outputs.changed-test || needs.changed-files.outputs.changed-examples }} + permissions: + contents: read + uses: ./.github/workflows/run-tests-reusable.yml + with: + os: windows-latest + julia-version: 1.11 + matlab-version: R2025a + + test-matrix: + needs: [changed-files, test-single] + if: ${{ needs.changed-files.outputs.changed-workflows || needs.changed-files.outputs.changed-src || needs.changed-files.outputs.changed-test || needs.changed-files.outputs.changed-examples }} + permissions: + contents: read + strategy: + fail-fast: false + matrix: + os: [windows-latest] + julia-version: [1.7, 1.8, 1.9, 1.10, 1.11] + matlab-version: [R2021b, R2022a, R2022b, R2023a, R2023b, R2024a, R2024b, R2025a] + exclude: + - os: windows-latest + julia-version: 1.11 + matlab-version: 2025a + + uses: ./.github/workflows/run-tests-reusable.yml + with: + os: ${{ matrix.os }} + julia-version: ${{ matrix.julia-version }} + matlab-version: ${{ matrix.matlab-version }} + + summary: + name: Summary + needs: [changed-files, test-matrix] + if: ${{ !cancelled() }} + runs-on: ubuntu-latest + permissions: + contents: read + checks: write + pull-requests: write + env: + OS: windows-latest + JULIA_VERSION: 1.7 1.8 1.9 1.10 1.11 + MATLAB_VERSION: R2021b R2022a R2022b R2023a R2023b R2024a R2024b R2025a + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + + - name: Generate outcome tables + continue-on-error: true + shell: bash + run: | + set -e + os_list=($OS) + julia_versions=($JULIA_VERSION) + matlab_versions=($MATLAB_VERSION) + for os_name in ${os_list[@]}; do + echo "Generating outcome table for ${os_name}..." + table="| ${os_name} |" + for julia in ${julia_versions[@]}; do + table+=" $julia |" + done + table+="\n|---|" + for ((i=0; i<${#julia_versions[@]}; i++)); do + table+="---|" + done + table+="\n" + for matlab in ${matlab_versions[@]}; do + row="| $matlab |" + for julia in ${julia_versions[@]}; do + outcome_file=outcome.txt + if [[ -f "$outcome_file" ]]; then + outcome=$(cat "$outcome_file") + else + outcome="N/A" + fi + row+=" $outcome |" + done + table+="$row\n" + done + echo -e "\n### Results for \`${os_name}\`\n\n$table" | tee -a outcome_tables.md + done + cat outcome_tables.md + echo "" >> $GITHUB_STEP_SUMMARY + cat outcome_tables.md >> $GITHUB_STEP_SUMMARY + + - name: Generate test summary + if: ${{ needs.changed-files.outputs.changed-workflows || needs.changed-files.outputs.changed-src || needs.changed-files.outputs.changed-test || needs.changed-files.outputs.changed-examples }} + uses: EnricoMi/publish-unit-test-result-action@v2 + with: + files: results-*/results.xml + action_fail: true + ignore_runs: true diff --git a/Artifacts.toml b/Artifacts.toml index 11cc1d4..89739de 100644 --- a/Artifacts.toml +++ b/Artifacts.toml @@ -2,6 +2,6 @@ git-tree-sha1 = "3c64e8d2a2e9720abcb9edfdfae4bae4882d0d40" - [[matfrost-mex.download]] - sha256 = "26cea9dca7b408b84a9a66e0974aa121253d8c4314687d97bf5c9989e16479e1" - url = "https://github.com/ASML-Labs/MATFrost.jl/releases/download/matfrost-mex-v0.4.0/matfrost-mex-v0.4.0-win-x64.tar.gz" +[[matfrost-mex.download]] +sha256 = "26cea9dca7b408b84a9a66e0974aa121253d8c4314687d97bf5c9989e16479e1" +url = "https://github.com/ASML-Labs/MATFrost.jl/releases/download/matfrost-mex-v0.4.0/matfrost-mex-v0.4.0-win-x64.tar.gz"