From a80d49952b0277aa1814d7911f58e06471a85b6e Mon Sep 17 00:00:00 2001 From: Duc Le Date: Wed, 24 Apr 2024 23:05:34 +0100 Subject: [PATCH] CI bugfixes Update cibuildwheel version. Workaround test segfault. Fix syntax error in utils.py Update actions to node-20 Change to setup-micromamba --- .github/workflows/main.yml | 24 +++++++++++++----------- libpymcr/utils.py | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cafbf11..7a2addd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -61,20 +61,20 @@ jobs: os: [ubuntu-22.04, windows-2022, macos-12] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Cache MCR if: ${{ matrix.os != 'ubuntu-22.04' }} id: cache-mcr - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: mcr key: ${{ runner.os }}-matlab-${{ env.MCRVER }}-mcr lookup-only: true - name: Cache gists id: cache-gists - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: gists key: ${{ runner.os }}-gists @@ -112,7 +112,7 @@ jobs: os: [ubuntu-22.04, windows-2022, macos-12] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup variables @@ -140,21 +140,21 @@ jobs: env - name: Set up MATLAB if: ${{ matrix.os == 'ubuntu-22.04' }} - uses: matlab-actions/setup-matlab@v1.2.4 + uses: matlab-actions/setup-matlab@v2 with: release: ${{ env.MLVER }} - - uses: actions/cache/restore@v3 + - uses: actions/cache/restore@v4 if: ${{ matrix.os != 'ubuntu-22.04' }} with: path: mcr key: ${{ runner.os }}-matlab-${{ env.MCRVER }}-mcr fail-on-cache-miss: true - - uses: actions/cache/restore@v3 + - uses: actions/cache/restore@v4 with: path: gists key: ${{ runner.os }}-gists fail-on-cache-miss: true - - uses: pypa/cibuildwheel@v2.12.0 + - uses: pypa/cibuildwheel@v2.17.0 env: CIBW_BUILD: ${{ env.CIBW }} CIBW_ENVIRONMENT: >- @@ -162,7 +162,7 @@ jobs: HOSTDIRECTORY="${{ env.MLPREFIX }}${{ env.HOSTDIRECTORY }}" CIBW_BUILD_VERBOSITY: 1 MACOSX_DEPLOYMENT_TARGET: "10.15" - - uses: mamba-org/provision-with-micromamba@main + - uses: mamba-org/setup-micromamba@v1 with: environment-file: false cache-downloads: true @@ -176,7 +176,9 @@ jobs: eval "$($MAMBA_EXE shell activate py$pyver)" python -m pip install wheelhouse/*cp$(echo $pyver | sed s/\\.//)* cd test - python run_test.py + # Sometimes the test results in a segfault on exit + python run_test.py || true + test -f success cd .. done - name: Upload release wheels @@ -187,7 +189,7 @@ jobs: #- name: Setup tmate # if: ${{ failure() }} # uses: mxschmitt/action-tmate@v3 - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: ${{ matrix.os }}_artifacts.zip path: | diff --git a/libpymcr/utils.py b/libpymcr/utils.py index e33b4bc..2b1c420 100644 --- a/libpymcr/utils.py +++ b/libpymcr/utils.py @@ -234,7 +234,7 @@ def guess_from_env(self, ld_path=None): def guess_from_syspath(self): matlab_exe = shutil.which('matlab') if matlab_exe is None: - return None if self.system == 'Windows' else guess_from_env('PATH') + return None if self.system == 'Windows' else self.guess_from_env('PATH') mlbinpath = os.path.dirname(os.path.realpath(matlab_exe)) return self.find_version(os.path.abspath(os.path.join(mlbinpath, '..')))