11name : Conda Build
22
3+ concurrency :
4+ group : ${{ github.workflow }}-${{ github.ref }}
5+ cancel-in-progress : true
6+
37on :
48 pull_request :
9+ workflow_dispatch :
510 push :
611 branches :
712 - stable
813jobs :
914 build :
15+ strategy :
16+ fail-fast : false
17+ matrix :
18+ python-version : ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
1019 runs-on : ubuntu-latest
20+ name : Build Python ${{ matrix.python-version }}
1121 defaults :
1222 run :
1323 shell : bash -l {0}
1424 steps :
1525 - uses : actions/checkout@v4
1626
17- # Step to create a custom condarc.yml before setting up conda
18- - name : Create custom conda config file
19- run : |
20- RUNNER_CWD=$(pwd)
21- echo "channels:" > $RUNNER_CWD/condarc.yml
22- echo " - conda-forge" >> $RUNNER_CWD/condarc.yml
23- echo "show_channel_urls: true" >> $RUNNER_CWD/condarc.yml
24-
25- - name : Setup Conda
27+ - name : Setup Miniforge
2628 uses : conda-incubator/setup-miniconda@v3
2729 with :
2830 miniforge-variant : Miniforge3
2931 miniforge-version : latest
30- use-mamba : true
31- condarc-file : condarc.yml
32- auto-update-conda : false
32+ auto-update-conda : true
33+ show-channel-urls : true
34+ conda-remove-defaults : true
3335 auto-activate-base : true
3436 activate-environment : " "
3537
3638 - name : Install Build Tools
37- run : mamba install python anaconda-client conda-build conda-verify
39+ run : conda install python anaconda-client conda-build
3840
3941 - name : Configure Auto-Upload
4042 if : github.ref == 'refs/heads/stable'
@@ -43,18 +45,20 @@ jobs:
4345
4446 - name : Build Binary
4547 run : |
46- # Set the CONDA_TOKEN environment variable
47- if [ -z "${{ secrets.ANACONDA_TOKEN }}" ]; then
48- export CONDA_TOKEN="default_value"
49- else
50- export CONDA_TOKEN="${{ secrets.ANACONDA_TOKEN }}"
51- fi
52-
48+ # set a default value to the conda_token if needed (like from forks)
49+ : "${CONDA_TOKEN:=${{ secrets.ANACONDA_TOKEN }}}"
50+ : "${CONDA_TOKEN:=default_value}"
5351 echo "CONDA_TOKEN=$CONDA_TOKEN" >> $GITHUB_ENV
54-
55- # Conditionally add the --token and --user flags for stable branches
56- if [[ "${GITHUB_REF}" == "refs/heads/stable" ]]; then
57- conda-build --token "$CONDA_TOKEN" --user rmg .conda
58- else
59- conda-build .conda
60- fi
52+ conda config --add channels rmg
53+ conda config --add channels conda-forge
54+ CONDA_PY=${{ matrix.python-version }} conda build --token $CONDA_TOKEN --user rmg .
55+
56+ result :
57+ if : ${{ always() }}
58+ runs-on : ubuntu-latest
59+ name : Final Results
60+ needs : [build]
61+ steps :
62+ - run : exit 1
63+ # see https://github.com/orgs/community/discussions/26822?sort=new#discussioncomment-8285141
64+ if : ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }}
0 commit comments