chore(deps): update pre-commit hook asottile/pyupgrade to v3.19.1 #448
Workflow file for this run
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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # 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.9.2'] | |
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@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0 | |
with: | |
miniconda-version: 'latest' | |
auto-activate-base: true | |
activate-environment: "" | |
conda-solver: classic | |
- name: Build test environments | |
run: | | |
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 | |
if [[ "${{ matrix.cversion }}" == 23.7.* ]]; then | |
mamba=conda-libmamba-solver | |
echo "MAMBA=yes" >> "$GITHUB_ENV" | |
fi | |
conda create -p ./testenv -c local $pkg conda==${{ matrix.cversion }} $mamba --file tests/requirements.txt | |
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 environments (Windows) | |
if: matrix.os == 'windows-latest' | |
shell: cmd | |
run: | | |
call testenv\Scripts\activate | |
conda info 1>output.txt 2>&1 | type output.txt | |
find "Error loading" output.txt >nul | |
if %errorlevel% equ 0 exit -1 | |
conda create -n testchild1 --yes | |
conda create -n testchild2 --yes | |
python tests\integration\test_config.py | |
if "%MAMBA%" equ "yes" ( | |
conda config --set solver libmamba | |
python tests\integration\test_config.py | |
conda config --set solver classic | |
) | |
- name: Test code (Windows) | |
if: matrix.os == 'windows-latest' | |
shell: cmd | |
run: | | |
call testenv\Scripts\activate | |
pytest | |
- name: Test environments (Unix) | |
if: matrix.os != 'windows-latest' | |
run: | | |
source ./testenv/bin/activate | |
conda info 2>&1 | tee output.txt | |
if grep -q 'Error loading' output.txt; then exit -1; fi | |
python tests/integration/test_config.py | |
if [ "$MAMBA" = "yes" ]; then | |
conda config --set solver libmamba | |
python tests/integration/test_config.py | |
conda config --set solver classic | |
fi | |
- name: Test code (Unix) | |
if: matrix.os != 'windows-latest' | |
run: | | |
source ./testenv/bin/activate | |
pytest | |
- 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: | | |
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 |