Use proxy tester for better verification, and fix timeout support #545
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- main | |
concurrency: | |
# Concurrency group that uses the workflow name and PR number if available | |
# or commit SHA as a fallback. If a new build is triggered under that | |
# concurrency group while a previous build is running it will be canceled. | |
# Repeated pushes to a PR will cancel all previous builds, while multiple | |
# merges to main will not cancel. | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Retrieve the source code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Build the package | |
shell: bash | |
run: | | |
source $CONDA/etc/profile.d/conda.sh | |
conda install conda-build | |
conda build conda.recipe --no-test | |
mv $CONDA/conda-bld . | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4 | |
with: | |
if-no-files-found: error | |
name: conda-bld | |
path: conda-bld/ | |
test: | |
needs: build | |
env: | |
ANACONDA_ANON_USAGE_DEBUG: 1 | |
ANACONDA_ANON_USAGE_RAISE: 1 | |
defaults: | |
run: | |
# https://github.com/conda-incubator/setup-miniconda#use-a-default-shell | |
shell: bash -el {0} # bash exit immediately on error + login shell | |
strategy: | |
fail-fast: false | |
matrix: | |
# macos-13 defaults to osx-64, macos-14 defaults to osx-arm64 | |
os: [ubuntu-latest, macos-13, macos-14, windows-latest] | |
# 23.5.2 : last patch-based variant | |
# 23.7.0 : first plugin-based variant, but conda info --envs --json is broken | |
# 23.9.0 : last variant with the classic default solver | |
# 23.10.0 : first variant with the libmamba default solver | |
cversion: ['4.11.0', '4.14.0', '22.11.1', '23.5.2', '23.7.1', '23.9.0', '23.10.0', '24.11.3', '25.1.1'] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Retrieve the source code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Download build artfiacts | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4 | |
with: | |
name: conda-bld | |
path: conda-bld | |
- name: Setup Miniconda | |
uses: conda-incubator/setup-miniconda@505e6394dae86d6a5c7fbb6e3fb8938e3e863830 # v3.1.1 | |
with: | |
miniconda-version: 'latest' | |
auto-activate-base: true | |
activate-environment: "" | |
conda-solver: classic | |
- name: Build test environments | |
run: | | |
source $CONDA/etc/profile.d/conda.sh | |
conda config --add channels defaults | |
conda activate base | |
rm -rf $CONDA/conda-bld || : | |
mv conda-bld $CONDA/ | |
version=$(conda search local::anaconda-anon-usage | tail -1 | awk '{print $2}') | |
pkg="anaconda-anon-usage=$version" | |
conda install -c local anaconda-client constructor $pkg | |
conda create -p ./testenv -c local $pkg conda==${{ matrix.cversion }} --file tests/requirements.txt | |
mkdir -p ./testenv/envs | |
conda create -p ./testenv/envs/testchild1 python --yes | |
conda create -p ./testenv/envs/testchild2 python --yes | |
if [ -f ./testenv/Scripts/conda.exe ]; then \ | |
sed -i.bak "s@CONDA_EXE=.*@CONDA_EXE=$PWD/testenv/Scripts/conda.exe@" testenv/etc/profile.d/conda.sh; \ | |
fi | |
- name: Test code | |
run: | | |
source testenv/etc/profile.d/conda.sh | |
conda activate base | |
conda info 2>&1 | tee output.txt | |
if grep -q 'Error loading' output.txt; then exit -1; fi | |
pytest | |
python tests/integration/test_config.py | |
- name: Test heartbeats (pwsh) | |
if: matrix.os == 'windows-latest' && (matrix.cversion == '24.11.3' || matrix.cversion == '25.1.1') | |
shell: pwsh | |
run: | | |
.\testenv\shell\condabin\conda-hook.ps1 | |
conda activate base | |
python tests\integration\test_heartbeats.py powershell | |
- name: Test heartbeats (cmd) | |
if: matrix.os == 'windows-latest' && (matrix.cversion == '24.11.3' || matrix.cversion == '25.1.1') | |
shell: cmd | |
run: | | |
call .\testenv\Scripts\activate.bat | |
if %errorlevel% neq 0 exit 1 | |
python tests\integration\test_heartbeats.py cmd.exe | |
if %errorlevel% neq 0 exit 1 | |
- name: Test heartbeats (bash) | |
if: matrix.os != 'windows-latest' && (matrix.cversion == '24.11.3' || matrix.cversion == '25.1.1') | |
run: | | |
source ./testenv/bin/activate | |
conda info | |
python tests/integration/test_heartbeats.py posix | |
- name: Build an installer | |
run: | | |
cd tests/integration | |
export CONDA_PREFIX=$CONDA | |
bash test_installer.sh ${{ matrix.cversion }} | |
- name: Run the installer (Windows) | |
if: matrix.os == 'windows-latest' | |
shell: cmd | |
run: | | |
source $CONDA/bin/activate | |
cd tests/integration | |
start /wait AIDTest-1.0-Windows-x86_64.exe /S /D=%USERPROFILE%\aidtest | |
call %USERPROFILE%\aidtest\Scripts\activate | |
conda info | |
- name: Run the installer (Unix) | |
if: matrix.os != 'windows-latest' | |
run: | | |
cd tests/integration | |
bash AIDTest*.sh -b -p ~/aidtest -k | |
source ~/aidtest/bin/activate | |
conda info | |
- name: Test the installed environment | |
run: | | |
cd tests/integration | |
bash test_environment.sh ~/aidtest | |
upload: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download build artfiacts | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4 | |
with: | |
name: conda-bld | |
path: conda-bld | |
- name: Upload to anaconda.org | |
if: github.event_name == 'push' | |
env: | |
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} | |
GITHUB_REF: ${{ github.ref }} | |
run: | | |
source $CONDA/bin/activate | |
conda install anaconda-client | |
[[ "$GITHUB_REF" =~ ^refs/tags/ ]] || export LABEL="--label dev" | |
anaconda --verbose --token $ANACONDA_TOKEN upload --user ctools $LABEL conda-bld/*/*.tar.bz2 --force |