Skip to content

Commit

Permalink
Try this.
Browse files Browse the repository at this point in the history
  • Loading branch information
tsalo committed Jan 17, 2024
1 parent 8e90140 commit b0a122b
Showing 1 changed file with 103 additions and 97 deletions.
200 changes: 103 additions & 97 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,119 +1,125 @@
# Python CircleCI 2.1 configuration file
#
# Check https://circleci.com/docs/2.1/language-python/ for more details
#
version: 2.1
orbs:
codecov: codecov/[email protected]
jobs:
set_up_conda:
machine:
image: ubuntu-2004:202201-02

test_py38:
working_directory: /home/circleci/src/CuBIDS
docker:
- image: continuumio/miniconda3
steps:
- checkout:
path: /home/circleci/src/CuBIDS
- checkout
- run:
name: install miniconda
command: |
export MINICONDA=/tmp/miniconda
export PATH="$MINICONDA/bin:$PATH"
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh
bash /tmp/miniconda.sh -b -f -p $MINICONDA
conda config --set always_yes yes
conda update conda
conda info -a
conda create -n cubids python=3.9 pip
source activate cubids
conda install -c conda-forge -y datalad
# Add nodejs and the validator
conda install nodejs
npm install -g yarn && \
npm install -g bids-validator
- persist_to_workspace:
root: /tmp
paths:
- miniconda
name: Generate environment
command: |
conda create -n py38_env python=3.8 pip -yq
source activate py38_env
pip install -e .[tests]
- run:
name: Run tests
command: |
source activate py38_env
py.test --cov-append --cov-report=xml --cov=cubids cubids
mkdir /tmp/src/coverage
mv /home/circleci/src/CuBIDS/.coverage /tmp/src/coverage/.coverage.py38
run_pytests:
machine:
image: ubuntu-2004:202201-02
test_py39:
working_directory: /home/circleci/src/CuBIDS
docker:
- image: continuumio/miniconda3
steps:
- checkout:
path: /home/circleci/src/CuBIDS

- attach_workspace:
at: /tmp

- checkout
- run:
name: Test CuBIDS
command: |
export PATH=/tmp/miniconda/bin:$PATH
source activate cubids
# Install CuBIDS
name: Generate environment
command: |
conda create -n py39_env python=3.9 pip -yq
source activate py39_env
pip install -e .[tests]
- run:
name: Run tests
command: |
source activate py39_env
py.test --cov-append --cov-report=xml --cov=cubids cubids
mkdir /tmp/src/coverage
mv /home/circleci/src/CuBIDS/.coverage /tmp/src/coverage/.coverage.py39
# Reinstall bids-validator
sudo apt update
sudo apt install nodejs npm
npm install -g yarn && \
npm install -g bids-validator
# Run tests
pytest cubids
deployable:
test_py310:
working_directory: /home/circleci/src/CuBIDS
docker:
- image: busybox:latest
- image: continuumio/miniconda3
steps:
- run: echo Deploying!
- checkout
- run:
name: Generate environment
command: |
conda create -n py310_env python=3.10 pip -yq
source activate py310_env
pip install -e .[tests]
- run:
name: Run tests
command: |
source activate py310_env
py.test --cov-append --cov-report=xml --cov=cubids cubids
mkdir /tmp/src/coverage
mv /home/circleci/src/CuBIDS/.coverage /tmp/src/coverage/.coverage.py310
deploy_pypi:
machine:
image: ubuntu-2004:202201-02
working_directory: /tmp/src/CuBIDS
test_py311:
working_directory: /home/circleci/src/CuBIDS
docker:
- image: continuumio/miniconda3
steps:
- checkout:
path: /home/circleci/src/CuBIDS
- checkout
- run:
name: Generate distribution archives
command: |
python3 -m pip install --upgrade build
python3 -m build
name: Generate environment
command: |
conda create -n py311_env python=3.11 pip -yq
source activate py311_env
pip install -e .[tests]
- run:
name: Run tests
command: |
source activate py311_env
py.test --cov-append --cov-report=xml --cov=cubids cubids
mkdir /tmp/src/coverage
mv /home/circleci/src/CuBIDS/.coverage /tmp/src/coverage/.coverage.py311
merge_coverage:
working_directory: /home/circleci/src/CuBIDS
docker:
- image: continuumio/miniconda3
steps:
- attach_workspace:
at: /tmp
- checkout
- run:
name: Upload packages to PyPI
name: Merge coverage files
command: |
python3 -m pip install --upgrade twine
python3 -m twine upload dist/*
apt-get update
apt-get install -yqq curl
source activate py37_env
cd /tmp/src/coverage/
coverage combine
coverage xml
- store_artifacts:
path: /tmp/src/coverage
- codecov/upload:
file: /tmp/src/coverage/coverage.xml

workflows:
version: 2
build_test_deploy:
version: 2.1
run_tests:
jobs:
- set_up_conda:
filters:
tags:
only: /.*/

- run_pytests:
requires:
- set_up_conda
filters:
tags:
only: /.*/

- deployable:
requires:
- run_pytests
filters:
branches:
only: main
tags:
only: /.*/

- deploy_pypi:
- test_py38
- test_py39
- test_py310
- test_py311
- merge_coverage:
requires:
- deployable
filters:
branches:
only: main
tags:
only: /.*/
- test_py38
- test_py39
- test_py310
- test_py311

0 comments on commit b0a122b

Please sign in to comment.