From 1fb6bc19b86dcd6a4cfe1de494eb0dc9b34224ea Mon Sep 17 00:00:00 2001 From: Bryan Weber Date: Sun, 23 Jun 2024 13:51:26 -0400 Subject: [PATCH] Set up to build Python --- .ci_support/conda_build_config.yaml | 2 + .github/workflows/main.yml | 210 ++++++++++++++-------------- cantera/meta.yaml | 8 +- 3 files changed, 111 insertions(+), 109 deletions(-) diff --git a/.ci_support/conda_build_config.yaml b/.ci_support/conda_build_config.yaml index 422f3e3..d1fb221 100644 --- a/.ci_support/conda_build_config.yaml +++ b/.ci_support/conda_build_config.yaml @@ -3,12 +3,14 @@ python: - '3.9' - '3.10' - '3.11' + - '3.12' numpy: - '1.16' # [not arm64] - '1.19' # [arm64] - '1.19' - '1.21' - '1.23' + - '1.23' zip_keys: - - python - numpy diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 13b4ac2..cdf96ba 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -160,109 +160,109 @@ jobs: path: ${{ env.CONDA }}/conda-bld/*/*cantera*.tar.bz2 name: conda-packages - build-matlab: - name: Matlab toolbox for ${{ matrix.os }} - runs-on: ${{ matrix.os }} - # Run this job even if post-pending-status was skipped - if: always() - needs: - - "post-pending-status" - strategy: - matrix: - os: [windows-2019, ubuntu-20.04, macos-11] - fail-fast: false - outputs: - job-status: ${{ job.status }} - defaults: - run: - shell: bash -l {0} - steps: - - name: Check out this repository - uses: actions/checkout@v3 - - name: Set up macOS SDK - id: setup-macos-sdk - uses: ./.github/actions/setup_macos - with: - macos-sdk-version: ${{ env.MACOSX_DEPLOYMENT_TARGET }} - if: runner.os == 'macOS' - - name: Append to conda build config - if: runner.os == 'macOS' - run: | - echo "" >> ./.ci_support/conda_build_config.yaml - echo "CONDA_BUILD_SYSROOT:" >> ./.ci_support/conda_build_config.yaml - echo "- ${CONDA_BUILD_SYSROOT}" >> ./.ci_support/conda_build_config.yaml - echo "" >> ./.ci_support/conda_build_config.yaml - env: - CONDA_BUILD_SYSROOT: ${{ steps.setup-macos-sdk.outputs.conda-build-sysroot }} - - name: Set Up Conda - uses: conda-incubator/setup-miniconda@v2.1.1 - with: - auto-update-conda: true - conda-build-version: '3.25' - activate-environment: '' - auto-activate-base: true - # Released 2023-04-24 - miniconda-version: 'py310_23.3.1-0' - - name: Install Conda dependencies - run: conda install -q conda-verify\<4.0 ripgrep + # build-matlab: + # name: Matlab toolbox for ${{ matrix.os }} + # runs-on: ${{ matrix.os }} + # # Run this job even if post-pending-status was skipped + # if: always() + # needs: + # - "post-pending-status" + # strategy: + # matrix: + # os: [windows-2019, ubuntu-20.04, macos-11] + # fail-fast: false + # outputs: + # job-status: ${{ job.status }} + # defaults: + # run: + # shell: bash -l {0} + # steps: + # - name: Check out this repository + # uses: actions/checkout@v3 + # - name: Set up macOS SDK + # id: setup-macos-sdk + # uses: ./.github/actions/setup_macos + # with: + # macos-sdk-version: ${{ env.MACOSX_DEPLOYMENT_TARGET }} + # if: runner.os == 'macOS' + # - name: Append to conda build config + # if: runner.os == 'macOS' + # run: | + # echo "" >> ./.ci_support/conda_build_config.yaml + # echo "CONDA_BUILD_SYSROOT:" >> ./.ci_support/conda_build_config.yaml + # echo "- ${CONDA_BUILD_SYSROOT}" >> ./.ci_support/conda_build_config.yaml + # echo "" >> ./.ci_support/conda_build_config.yaml + # env: + # CONDA_BUILD_SYSROOT: ${{ steps.setup-macos-sdk.outputs.conda-build-sysroot }} + # - name: Set Up Conda + # uses: conda-incubator/setup-miniconda@v2.1.1 + # with: + # auto-update-conda: true + # conda-build-version: '3.25' + # activate-environment: '' + # auto-activate-base: true + # # Released 2023-04-24 + # miniconda-version: 'py310_23.3.1-0' + # - name: Install Conda dependencies + # run: conda install -q conda-verify\<4.0 ripgrep - # The known_hosts key is generated with `ssh-keygen -F cantera.org` from a - # machine that has previously logged in to cantera.org and trusts - # that it logged in to the right machine - - name: Set up SSH key and host for cloning MATLAB - uses: shimataro/ssh-key-action@v2 - with: - key: ${{ secrets.CTDEPLOY_SSH_KEY }} - known_hosts: ${{ secrets.CTDEPLOY_KNOWN_HOSTS }} - # If the version of rsync is changed, the directories below have to be updated - - name: Install rsync on Windows - if: runner.os == 'Windows' - run: choco install rsync --version 6.2.4 - # This seems like overkill, but rsync on Windows requires a POSIX-style path - - name: Munge the MW_HEADERS_DIR for Windows rsync - run: | - import os - from pathlib import Path, PurePosixPath - mw_headers_dir = Path(os.environ["MW_HEADERS_DIR"]).resolve() - mw_headers_dir = PurePosixPath( - "/cygdrive", - mw_headers_dir.drive[0], - PurePosixPath(*mw_headers_dir.parts[1:]) - ) - with Path(os.environ["GITHUB_ENV"]).open(mode="a") as gh_env: - gh_env.write(f"CYG_MW_HEADERS_DIR={mw_headers_dir}") - shell: python - if: runner.os == 'Windows' - # When I tried this a few times, it only worked when I used powershell and had the - # SSH options all in the single line with single quotes. Note that there is a - # separate SSH binary pre-installed on the Windows runners that comes before this - # one on the PATH, but it is linked with the wrong Cygwin DLL, so it will not work. - - name: Get the MATLAB headers - if: runner.os == 'Windows' - run: | - rsync -azvP -e ` - 'C:\ProgramData\chocolatey\lib\rsync\tools\cwrsync_6.2.4_x64_free\bin\ssh.exe -i C:\Users\runneradmin\.ssh\id_rsa -o UserKnownHostsFile=C:\Users\runneradmin\.ssh\known_hosts' ` - ctdeploy@cantera.org:. $Env:CYG_MW_HEADERS_DIR - shell: powershell - - name: Get the MATLAB headers - if: runner.os != 'Windows' - run: "rsync -azvP ctdeploy@cantera.org:. ${MW_HEADERS_DIR}" - - name: Build the MATLAB recipe - run: conda build ./cantera-matlab -m ./.ci_support/conda_build_config.yaml - - name: List package contents - run: | - find '${{ runner.os == 'Windows' && '/c/Miniconda3' || env.CONDA }}/conda-bld' -name \*cantera\*.tar.bz2 | while read -r file; do - echo '*********************************************' - echo Contents of $file: - echo '*********************************************' - tar -tvf $file || true - done - shell: bash - - name: Archive the built packages - uses: actions/upload-artifact@v3 - with: - path: ${{ env.CONDA }}/conda-bld/*/*cantera*.tar.bz2 - name: conda-packages + # # The known_hosts key is generated with `ssh-keygen -F cantera.org` from a + # # machine that has previously logged in to cantera.org and trusts + # # that it logged in to the right machine + # - name: Set up SSH key and host for cloning MATLAB + # uses: shimataro/ssh-key-action@v2 + # with: + # key: ${{ secrets.CTDEPLOY_SSH_KEY }} + # known_hosts: ${{ secrets.CTDEPLOY_KNOWN_HOSTS }} + # # If the version of rsync is changed, the directories below have to be updated + # - name: Install rsync on Windows + # if: runner.os == 'Windows' + # run: choco install rsync --version 6.2.4 + # # This seems like overkill, but rsync on Windows requires a POSIX-style path + # - name: Munge the MW_HEADERS_DIR for Windows rsync + # run: | + # import os + # from pathlib import Path, PurePosixPath + # mw_headers_dir = Path(os.environ["MW_HEADERS_DIR"]).resolve() + # mw_headers_dir = PurePosixPath( + # "/cygdrive", + # mw_headers_dir.drive[0], + # PurePosixPath(*mw_headers_dir.parts[1:]) + # ) + # with Path(os.environ["GITHUB_ENV"]).open(mode="a") as gh_env: + # gh_env.write(f"CYG_MW_HEADERS_DIR={mw_headers_dir}") + # shell: python + # if: runner.os == 'Windows' + # # When I tried this a few times, it only worked when I used powershell and had the + # # SSH options all in the single line with single quotes. Note that there is a + # # separate SSH binary pre-installed on the Windows runners that comes before this + # # one on the PATH, but it is linked with the wrong Cygwin DLL, so it will not work. + # - name: Get the MATLAB headers + # if: runner.os == 'Windows' + # run: | + # rsync -azvP -e ` + # 'C:\ProgramData\chocolatey\lib\rsync\tools\cwrsync_6.2.4_x64_free\bin\ssh.exe -i C:\Users\runneradmin\.ssh\id_rsa -o UserKnownHostsFile=C:\Users\runneradmin\.ssh\known_hosts' ` + # ctdeploy@cantera.org:. $Env:CYG_MW_HEADERS_DIR + # shell: powershell + # - name: Get the MATLAB headers + # if: runner.os != 'Windows' + # run: "rsync -azvP ctdeploy@cantera.org:. ${MW_HEADERS_DIR}" + # - name: Build the MATLAB recipe + # run: conda build ./cantera-matlab -m ./.ci_support/conda_build_config.yaml + # - name: List package contents + # run: | + # find '${{ runner.os == 'Windows' && '/c/Miniconda3' || env.CONDA }}/conda-bld' -name \*cantera\*.tar.bz2 | while read -r file; do + # echo '*********************************************' + # echo Contents of $file: + # echo '*********************************************' + # tar -tvf $file || true + # done + # shell: bash + # - name: Archive the built packages + # uses: actions/upload-artifact@v3 + # with: + # path: ${{ env.CONDA }}/conda-bld/*/*cantera*.tar.bz2 + # name: conda-packages publish-files-to-anaconda: name: Publish to the Anaconda channel @@ -271,14 +271,14 @@ jobs: job-status: ${{ job.status }} needs: - "build-libcantera-and-python" - - "build-matlab" + # - "build-matlab" defaults: run: shell: bash -l {0} if: github.repository == 'Cantera/conda-recipes' && github.event.inputs.upload == 'true' steps: - name: Download pre-built packages - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: path: dist/ name: conda-packages @@ -300,7 +300,7 @@ jobs: needs: - "post-pending-status" - "build-libcantera-and-python" - - "build-matlab" + # - "build-matlab" - "publish-files-to-anaconda" if: always() && github.repository == 'Cantera/conda-recipes' steps: diff --git a/cantera/meta.yaml b/cantera/meta.yaml index 2433649..985c0e2 100644 --- a/cantera/meta.yaml +++ b/cantera/meta.yaml @@ -87,7 +87,7 @@ outputs: - mkl # [win] - mkl-devel # [win] - pywin32 # [win] - - libcantera {{ version }} + - libcantera =={{ version }} run: - libboost - {{ pin_subpackage('libcantera', exact=True) }} @@ -111,15 +111,15 @@ outputs: - pip - setuptools - libboost - - numpy + - numpy <2.0 - openblas # [linux] - mkl # [win] - mkl-devel # [win] - cython - pywin32 # [win] # This is added here so conda-build doesn't package it - - libcantera-devel {{ version }} - - libcantera {{ version }} + - libcantera-devel =={{ version }} + - libcantera =={{ version }} run: - python - setuptools