chore(deps): update pre-commit hook psf/black to v24 #236
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: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Retrieve the source code | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 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 | |
mv $CONDA/conda-bld . | |
# This ensures the noarch repodata.json is not clobbered | |
if [ -d conda-bld/win-64 ]; then rm -rf conda-bld/noarch; fi | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3 | |
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: | |
shell: bash | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
cversion: ['4.11.0', '4.14.0', '23.7.3', '23.5.2', '23.3.1', '23.1.0', '22.11.1'] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Retrieve the source code | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Download build artfiacts | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3 | |
with: | |
name: conda-bld | |
path: ./conda-bld | |
- name: Build test environments | |
run: | | |
mv conda-bld $CONDA/ | |
source $CONDA/etc/profile.d/conda.sh | |
pkg=local::anaconda-anon-usage | |
conda install anaconda-client constructor conda-index $pkg | |
if [[ "${{ matrix.cversion }}" == 23.7.* ]]; then | |
mamba=conda-libmamba-solver | |
echo "MAMBA=yes" >> "$GITHUB_ENV" | |
fi | |
conda create -p ./testenv $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 package | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3 | |
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 |