From 65f30539dea19d175a33ff6c6d10cdde4570edb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20P=C3=B6lsterl?= Date: Sun, 4 Feb 2024 11:52:56 +0100 Subject: [PATCH] CI: Download and install miniconda --- .github/workflows/build.yaml | 14 +---- ...{Linux-py310.yaml => Linux-X64-py310.yaml} | 0 ...{Linux-py311.yaml => Linux-X64-py311.yaml} | 0 ...{Linux-py312.yaml => Linux-X64-py312.yaml} | 0 .../{Linux-py39.yaml => Linux-X64-py39.yaml} | 0 build_config/Linux-py38.yaml | 6 --- build_config/Windows-py38.yaml | 10 ---- ...{macOS-py310.yaml => macOS-X64-py310.yaml} | 0 ...{macOS-py311.yaml => macOS-X64-py311.yaml} | 0 ...{macOS-py312.yaml => macOS-X64-py312.yaml} | 0 .../{macOS-py39.yaml => macOS-X64-py39.yaml} | 0 build_config/macOS-py38.yaml | 20 ------- setup-conda.sh | 53 +++++++++++++++++++ 13 files changed, 55 insertions(+), 48 deletions(-) rename build_config/{Linux-py310.yaml => Linux-X64-py310.yaml} (100%) rename build_config/{Linux-py311.yaml => Linux-X64-py311.yaml} (100%) rename build_config/{Linux-py312.yaml => Linux-X64-py312.yaml} (100%) rename build_config/{Linux-py39.yaml => Linux-X64-py39.yaml} (100%) delete mode 100644 build_config/Linux-py38.yaml delete mode 100644 build_config/Windows-py38.yaml rename build_config/{macOS-py310.yaml => macOS-X64-py310.yaml} (100%) rename build_config/{macOS-py311.yaml => macOS-X64-py311.yaml} (100%) rename build_config/{macOS-py312.yaml => macOS-X64-py312.yaml} (100%) rename build_config/{macOS-py39.yaml => macOS-X64-py39.yaml} (100%) delete mode 100644 build_config/macOS-py38.yaml create mode 100755 setup-conda.sh diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c4e70b7..884c390 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -14,22 +14,12 @@ jobs: uses: actions/checkout@v4 - name: Setup Miniconda run: | - $CONDA/bin/conda config --set always_yes yes --set changeps1 no - $CONDA/bin/conda config --set auto_update_conda false - $CONDA/bin/conda config --set show_channel_urls true - $CONDA/bin/conda config --set add_pip_as_python_dependency false - $CONDA/bin/conda config --set conda_build.pkg_format 2 - $CONDA/bin/conda config --add channels sebp - sudo $CONDA/bin/conda update -q -n base conda - sudo $CONDA/bin/conda install -q -n base anaconda-client conda-build - sudo chown -R $USER $CONDA - $CONDA/bin/conda info --all - $CONDA/bin/conda config --show + ./setup-conda.sh ${{ runner.os }} ${{ runner.arch }} - name: Configure conda and conda-build run: sudo ./setup-osx.sh if: runner.os == 'macOS' - name: Build package - run: $CONDA/bin/conda-build -m build_config/${{ runner.os }}-${{ matrix.config }}.yaml ./recipe + run: $CONDA/bin/conda-build -m build_config/${{ runner.os }}-${{ runner.arch }}-${{ matrix.config }}.yaml ./recipe - name: Upload package env: BINSTAR_TOKEN: ${{ secrets.BINSTAR_TOKEN }} diff --git a/build_config/Linux-py310.yaml b/build_config/Linux-X64-py310.yaml similarity index 100% rename from build_config/Linux-py310.yaml rename to build_config/Linux-X64-py310.yaml diff --git a/build_config/Linux-py311.yaml b/build_config/Linux-X64-py311.yaml similarity index 100% rename from build_config/Linux-py311.yaml rename to build_config/Linux-X64-py311.yaml diff --git a/build_config/Linux-py312.yaml b/build_config/Linux-X64-py312.yaml similarity index 100% rename from build_config/Linux-py312.yaml rename to build_config/Linux-X64-py312.yaml diff --git a/build_config/Linux-py39.yaml b/build_config/Linux-X64-py39.yaml similarity index 100% rename from build_config/Linux-py39.yaml rename to build_config/Linux-X64-py39.yaml diff --git a/build_config/Linux-py38.yaml b/build_config/Linux-py38.yaml deleted file mode 100644 index b410cea..0000000 --- a/build_config/Linux-py38.yaml +++ /dev/null @@ -1,6 +0,0 @@ -python: - - '3.8' -numpy: - - '1.21' -target_platform: - - linux-64 diff --git a/build_config/Windows-py38.yaml b/build_config/Windows-py38.yaml deleted file mode 100644 index 4c98e03..0000000 --- a/build_config/Windows-py38.yaml +++ /dev/null @@ -1,10 +0,0 @@ -c_compiler: -- vs2019 -cxx_compiler: -- vs2019 -python: -- '3.8' -numpy: -- '1.21' -target_platform: -- win-64 diff --git a/build_config/macOS-py310.yaml b/build_config/macOS-X64-py310.yaml similarity index 100% rename from build_config/macOS-py310.yaml rename to build_config/macOS-X64-py310.yaml diff --git a/build_config/macOS-py311.yaml b/build_config/macOS-X64-py311.yaml similarity index 100% rename from build_config/macOS-py311.yaml rename to build_config/macOS-X64-py311.yaml diff --git a/build_config/macOS-py312.yaml b/build_config/macOS-X64-py312.yaml similarity index 100% rename from build_config/macOS-py312.yaml rename to build_config/macOS-X64-py312.yaml diff --git a/build_config/macOS-py39.yaml b/build_config/macOS-X64-py39.yaml similarity index 100% rename from build_config/macOS-py39.yaml rename to build_config/macOS-X64-py39.yaml diff --git a/build_config/macOS-py38.yaml b/build_config/macOS-py38.yaml deleted file mode 100644 index 62334f5..0000000 --- a/build_config/macOS-py38.yaml +++ /dev/null @@ -1,20 +0,0 @@ -CONDA_BUILD_SYSROOT: -- '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk' -MACOSX_DEPLOYMENT_TARGET: -- '10.13' -c_compiler: -- clang -c_compiler_version: -- '14' -cxx_compiler: -- clangxx -cxx_compiler_version: -- '14' -macos_machine: -- x86_64-apple-darwin13.4.0 -python: -- '3.8' -numpy: -- '1.21' -target_platform: -- osx-64 diff --git a/setup-conda.sh b/setup-conda.sh new file mode 100755 index 0000000..d515528 --- /dev/null +++ b/setup-conda.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +RUNNER_OS="${1}" +RUNNER_ARCH="${2}" + +run_check_sha() { + echo "${1}" | shasum -a 256 --check --strict - +} + +if [[ "${CONDA:-}" = "" ]]; then + # download and install conda + MINICONDA_VERSION="Miniconda3-py311_23.11.0-2" + + if [[ "${RUNNER_OS}" = "macOS" ]] && [[ "${RUNNER_ARCH}" = "ARM64" ]]; then + MINICONDA_VERSION="${MINICONDA_VERSION}-MacOSX-arm64" + MINICONDA_HASH="5694c382e6056d62ed874f22692224c4f53bca22e8135b6f069111e081be07aa" + elif [[ "${RUNNER_OS}" = "macOS" ]] && [[ "${RUNNER_ARCH}" = "X64" ]]; then + MINICONDA_VERSION="${MINICONDA_VERSION}-MacOSX-x86_64" + MINICONDA_HASH="2b7f9e46308c28c26dd83abad3e72121ef63916eaf17b63723b5a1f728dc3032" + elif [[ "${RUNNER_OS}" = "Linux" ]] && [[ "${RUNNER_ARCH}" = "X64" ]]; then + MINICONDA_VERSION="${MINICONDA_VERSION}-Linux-x86_64" + MINICONDA_HASH="c9ae82568e9665b1105117b4b1e499607d2a920f0aea6f94410e417a0eff1b9c" + else + echo "Unsupported OS or ARCH: ${RUNNER_OS} ${RUNNER_ARCH}" + exit 1 + fi + + export CONDA="${GITHUB_WORKSPACE}/miniconda3" + + mkdir -p "${CONDA}" && \ + curl "https://repo.anaconda.com/miniconda/${MINICONDA_VERSION}.sh" -o "${CONDA}/miniconda.sh" && \ + run_check_sha "${MINICONDA_HASH} ${CONDA}/miniconda.sh" && \ + bash "${CONDA}/miniconda.sh" -b -u -p "${CONDA}" && \ + rm -rf "${CONDA}/miniconda.sh" || exit 1 + + echo "CONDA=${CONDA}" >> "${GITHUB_ENV}" +fi + +"${CONDA}/bin/conda" config --set always_yes yes --set changeps1 no && \ +"${CONDA}/bin/conda" config --set auto_update_conda false && \ +"${CONDA}/bin/conda" config --set show_channel_urls true && \ +"${CONDA}/bin/conda" config --set add_pip_as_python_dependency false && \ +"${CONDA}/bin/conda" config --set conda_build.pkg_format 2 && \ +"${CONDA}/bin/conda" config --add channels sebp || \ +exit 1 + +sudo "${CONDA}/bin/conda" update -q -n base conda && \ +sudo "${CONDA}/bin/conda" install -q -n base anaconda-client conda-build && \ +sudo chown -R "${USER}" "${CONDA}" || \ +exit 1 + +"${CONDA}/bin/conda" info --all +"${CONDA}/bin/conda" config --show