From 88f5b845780915a9371193b2183154ed4d846d7a Mon Sep 17 00:00:00 2001 From: ssun30 Date: Fri, 22 Nov 2024 12:48:00 -0500 Subject: [PATCH] Fixed Conda build by: >> Setting the condarc file to only use the conda-forge channel >> Use Miniforge3 instead of Miniconda3 with the libmamba solver --- .github/workflows/conda_build.yml | 88 ++++++++++++++++++++++--------- 1 file changed, 64 insertions(+), 24 deletions(-) diff --git a/.github/workflows/conda_build.yml b/.github/workflows/conda_build.yml index 8ddbef0877..95531deb19 100644 --- a/.github/workflows/conda_build.yml +++ b/.github/workflows/conda_build.yml @@ -11,48 +11,88 @@ jobs: run: shell: bash -l {0} steps: - - uses: actions/checkout@v2 - - uses: conda-incubator/setup-miniconda@v2 + - uses: actions/checkout@v4 + - name: Create custom conda config file + run: | + RUNNER_CWD=$(pwd) + echo "channels:" > $RUNNER_CWD/condarc.yml + echo " - rmg" >> $RUNNER_CWD/condarc.yml + echo "show_channel_urls: true" >> $RUNNER_CWD/condarc.yml + - name: Setup Conda + uses: conda-incubator/setup-miniconda@v3 with: environment-file: environment.yml + miniforge-variant: Miniforge3 + miniforge-version: latest python-version: 3.7 activate-environment: rmg_env + use-mamba: true - name: Conda info run: | - conda info - conda list + mamba info + mamba list + - name: Install Build Tools + run: | + mamba install -y anaconda-client conda-build + - name: Configure Auto-Upload + run: | + mamba config --set anaconda_upload yes - name: Build Binary - env: - CONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} run: | - conda install -y conda-build - conda install -y anaconda-client - conda config --add channels rmg - conda config --set anaconda_upload yes - conda build --token $CONDA_TOKEN --user rmg .conda + # Set the CONDA_TOKEN environment variable + if [ -z "${{ secrets.ANACONDA_TOKEN }}" ]; then + export CONDA_TOKEN="default_value" + else + export CONDA_TOKEN="${{ secrets.ANACONDA_TOKEN }}" + fi + + echo "CONDA_TOKEN=$CONDA_TOKEN" >> $GITHUB_ENV + + # Build the Conda binary + conda-build --token "$CONDA_TOKEN" --user rmg .conda + build-osx: runs-on: macos-latest defaults: run: shell: bash -l {0} steps: - - uses: actions/checkout@v2 - - uses: conda-incubator/setup-miniconda@v2 + - uses: actions/checkout@v4 + - name: Create custom conda config file + run: | + RUNNER_CWD=$(pwd) + echo "channels:" > $RUNNER_CWD/condarc.yml + echo " - rmg" >> $RUNNER_CWD/condarc.yml + echo "show_channel_urls: true" >> $RUNNER_CWD/condarc.yml + - name: Setup Conda + uses: conda-incubator/setup-miniconda@v3 with: environment-file: environment.yml + miniforge-variant: Miniforge3 + miniforge-version: latest python-version: 3.7 activate-environment: rmg_env + use-mamba: true - name: Conda info run: | - conda info - conda list + mamba info + mamba list + - name: Install Build Tools + run: | + mamba install -y anaconda-client conda-build + - name: Configure Auto-Upload + run: | + mamba config --set anaconda_upload yes - name: Build Binary - env: - CONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} - run: | - conda install -y conda-build - conda install -y anaconda-client - conda config --add channels rmg - conda config --set anaconda_upload yes - xcrun --show-sdk-path - conda build --token $CONDA_TOKEN --user rmg .conda + run: | + # Set the CONDA_TOKEN environment variable + if [ -z "${{ secrets.ANACONDA_TOKEN }}" ]; then + export CONDA_TOKEN="default_value" + else + export CONDA_TOKEN="${{ secrets.ANACONDA_TOKEN }}" + fi + + echo "CONDA_TOKEN=$CONDA_TOKEN" >> $GITHUB_ENV + + xcrun --show-sdk-path + conda build --token $CONDA_TOKEN --user rmg .conda