diff --git a/.github/workflows/test_CondaEnv.yml b/.github/workflows/test_CondaEnv.yml index f6fd531..bec0202 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 with Miniforge (Including M-series)' on: pull_request: @@ -7,23 +7,53 @@ on: - '.github/workflows/**' jobs: - build-conda-env: + validate-conda-env: runs-on: ${{ matrix.os }} 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: - - 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: Install Miniforge + shell: bash + run: | + if [ $RUNNER_OS == "macOS" ]; then + 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 + 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: Validate Conda Environment File + shell: bash + run: | + 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