From 79402bd31ec614f72825d6d7cb4603d1e78c9981 Mon Sep 17 00:00:00 2001 From: Golam Date: Tue, 3 Dec 2024 23:16:05 +0100 Subject: [PATCH 1/2] Update test_CondaEnv.yml --- .github/workflows/test_CondaEnv.yml | 48 ++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test_CondaEnv.yml b/.github/workflows/test_CondaEnv.yml index f6fd531..84f7a29 100644 --- a/.github/workflows/test_CondaEnv.yml +++ b/.github/workflows/test_CondaEnv.yml @@ -1,4 +1,4 @@ -name: 'Conda Env Verified (Ubuntu & MacOS)' +name: 'Test Conda Environment File' on: pull_request: @@ -7,23 +7,41 @@ on: - '.github/workflows/**' jobs: - build-conda-env: + validate-conda-env: runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, macos-latest] max-parallel: 5 steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.11 - uses: mamba-org/setup-micromamba@v1 - with: - environment-file: false - - name: Install Conda Environment on MacOS - if: matrix.os == 'macos-latest' - run: | - micromamba env create --platform osx-64 --file anaconda-env.yml - - name: Install Conda Environment on Ubuntu - if: matrix.os == 'ubuntu-latest' - run: | - micromamba env create --file anaconda-env.yml + - name: Check out repository + uses: actions/checkout@v3 + + - name: Set up Micromamba + uses: mamba-org/setup-micromamba@v2 + with: + micromamba-version: "latest" + cache-downloads: true + + - name: Validate Conda Environment File + run: | + # Dry run to test the environment file + if [ $RUNNER_OS == "macOS" ]; then + micromamba env create --yes --platform osx-64 --file anaconda-env.yml --dry-run + else + micromamba env create --yes --file anaconda-env.yml --dry-run + fi + + - name: Create Conda Environment (Full Test) + run: | + if [ $RUNNER_OS == "macOS" ]; then + micromamba env create --yes --name test_env --platform osx-64 --file anaconda-env.yml + else + micromamba env create --yes --name test_env --file anaconda-env.yml + fi + micromamba activate test_env + + - name: Test Environment Installation + run: | + python --version + conda list From 1c036051c39a2ed0154429d9484011559dcc854f Mon Sep 17 00:00:00 2001 From: Golam Date: Tue, 3 Dec 2024 23:27:23 +0100 Subject: [PATCH 2/2] fix conda env test for intel and m on mac --- .github/workflows/test_CondaEnv.yml | 50 ++++++++++++++++++----------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/.github/workflows/test_CondaEnv.yml b/.github/workflows/test_CondaEnv.yml index 84f7a29..bec0202 100644 --- a/.github/workflows/test_CondaEnv.yml +++ b/.github/workflows/test_CondaEnv.yml @@ -1,4 +1,4 @@ -name: 'Test Conda Environment File' +name: 'Test Conda Environment File with Miniforge (Including M-series)' on: pull_request: @@ -12,36 +12,48 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest] - max-parallel: 5 + include: + - os: macos-latest + arch: osx-arm64 # M-series + - os: macos-latest + arch: osx-64 # Intel + - os: ubuntu-latest + arch: linux-64 + max-parallel: 5 steps: - name: Check out repository uses: actions/checkout@v3 - - name: Set up Micromamba - uses: mamba-org/setup-micromamba@v2 - with: - micromamba-version: "latest" - cache-downloads: true - - - name: Validate Conda Environment File + - name: Install Miniforge + shell: bash run: | - # Dry run to test the environment file if [ $RUNNER_OS == "macOS" ]; then - micromamba env create --yes --platform osx-64 --file anaconda-env.yml --dry-run + if [ "${{ matrix.arch }}" == "osx-arm64" ]; then + MINIFORGE_URL="https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh" + else + MINIFORGE_URL="https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-x86_64.sh" + fi else - micromamba env create --yes --file anaconda-env.yml --dry-run + MINIFORGE_URL="https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh" fi + curl -L $MINIFORGE_URL -o Miniforge3.sh + bash Miniforge3.sh -b -p $HOME/miniforge + echo "$HOME/miniforge/bin" >> $GITHUB_PATH + source $HOME/miniforge/bin/activate - - name: Create Conda Environment (Full Test) + - name: Validate Conda Environment File + shell: bash run: | - if [ $RUNNER_OS == "macOS" ]; then - micromamba env create --yes --name test_env --platform osx-64 --file anaconda-env.yml - else - micromamba env create --yes --name test_env --file anaconda-env.yml - fi - micromamba activate test_env + conda env create --name test_env --file anaconda-env.yml --dry-run --force + + - name: Create and Activate Environment + shell: bash + run: | + conda env create --name test_env --file anaconda-env.yml + source activate test_env - name: Test Environment Installation + shell: bash run: | python --version conda list