A shareable package of CircleCI configuration to integrate with psyplot-ci-orb, written by psyplot
CommunityUse CircleCI version 2.1 at the top of your .circleci/config.yml file.
1
version: 2.1Add the orbs stanza below your version, invoking the orb:
1
2
orbs:
psyplot-ci-orb: psyplot/psyplot-ci-orb@1.5.33Use psyplot-ci-orb elements in your existing workflows and jobs.
Opt-in to use of uncertified orbs on your organization’s Security settings page.
Sample example description.
1
2
3
4
5
6
7
version: '2.1'
orbs:
<orb-name>: <namespace>/<orb-name>@1.2.3
workflows:
use-my-orb:
jobs:
- <orb-name>/<job-name>
Install and build the conda package
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
build_dir Directory where to build the docs | Directory where to build the docs | No | docs/_build type: string | string |
builders Builders to use | Builders to use | No | html linkcheck type: string | string |
conda_env Name of the conda environment | Name of the conda environment | No | docs type: string | string |
condadir Install location for anaconda | Install location for anaconda | No | ~/miniconda3 type: string | string |
environment_file Path to a conda environment file to install additional packages. Must install sphinx, too. If this is empty (or the default file does not exist), we will assume that everything is installed alread in the base conda environment.
| Path to a conda environment file to install additional packages. Must install sphinx, too. If this is empty (or the default file does not exist), we will assume that everything is installed alread in the base conda environment.
| No | docs/environment.yml type: string | string |
exec_environment Set a custom executor for your job testing environment. By defeault the machine image will be used. Use "macos" for building on OS X. | Set a custom executor for your job testing environment. By defeault the machine image will be used. Use "macos" for building on OS X. | No | default type: executor | executor |
packages Extra packages to install | Extra packages to install | No | '' type: string | string |
run-job Whether to run the job or stop it. | Whether to run the job or stop it. | No | true type: boolean | boolean |
source Directory with the sphinx source files (i.e. with conf.py). | Directory with the sphinx source files (i.e. with conf.py). | No | docs type: string | string |
workspace A workspace to attach. Attach none if empty. | A workspace to attach. Attach none if empty. | No | '~' type: string | string |
Create a new tag in the git repository
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
checkout Whether to perform the CircleCI checkout step.
| Whether to perform the CircleCI checkout step.
| No | true type: boolean | boolean |
draft-release Whether to create the release as a draft or publish it directly.
| Whether to create the release as a draft or publish it directly.
| No | true type: boolean | boolean |
exec_environment Set a custom executor for your job testing environment. By defeault the machine image will be used. Use "macos" for building on OS X. | Set a custom executor for your job testing environment. By defeault the machine image will be used. Use "macos" for building on OS X. | No | default type: executor | executor |
github-token The Github API Token to use. If not set, we use the GITHUB_TOKEN environment variable
| The Github API Token to use. If not set, we use the GITHUB_TOKEN environment variable
| No | '' type: string | string |
publish-release Publish the created tag as release on github
Required | Publish the created tag as release on github
| Yes | - type: boolean | boolean |
publish-version-tag Push a git tag describing the release that was just published? If `true`, make sure to pass SSH fingerprints, as well
Required | Push a git tag describing the release that was just published? If `true`, make sure to pass SSH fingerprints, as well
| Yes | - type: boolean | boolean |
run-job Whether to run the job or stop it. | Whether to run the job or stop it. | No | true type: boolean | boolean |
ssh-fingerprints The fingerprint of the SSH key to use for pushing to github | The fingerprint of the SSH key to use for pushing to github | No | '' type: string | string |
tag-prefix The prefix to use for the tag | The prefix to use for the tag | No | v type: string | string |
user-name Override git user name.
| Override git user name.
| No | '' type: string | string |
workspace A workspace to attach. Attach none if empty. | A workspace to attach. Attach none if empty. | No | '~' type: string | string |
Install and build the conda package
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
condadir Install location for anaconda | Install location for anaconda | No | ~/miniconda3 type: string | string |
deploy_dir The docs to deploy | The docs to deploy | No | docs/_build/html type: string | string |
dry_run Do not change anything on Github, just do a dry run | Do not change anything on Github, just do a dry run | No | false type: boolean | boolean |
exec_environment Set a custom executor for your job testing environment. By defeault the machine image will be used. Use "macos" for building on OS X. | Set a custom executor for your job testing environment. By defeault the machine image will be used. Use "macos" for building on OS X. | No | default type: executor | executor |
fingerprint The ssh fingerprint used for deploying to github pages Required | The ssh fingerprint used for deploying to github pages | Yes | - type: string | string |
run-job Whether to run the job or stop it. | Whether to run the job or stop it. | No | true type: boolean | boolean |
target_branch The branch in the git repository to deploy to
| The branch in the git repository to deploy to
| No | gh-pages type: string | string |
workspace A workspace to attach. Attach none if empty. | A workspace to attach. Attach none if empty. | No | '~' type: string | string |
Install and build the conda package
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
branch_label Use the branch name as a label for the anaconda channel | Use the branch name as a label for the anaconda channel | No | true type: boolean | boolean |
build_pkg Build the package prior to deployment | Build the package prior to deployment | No | false type: boolean | boolean |
build_tool The build tool to use (default mamba) | The build tool to use (default mamba) | No | mamba type: string | string |
channels Further default channels for conda | Further default channels for conda | No | conda-forge type: string | string |
checkout Do a checkout | Do a checkout | No | false type: boolean | boolean |
condadir Install location for anaconda | Install location for anaconda | No | ~/miniconda3 type: string | string |
dry_run Do not change anything on anaconda, just do a dry run | Do not change anything on anaconda, just do a dry run | No | false type: boolean | boolean |
exec_environment Set a custom executor for your job testing environment. By defeault the machine image will be used. Use "macos" for building on OS X. | Set a custom executor for your job testing environment. By defeault the machine image will be used. Use "macos" for building on OS X. | No | default type: executor | executor |
install Install conda prior to deployment | Install conda prior to deployment | No | false type: boolean | boolean |
label The channel label to deploy to | The channel label to deploy to | No | main type: string | string |
python_version Python version | Python version | No | '3.8' type: string | string |
recipe_append The full content for recipe_append.yml | The full content for recipe_append.yml | No | '' type: string | string |
recipe_dir Path to the recipe to build relative to the project directory | Path to the recipe to build relative to the project directory | No | ci/conda-recipe type: string | string |
run-job Whether to run the job or stop it. | Whether to run the job or stop it. | No | true type: boolean | boolean |
token Anaconda API token. This should be set through a context on CircleCI. If this is not set, we'll assume it's $BINSTAR_API_TOKEN or $ANACONDA_API_TOKEN
| Anaconda API token. This should be set through a context on CircleCI. If this is not set, we'll assume it's $BINSTAR_API_TOKEN or $ANACONDA_API_TOKEN
| No | '' type: string | string |
workspace A workspace to attach. Attach none if empty. | A workspace to attach. Attach none if empty. | No | '~' type: string | string |
Test the dist for pypi via twine check
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
checkout Do a checkout | Do a checkout | No | false type: boolean | boolean |
condadir Install location for anaconda | Install location for anaconda | No | ~/miniconda3 type: string | string |
dry_run Do not make an upload, only a dry run | Do not make an upload, only a dry run | No | false type: boolean | boolean |
pypi_password User password for pypi upload. We recomment to set this via the TWINE_PASSWORD environment variable in a context.
| User password for pypi upload. We recomment to set this via the TWINE_PASSWORD environment variable in a context.
| No | '' type: string | string |
pypi_user User name for pypi upload. We recomment to set this via the TWINE_USERNAME environment variable.
| User name for pypi upload. We recomment to set this via the TWINE_USERNAME environment variable.
| No | '' type: string | string |
run-job Whether to run the job or stop it. | Whether to run the job or stop it. | No | true type: boolean | boolean |
workspace A workspace to attach. Attach none if empty. | A workspace to attach. Attach none if empty. | No | '~' type: string | string |
Install and build the conda package
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
build_args Additional command line arguments for conda-build | Additional command line arguments for conda-build | No | '' type: string | string |
build_dir Directory where to build the docs | Directory where to build the docs | No | docs/_build type: string | string |
build_docs Build the documentation | Build the documentation | No | true type: boolean | boolean |
build_output The output directory for the build | The output directory for the build | No | linux-64 type: enum | enum |
build_recipe Build the conda recipe | Build the conda recipe | No | true type: boolean | boolean |
build_tool The build tool to use (default mamba) | The build tool to use (default mamba) | No | mamba type: string | string |
builders Builders to use | Builders to use | No | html type: string | string |
channels Further default channels for conda | Further default channels for conda | No | conda-forge type: string | string |
checkout Do a checkout | Do a checkout | No | true type: boolean | boolean |
conda_env Name of the conda environment for the tests | Name of the conda environment for the tests | No | test type: string | string |
condadir Install location for anaconda. Must end with miniconda3! | Install location for anaconda. Must end with miniconda3! | No | ~/miniconda3 type: string | string |
default_branch Default branch channel for conda | Default branch channel for conda | No | develop type: string | string |
docs_conda_env Name of the conda environment for building the docs | Name of the conda environment for building the docs | No | docs type: string | string |
docs_environment Path to a conda environment file to install additional packages. Must install sphinx, too. If this is empty (or the default file does not exist), we will assume that everything is installed alread in the base conda environment.
| Path to a conda environment file to install additional packages. Must install sphinx, too. If this is empty (or the default file does not exist), we will assume that everything is installed alread in the base conda environment.
| No | docs/environment.yml type: string | string |
env_packages Extra packages to install | Extra packages to install | No | '' type: string | string |
environment_file Path to the conda environment file | Path to the conda environment file | No | ci/environment.yml type: string | string |
exec_environment Set a custom executor for your job testing environment. By defeault the machine image will be used. | Set a custom executor for your job testing environment. By defeault the machine image will be used. | No | default type: executor | executor |
install_opengl Whether to install opengl (necessary for GUI-based applications) or not
| Whether to install opengl (necessary for GUI-based applications) or not
| No | true type: boolean | boolean |
main_channel Main channel to use with channels and for the branches | Main channel to use with channels and for the branches | No | psyplot type: string | string |
packages Extra packages to install into the base environment | Extra packages to install into the base environment | No | conda-build anaconda-client conda-verify type: string | string |
python_version Python version | Python version | No | '3.8' type: string | string |
recipe_append The full content for recipe_append.yml | The full content for recipe_append.yml | No | '' type: string | string |
recipe_dir Path to the recipe to build relative to the project directory | Path to the recipe to build relative to the project directory | No | ci/conda-recipe type: string | string |
run-job Whether to run the job or stop it. | Whether to run the job or stop it. | No | true type: boolean | boolean |
setup_env Setup a conda environment with the build package | Setup a conda environment with the build package | No | true type: boolean | boolean |
source Directory with the sphinx source files (i.e. with conf.py). | Directory with the sphinx source files (i.e. with conf.py). | No | docs type: string | string |
test_dist Build and test the python package with setuptools and twine | Build and test the python package with setuptools and twine | No | true type: boolean | boolean |
workspace A workspace to attach. Attach none if empty. | A workspace to attach. Attach none if empty. | No | '~' type: string | string |
Install and build the conda package
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
build_refs Build reference figures | Build reference figures | No | false type: boolean | boolean |
codecov Upload test results to codecov.io | Upload test results to codecov.io | No | true type: boolean | boolean |
conda_env Name of the conda environment | Name of the conda environment | No | test type: string | string |
condadir Install location for anaconda. Must end with miniconda3! | Install location for anaconda. Must end with miniconda3! | No | ~/miniconda3 type: string | string |
exec_environment Set a custom executor for your job testing environment. By defeault the machine image will be used. | Set a custom executor for your job testing environment. By defeault the machine image will be used. | No | default type: executor | executor |
packages Extra packages to install | Extra packages to install | No | '' type: string | string |
parallelism How many parallel jobs to execute | How many parallel jobs to execute | No | 4 type: integer | integer |
pytest_args Any arguments passed to the pytest call | Any arguments passed to the pytest call | No | '' type: string | string |
reference_figures Path to the reference figures | Path to the reference figures | No | tests/reference_figures type: string | string |
run-job Whether to run the job or stop it. | Whether to run the job or stop it. | No | true type: boolean | boolean |
test_dir Path to the test directory | Path to the test directory | No | tests type: string | string |
test_figures Path to the test figures | Path to the test figures | No | tests/test_figures type: string | string |
test_upload_dir Path to the directory where to store XML test files | Path to the directory where to store XML test files | No | test-results type: string | string |
workspace A workspace to attach. Attach none if empty. | A workspace to attach. Attach none if empty. | No | '~' type: string | string |
Trigger a new release workflow.
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
checkout Checkout as a first step? Default is true
| Checkout as a first step? Default is true
| No | true type: boolean | boolean |
pipeline-param-map Map of pipeline parameters that the new pipeline will be invoked with. Make use of this to target the release workflow that should be triggered and exclude other workflows from being triggered.
| Map of pipeline parameters that the new pipeline will be invoked with. Make use of this to target the release workflow that should be triggered and exclude other workflows from being triggered.
| No | '{\"deploy-release\": true}' type: string | string |
run-job Whether to run the job or stop it. | Whether to run the job or stop it. | No | true type: boolean | boolean |
token-variable Name of environment variable containing your personal CircleCI API token
| Name of environment variable containing your personal CircleCI API token
| No | CIRCLE_TOKEN type: env_var_name | env_var_name |
Build the docs with sphinx
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
build_dir Directory where to build the docs | Directory where to build the docs | No | docs/_build type: string | string |
builders Builders to use | Builders to use | No | html linkcheck type: string | string |
conda_env Name of the conda environment | Name of the conda environment | No | docs type: string | string |
condadir Install location for anaconda | Install location for anaconda | No | ~/miniconda3 type: string | string |
environment_file Path to a conda environment file to install additional packages. Must install sphinx, too. If this is empty (or the default file does not exist), we will assume that everything is installed alread in the base conda environment.
| Path to a conda environment file to install additional packages. Must install sphinx, too. If this is empty (or the default file does not exist), we will assume that everything is installed alread in the base conda environment.
| No | docs/environment.yml type: string | string |
packages Extra packages to install | Extra packages to install | No | '' type: string | string |
source Directory with the sphinx source files (i.e. with conf.py). | Directory with the sphinx source files (i.e. with conf.py). | No | docs type: string | string |
Build the conda recipe
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
build_args Additional command line arguments for conda-build | Additional command line arguments for conda-build | No | '' type: string | string |
build_output The output directory for the build | The output directory for the build | No | linux-64 type: enum | enum |
build_tool The build tool to use (default mamba) | The build tool to use (default mamba) | No | mamba type: string | string |
condadir Install location for anaconda | Install location for anaconda | No | ~/miniconda3 type: string | string |
python_version Python version | Python version | No | '3.8' type: string | string |
recipe_dir Path to the recipe to build relative to the project directory | Path to the recipe to build relative to the project directory | No | ci/conda-recipe type: string | string |
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
file Path to the code coverage data file to upload. | Path to the code coverage data file to upload. | No | .coverage type: string | string |
flags Flag the upload to group coverage metrics (e.g. unittests | integration | ui,chrome) | Flag the upload to group coverage metrics (e.g. unittests | integration | ui,chrome) | No | '' type: string | string |
token Set the private repository token as the value of the variable CODECOV_TOKEN using CircleCI Environment Variables. | Set the private repository token as the value of the variable CODECOV_TOKEN using CircleCI Environment Variables. | No | CODECOV_TOKEN type: env_var_name | env_var_name |
upload_name Custom defined name of the upload. Visible in Codecov UI | Custom defined name of the upload. Visible in Codecov UI | No | ${CIRCLE_BUILD_NUM} type: string | string |
validate Validate the uploader before uploading the codecov result. | Validate the uploader before uploading the codecov result. | No | true type: boolean | boolean |
version Which version of the Codecov Uploader to use (defaults to 'latest') | Which version of the Codecov Uploader to use (defaults to 'latest') | No | latest type: string | string |
when When should this step run? | When should this step run? | No | always type: string | string |
xtra_args Any extra flags as provided by the bash uploader (e.g. `-v -Z`). | Any extra flags as provided by the bash uploader (e.g. `-v -Z`). | No | '' type: string | string |
List a conda environment
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
conda_env Name of the conda environment | Name of the conda environment | No | test type: string | string |
condadir Install location for anaconda | Install location for anaconda | No | ~/miniconda3 type: string | string |
Configure miniconda
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
branch_label Use the branch name as a label for the anaconda channel | Use the branch name as a label for the anaconda channel | No | true type: boolean | boolean |
channels Further default channels for conda | Further default channels for conda | No | conda-forge type: string | string |
condadir Install location for anaconda | Install location for anaconda | No | ~/miniconda3 type: string | string |
default_branch Default branch channel for conda | Default branch channel for conda | No | develop type: string | string |
main_channel Main channel to use with channels and for the branches | Main channel to use with channels and for the branches | No | psyplot type: string | string |
orb_version Version for the python deploy package to use. See https://anaconda.org/psyplot/psyplot-ci-orb
| Version for the python deploy package to use. See https://anaconda.org/psyplot/psyplot-ci-orb
| No | 1.5.33 type: string | string |
packages Extra packages to install into the base environment | Extra packages to install into the base environment | No | conda-build=3.25.* anaconda-client conda-verify type: string | string |
Sets mandatory git config fields to allow creating and pushing of tags. If not set it will default to details from the VCS system, composed from the $CIRCLE_USERNAME variable. If both parameters are set, they will be used instead. This command has been taken from the official orb-tools-orb at https://github.com/CircleCI-Public/orb-tools-orb/releases/tag/v10.0.5
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
user-name Override git user name.
| Override git user name.
| No | '' type: string | string |
Configure the recipe with extra options
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
recipe_append The full content for recipe_append.yml Required | The full content for recipe_append.yml | Yes | - type: string | string |
recipe_dir Path to the recipe to build relative to the project directory | Path to the recipe to build relative to the project directory | No | ci/conda-recipe type: string | string |
Create a new tag in the git repository
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
draft Whether to create a draft release or not. | Whether to create a draft release or not. | No | true type: boolean | boolean |
token The Github API Token to use. If not set, we use the GITHUB_TOKEN environment variable | The Github API Token to use. If not set, we use the GITHUB_TOKEN environment variable | No | '' type: string | string |
Create a new tag in the git repository
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
tag-prefix The prefix to use for the tag | The prefix to use for the tag | No | v type: string | string |
Deploy the docs to Github Pages
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
condadir Install location for anaconda | Install location for anaconda | No | ~/miniconda3 type: string | string |
deploy_dir The docs to deploy | The docs to deploy | No | docs/_build/html type: string | string |
dry_run Do not change anything on Github, just do a dry run | Do not change anything on Github, just do a dry run | No | false type: boolean | boolean |
fingerprint The ssh fingerprint used for deploying to github pages Required | The ssh fingerprint used for deploying to github pages | Yes | - type: string | string |
target_branch The branch in the git repository to deploy to
| The branch in the git repository to deploy to
| No | gh-pages type: string | string |
Deploy the conda to anaconda. Note that you need a Context with an ANACONDA_API_TOKEN variable set or use the token parameter.
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
branch_label Use the branch name as a label for the anaconda channel | Use the branch name as a label for the anaconda channel | No | true type: boolean | boolean |
condadir Install location for anaconda | Install location for anaconda | No | ~/miniconda3 type: string | string |
dry_run Do not change anything on anaconda, just do a dry run | Do not change anything on anaconda, just do a dry run | No | false type: boolean | boolean |
label The channel label to deploy to | The channel label to deploy to | No | main type: string | string |
orb_version Version for the python deploy package to use. See https://anaconda.org/psyplot/psyplot-ci-orb
| Version for the python deploy package to use. See https://anaconda.org/psyplot/psyplot-ci-orb
| No | 1.5.33 type: string | string |
python_version Python version | Python version | No | '3.8' type: string | string |
recipe_dir Path to the recipe to build relative to the project directory | Path to the recipe to build relative to the project directory | No | ci/conda-recipe type: string | string |
token Anaconda API token. This should be set through a context on CircleCI. If this is not set, we'll assume it's $BINSTAR_API_TOKEN or $ANACONDA_API_TOKEN
| Anaconda API token. This should be set through a context on CircleCI. If this is not set, we'll assume it's $BINSTAR_API_TOKEN or $ANACONDA_API_TOKEN
| No | '' type: string | string |
Upload the python package to pypi.io
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
condadir Install location for anaconda | Install location for anaconda | No | ~/miniconda3 type: string | string |
dry_run Do not make an upload, only a dry run | Do not make an upload, only a dry run | No | false type: boolean | boolean |
pypi_password User password for pypi upload. We recomment to set this via the TWINE_PASSWORD environment variable in a context.
| User password for pypi upload. We recomment to set this via the TWINE_PASSWORD environment variable in a context.
| No | '' type: string | string |
pypi_user User name for pypi upload. We recomment to set this via the TWINE_USERNAME environment variable.
| User name for pypi upload. We recomment to set this via the TWINE_USERNAME environment variable.
| No | '' type: string | string |
Install and build the conda package
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
branch_label Use the branch name as a label for the anaconda channel | Use the branch name as a label for the anaconda channel | No | true type: boolean | boolean |
channels Further default channels for conda | Further default channels for conda | No | conda-forge type: string | string |
checkout Do a checkout | Do a checkout | No | true type: boolean | boolean |
condadir Install location for anaconda | Install location for anaconda | No | ~/miniconda3 type: string | string |
default_branch Default branch channel for conda | Default branch channel for conda | No | develop type: string | string |
install_opengl Whether to install opengl (necessary for GUI-based applications) or not
| Whether to install opengl (necessary for GUI-based applications) or not
| No | true type: boolean | boolean |
main_channel Main channel to use with channels and for the branches | Main channel to use with channels and for the branches | No | psyplot type: string | string |
packages Extra packages to install into the base environment | Extra packages to install into the base environment | No | conda-build anaconda-client conda-verify type: string | string |
Setup linux environment and install miniconda
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
condadir Install location for anaconda | Install location for anaconda | No | ~/miniconda3 type: string | string |
"Install openGL for GUI-based applications (such as psyplot-gui or psy-view)"
Run tests in parallel using circleci
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
conda_env Name of the conda environment | Name of the conda environment | No | test type: string | string |
condadir Install location for anaconda | Install location for anaconda | No | ~/miniconda3 type: string | string |
packages Extra packages to install Required | Extra packages to install | Yes | - type: string | string |
Command to run jobs conditionally
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
run-job Whether to run the job or stop it. | Whether to run the job or stop it. | No | true type: boolean | boolean |
Run tests in parallel using circleci
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
build_refs Build reference figures | Build reference figures | No | false type: boolean | boolean |
conda_env Name of the conda environment | Name of the conda environment | No | test type: string | string |
condadir Install location for anaconda | Install location for anaconda | No | ~/miniconda3 type: string | string |
pytest_args Any arguments passed to the pytest call | Any arguments passed to the pytest call | No | '' type: string | string |
reference_figures Path to the reference figures | Path to the reference figures | No | tests/reference_figures type: string | string |
test_dir Path to the test directory | Path to the test directory | No | tests type: string | string |
test_figures Path to the test figures | Path to the test figures | No | tests/test_figures type: string | string |
test_upload_dir Path to the directory where to store XML test files | Path to the directory where to store XML test files | No | test-results type: string | string |
Setup a conda environment
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
conda_env Name of the conda environment | Name of the conda environment | No | test type: string | string |
condadir Install location for anaconda | Install location for anaconda | No | ~/miniconda3 type: string | string |
environment_file Path to the conda environment file | Path to the conda environment file | No | ci/environment.yml type: string | string |
packages Extra packages to install | Extra packages to install | No | '' type: string | string |
python_version Python version to use. This does only have an effect if we do not use an environment file. | Python version to use. This does only have an effect if we do not use an environment file. | No | '3.8' type: string | string |
recipe_dir Path to the recipe to build relative to the project directory | Path to the recipe to build relative to the project directory | No | ci/conda-recipe type: string | string |
Test the dist for pypi via twine check
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
condadir Install location for anaconda | Install location for anaconda | No | ~/miniconda3 type: string | string |
Check whether the commit message suggests a new release and if so, cancel the workflow.
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
checkout Checkout as a first step? Default is true
| Checkout as a first step? Default is true
| No | true type: boolean | boolean |
pipeline-param-map Map of pipeline parameters that the new pipeline will be invoked with. Make use of this to target the release workflow that should be triggered and exclude other workflows from being triggered.
| Map of pipeline parameters that the new pipeline will be invoked with. Make use of this to target the release workflow that should be triggered and exclude other workflows from being triggered.
| No | '{\"deploy-release\": true}' type: string | string |
token-variable Name of environment variable containing your personal CircleCI API token
| Name of environment variable containing your personal CircleCI API token
| No | CIRCLE_TOKEN type: env_var_name | env_var_name |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
# This code is licensed from CircleCI to the user under the MIT license.
# See here for details: https://circleci.com/developer/orbs/licensing
version: 2.1
description: |
Orb for managing packages within the psyplot visualization framework.
This orb offers installation and automatic building of conda packages, as well as an automated build of Sphinx documentations and an upload to Github Pages
display:
home_url: https://psyplot.github.io
source_url: https://www.github.com/psyplot/psyplot-ci-orb
commands:
build-docs:
description: Build the docs with sphinx
parameters:
build_dir:
default: docs/_build
description: Directory where to build the docs
type: string
builders:
default: html linkcheck
description: Builders to use
type: string
conda_env:
default: docs
description: Name of the conda environment
type: string
condadir:
default: ~/miniconda3
description: Install location for anaconda
type: string
environment_file:
default: docs/environment.yml
description: |
Path to a conda environment file to install additional packages. Must install sphinx, too. If this is empty (or the default file does not exist), we will assume that everything is installed alread in the base conda environment.
type: string
packages:
default: ""
description: Extra packages to install
type: string
source:
default: docs
description: Directory with the sphinx source files (i.e. with conf.py).
type: string
steps:
- setup-conda-env:
conda_env: <<parameters.conda_env>>
condadir: <<parameters.condadir>>
environment_file: <<parameters.environment_file>>
packages: <<parameters.packages>>
- run:
command: |-
#!/bin/bash
build-docs() {
CONDADIR=$(eval echo "$CONDADIR")
which conda || eval "$("${CONDADIR}"/bin/conda shell.bash hook)"
conda activate "${CONDAENV_NAME}"
WORKDIR="$(pwd)"
cd "${SRC_DIR}" || exit 1
# shellcheck disable=SC2086,SC2153
for BUILDER in ${BUILDERS}; do
sphinx-build -b "${BUILDER}" -d "${WORKDIR}/${BUILD_DIR}/doctrees" . "${WORKDIR}/${BUILD_DIR}/${BUILDER}"
done
cd "${WORKDIR}" || exit 1
conda deactivate
}
# Will not run if sourced for bats-core tests.
# View src/tests for more information.
ORB_TEST_ENV="bats-"
if [ "${0#*"$ORB_TEST_ENV"}" = "$0" ]; then
build-docs
fi
environment:
BUILD_DIR: <<parameters.build_dir>>
BUILDERS: <<parameters.builders>>
CONDADIR: <<parameters.condadir>>
CONDAENV_NAME: <<parameters.conda_env>>
SRC_DIR: <<parameters.source>>
name: Build documentation
- store_artifacts:
destination: docs
path: <<parameters.build_dir>>
build-recipe:
description: Build the conda recipe
parameters:
build_args:
default: ""
description: Additional command line arguments for conda-build
type: string
build_output:
default: linux-64
description: The output directory for the build
enum:
- linux-64
- osx-64
type: enum
build_tool:
default: mamba
description: The build tool to use (default mamba)
type: string
condadir:
default: ~/miniconda3
description: Install location for anaconda
type: string
python_version:
default: "3.8"
description: Python version
type: string
recipe_dir:
default: ci/conda-recipe
description: Path to the recipe to build relative to the project directory
type: string
steps:
- run:
command: |-
#!/bin/bash
build-recipe() {
CONDADIR=$(eval echo "$CONDADIR")
which conda || eval "$("${CONDADIR}"/bin/conda shell.bash hook)"
# shellcheck disable=SC2086
${BUILD_TOOL} build "${RECIPEDIR}" --python "${PYTHON_VERSION}" ${EXTRA_ARGS}
}
# Will not run if sourced for bats-core tests.
# View src/tests for more information.
ORB_TEST_ENV="bats-"
if [ "${0#*"$ORB_TEST_ENV"}" = "$0" ]; then
build-recipe
fi
environment:
BUILD_TOOL: <<parameters.build_tool>>
CONDADIR: <<parameters.condadir>>
EXTRA_ARGS: <<parameters.build_args>>
PYTHON_VERSION: <<parameters.python_version>>
RECIPEDIR: <<parameters.recipe_dir>>
name: Build recipe
- store_artifacts:
destination: conda-bld
path: <<parameters.condadir>>/conda-bld/<<parameters.build_output>>
codecov:
parameters:
file:
default: .coverage
description: Path to the code coverage data file to upload.
type: string
flags:
default: ""
description: Flag the upload to group coverage metrics (e.g. unittests | integration | ui,chrome)
type: string
token:
default: CODECOV_TOKEN
description: Set the private repository token as the value of the variable CODECOV_TOKEN using CircleCI Environment Variables.
type: env_var_name
upload_name:
default: ${CIRCLE_BUILD_NUM}
description: Custom defined name of the upload. Visible in Codecov UI
type: string
validate:
default: true
description: Validate the uploader before uploading the codecov result.
type: boolean
version:
default: latest
description: Which version of the Codecov Uploader to use (defaults to 'latest')
type: string
when:
default: always
description: When should this step run?
type: string
xtra_args:
default: ""
description: Any extra flags as provided by the bash uploader (e.g. `-v -Z`).
type: string
steps:
- run:
command: |
family=$(uname -s | tr '[:upper:]' '[:lower:]')
os="windows"
[[ $family == "darwin" ]] && os="macos"
[[ $family == "linux" ]] && os="linux"
echo "Detected ${os}"
echo "export os=${os}" >> $BASH_ENV
filename="codecov"
[[ $os == "windows" ]] && filename+=".exe"
echo "export filename=${filename}" >> $BASH_ENV
[[ $os == "macos" ]] && brew install gpg
curl -Os "https://uploader.codecov.io/<< parameters.version >>/${os}/${filename}"
name: Download Codecov Uploader
when: << parameters.when >>
- when:
condition: << parameters.validate >>
steps:
- run:
command: |
curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --import # One-time step
curl -Os "https://uploader.codecov.io/<< parameters.version >>/${os}/${filename}.SHA256SUM"
curl -Os "https://uploader.codecov.io/<< parameters.version >>/${os}/${filename}.SHA256SUM.sig"
gpg --verify $filename.SHA256SUM.sig $filename.SHA256SUM
shasum -a 256 -c $filename.SHA256SUM || sha256sum -c $filename.SHA256SUM
name: Validate Codecov Uploader
- run:
command: |
chmod +x $filename
args=()
[[ -n "<< parameters.file >>" ]] && args+=( '-f << parameters.file >>' )
[[ -n "<< parameters.xtra_args >>" ]] && args+=( '<< parameters.xtra_args >>' )
curl -H "Accept: application/json" "https://uploader.codecov.io/${os}/<< parameters.version >>" | grep -o '\"version\":\"v[0-9\.\_]\+\"' | head -1
./$filename \
-Q "codecov-circleci-orb-3.1.0" \
-t "${<< parameters.token >>}" \
-n "<< parameters.upload_name >>" \
-F "<< parameters.flags >>" \
${args[@]}
name: Upload Coverage Results
conda-list:
description: |
List a conda environment
parameters:
conda_env:
default: test
description: Name of the conda environment
type: string
condadir:
default: ~/miniconda3
description: Install location for anaconda
type: string
steps:
- run:
command: |-
#!/bin/bash
conda-list() {
CONDADIR=$(eval echo "$CONDADIR")
which conda || eval "$("${CONDADIR}"/bin/conda shell.bash hook)"
conda activate "${CONDAENV_NAME}"
conda list
}
# Will not run if sourced for bats-core tests.
# View src/tests for more information.
ORB_TEST_ENV="bats-"
if [ "${0#*"$ORB_TEST_ENV"}" = "$0" ]; then
conda-list
fi
environment:
CONDADIR: <<parameters.condadir>>
CONDAENV_NAME: <<parameters.conda_env>>
name: conda list -n <<parameters.conda_env>>
configure-conda:
description: Configure miniconda
parameters:
branch_label:
default: true
description: Use the branch name as a label for the anaconda channel
type: boolean
channels:
default: conda-forge
description: Further default channels for conda
type: string
condadir:
default: ~/miniconda3
description: Install location for anaconda
type: string
default_branch:
default: develop
description: Default branch channel for conda
type: string
main_channel:
default: psyplot
description: Main channel to use with channels and for the branches
type: string
orb_version:
default: 1.5.33
description: |
Version for the python deploy package to use. See https://anaconda.org/psyplot/psyplot-ci-orb
type: string
packages:
default: conda-build=3.25.* anaconda-client conda-verify
description: Extra packages to install into the base environment
type: string
steps:
- run:
command: |-
#!/bin/bash
configure-conda() {
CONDADIR=$(eval echo "$CONDADIR")
which conda || eval "$("${CONDADIR}"/bin/conda shell.bash hook)"
conda config --set always_yes yes --set changeps1 no
conda config --add channels conda-forge
for CHN in ${CHANNELS}; do
conda config --add channels "${CHN}"
done
if [[ "${MAINCHANNEL}" != "" ]]; then
conda config --add channels "${MAINCHANNEL}"
if [[ "${DEFAULTBRANCH}" != "" ]]; then
conda config --add channels "${MAINCHANNEL}"/label/"${DEFAULTBRANCH}"
fi
if [ "${USE_BRANCH}" == "1" ] && [ "${CIRCLE_TAG}" == "" ] && [ "${CIRCLE_BRANCH}" != "" ]; then
conda config --add channels "${MAINCHANNEL}"/label/"${CIRCLE_BRANCH/\//-}"
fi
fi
# shellcheck disable=SC2086
conda install -c conda-forge anaconda-client conda-build ${PACKAGES}
if [ "${ORB_VERSION}" != "" ]; then
VERSION="===${ORB_VERSION}"
fi
pip install -i https://pypi.anaconda.org/psyplot/simple --no-deps psyplot-ci-orb"${VERSION}" || pip install -i https://pypi.anaconda.org/psyplot/simple --no-deps psyplot-ci-orb
}
# Will not run if sourced for bats-core tests.
# View src/tests for more information.
ORB_TEST_ENV="bats-"
if [ "${0#*"$ORB_TEST_ENV"}" = "$0" ]; then
configure-conda
fi
environment:
CHANNELS: <<parameters.channels>>
CONDADIR: <<parameters.condadir>>
DEFAULTBRANCH: <<parameters.default_branch>>
MAINCHANNEL: <<parameters.main_channel>>
ORB_VERSION: << parameters.orb_version >>
PACKAGES: <<parameters.packages>>
USE_BRANCH: <<# parameters.branch_label >>1<</ parameters.branch_label >>
name: Configure conda
- run:
command: |-
#!/bin/bash
conda-info() {
CONDADIR=$(eval echo "$CONDADIR")
which conda || eval "$("${CONDADIR}"/bin/conda shell.bash hook)"
conda info -a
}
# Will not run if sourced for bats-core tests.
# View src/tests for more information.
ORB_TEST_ENV="bats-"
if [ "${0#*"$ORB_TEST_ENV"}" = "$0" ]; then
conda-info
fi
environment:
CONDADIR: <<parameters.condadir>>
name: conda info
configure-git:
description: |
Sets mandatory git config fields to allow creating and pushing of tags. If not set it will default to details from the VCS system, composed from the $CIRCLE_USERNAME variable. If both parameters are set, they will be used instead.
This command has been taken from the official orb-tools-orb at https://github.com/CircleCI-Public/orb-tools-orb/releases/tag/v10.0.5
parameters:
user-name:
default: ""
description: |
Override git user name.
type: string
steps:
- run:
command: |
#!/bin/bash
# configure the git user
#
# This command has been taken from the official orb-tools-orb at
# https://github.com/CircleCI-Public/orb-tools-orb/releases/tag/v10.0.5
if [ -z "$GIT_USER_NAME" ] || [ -z "$GIT_EMAIL" ]; then
# No user name or email set, default to CIRCLE_USERNAME-based identifiers
git config --global user.name "$CIRCLE_USERNAME"
git config --global user.email "$CIRCLE_USERNAME@users.noreply.github.com"
else
git config --global user.name "${GIT_USER_NAME}"
git config --global user.email "${GIT_EMAIL}"
fi
environment:
GIT_USER_NAME: << parameters.user-name >>
name: git config
configure-recipe:
description: Configure the recipe with extra options
parameters:
recipe_append:
description: The full content for recipe_append.yml
type: string
recipe_dir:
default: ci/conda-recipe
description: Path to the recipe to build relative to the project directory
type: string
steps:
- run:
command: |-
#!/bin/bash
configure-recipe() {
echo "${RECIPEAPPEND}" > "${RECIPEDIR}"/recipe_append.yaml
}
# Will not run if sourced for bats-core tests.
# View src/tests for more information.
ORB_TEST_ENV="bats-"
if [ "${0#*"$ORB_TEST_ENV"}" = "$0" ]; then
configure-recipe
fi
environment:
RECIPEAPPEND: <<parameters.recipe_append>>
RECIPEDIR: <<parameters.recipe_dir>>
name: Configure the recipe
create-release:
description: |
Create a new tag in the git repository
parameters:
draft:
default: true
description: Whether to create a draft release or not.
type: boolean
token:
default: ""
description: The Github API Token to use. If not set, we use the GITHUB_TOKEN environment variable
type: string
steps:
- run:
command: |
#!/bin/bash
create-release() {
sudo apt-get update
sudo apt-get install jq
[ "${TOKEN}" ] && GITHUB_TOKEN="${TOKEN}"
jq -n \
--arg tag "${NEW_TAG}" \
--arg name "${NEW_TAG}: ${RELEASE_TITLE}" \
--arg body "${RELEASE_MESSAGE}" \
"{tag_name: \$tag, name: \$name, body: \$body, draft: $DRAFT}" > release_body.json
cat release_body.json
curl \
-X POST \
-H "Authorization: Token ${GITHUB_TOKEN}" \
-H "Content-Type: application/json" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/releases" \
-d @release_body.json
}
# Will not run if sourced for bats-core tests.
# View src/tests for more information.
ORB_TEST_ENV="bats-"
if [ "${0#*"$ORB_TEST_ENV"}" = "$0" ]; then
create-release
fi
environment:
DRAFT: <<#parameters.draft>>true<</parameters.draft>><<^parameters.draft>>false<</parameters.draft>>
TOKEN: << parameters.token >>
name: Create release on Github
create-tag:
description: |
Create a new tag in the git repository
parameters:
tag-prefix:
default: v
description: The prefix to use for the tag
type: string
steps:
- run:
command: |
#!/bin/bash
GetIncrement() {
COMMIT_SUBJECT=$(git log -1 --pretty=%s)
RELEASE_MESSAGE="$(git log -1 --pretty=%b)"
SEMVER_INCREMENT=$(echo "${COMMIT_SUBJECT}" | sed -En 's/.*\[semver:(major|minor|patch|skip)\].*/\1/p')
echo "Commit subject: ${COMMIT_SUBJECT}"
echo "export SEMVER_INCREMENT=\"$SEMVER_INCREMENT\"" >> "$BASH_ENV"
}
CheckIncrement() {
if [ -z "${SEMVER_INCREMENT}" ];then
echo "Commit subject did not indicate which SemVer increment to make."
echo "To publish orb, you can ammend the commit or push another commit with [semver:FOO] in the subject where FOO is major, minor, patch."
echo "Note: To indicate intention to skip promotion, include [semver:skip] in the commit subject instead."
if [ "$SHOULD_FAIL" == "1" ];then
exit 1
else
echo "export PR_MESSAGE=\"BotComment: Package release was skipped due to [semver:patch|minor|major] not being included in commit message.\"" >> "$BASH_ENV"
fi
elif [ "$SEMVER_INCREMENT" == "skip" ];then
echo "SEMVER in commit indicated to skip orb release"
echo "export PR_MESSAGE=\"BotComment: Package release was skipped due to [semver:skip] in commit message.\"" >> "$BASH_ENV"
fi
}
JoinVersion() {
local IFS="."
echo "$*"
}
DoIncrement() {
LATEST_TAG="$(git describe --abbrev=0 --tags)"
if [[ "${TAG_PREFIX}" != "" ]]; then
LATEST_VERSION="${LATEST_TAG:${#TAG_PREFIX}}"
else
LATEST_VERSION="${LATEST_TAG}"
fi
IFS="." read -r -a VERSION_PARTS \<<< "${LATEST_VERSION}"
if [ "$SEMVER_INCREMENT" == "major" ]; then
VERSION_PARTS[0]=$((VERSION_PARTS[0]+1))
VERSION_PARTS[1]=0
VERSION_PARTS[2]=0
elif [ "$SEMVER_INCREMENT" == "minor" ]; then
VERSION_PARTS[1]=$((VERSION_PARTS[1]+1))
VERSION_PARTS[2]=0
elif [ "$SEMVER_INCREMENT" == "patch" ]; then
VERSION_PARTS[2]=$((VERSION_PARTS[2]+1))
fi
NEW_VERSION=$(JoinVersion "${VERSION_PARTS[@]}")
NEW_TAG="${TAG_PREFIX}${NEW_VERSION}"
# shellcheck disable=SC2001
RELEASE_TITLE="$(echo "${COMMIT_SUBJECT}" | sed 's/\s*\[semver:.*\]\s*//')"
echo "${CLEAN_MESSAGE}"
git tag -a "${NEW_TAG}" \
-m "${RELEASE_TITLE}" \
-m "${RELEASE_MESSAGE}"
# shellcheck disable=SC2129
echo "export NEW_VERSION=\"${NEW_VERSION}\"" >> "$BASH_ENV"
echo "export NEW_TAG=\"${NEW_TAG}\"" >> "$BASH_ENV"
echo "export RELEASE_TITLE=$(printf '%q' "${RELEASE_TITLE}")" >> "$BASH_ENV"
echo "export RELEASE_MESSAGE=$(printf '%q' "${RELEASE_MESSAGE}")" >> "$BASH_ENV"
echo "export PR_MESSAGE=\"BotComment: *Production* version of package available for use - \\\`${NEW_TAG}\\\`\"" >> "$BASH_ENV"
}
create-tag() {
# create a tag based on git
GetIncrement
CheckIncrement
[ "$SEMVER_INCREMENT" == "skip" ] || DoIncrement
}
# Will not run if sourced for bats-core tests.
# View src/tests for more information.
ORB_TEST_ENV="bats-"
if [ "${0#*"$ORB_TEST_ENV"}" = "$0" ]; then
create-tag
fi
environment:
TAG_PREFIX: <<parameters.tag-prefix>>
name: Create git tag
deploy-docs:
description: Deploy the docs to Github Pages
parameters:
condadir:
default: ~/miniconda3
description: Install location for anaconda
type: string
deploy_dir:
default: docs/_build/html
description: The docs to deploy
type: string
dry_run:
default: false
description: Do not change anything on Github, just do a dry run
type: boolean
fingerprint:
description: The ssh fingerprint used for deploying to github pages
type: string
target_branch:
default: gh-pages
description: |
The branch in the git repository to deploy to
type: string
steps:
- add_ssh_keys:
fingerprints:
- <<parameters.fingerprint>>
- run:
command: |-
#!/bin/bash
deploy-docs() {
# deploy docs generated with sphinx to gh-pages
touch "${DEPLOY_DIR}"/.nojekyll
mkdir -p "${DEPLOY_DIR}"/.circleci
cat > "${DEPLOY_DIR}"/.circleci/config.yml \<< EOF
version: 2.1
jobs:
job1:
machine: true
steps:
- run:
command: echo Bye
workflows:
version: 2.1
dummy:
jobs:
- job1:
filters:
branches:
ignore: gh-pages
EOF
CONDADIR=$(eval echo "$CONDADIR")
which conda || eval "$("${CONDADIR}"/bin/conda shell.bash hook)"
conda activate base
conda install -c defaults --override-channels nodejs
npm install -g gh-pages@3.0.0
if [[ ${DRY_RUN} == "1" ]]; then
ARGS="--no-push"
fi
gh-pages-clean
gh-pages \
${ARGS} \
--dotfiles \
--branch "${TARGET_BRANCH}" \
--user "ci-build <ci-build@psyplot.org>" \
--message "[skip ci] CircleCi Build ${CIRCLE_BUILD_NUM}, commit ${CIRCLE_SHA1}" \
--dist "${DEPLOY_DIR}"
}
# Will not run if sourced for bats-core tests.
# View src/tests for more information.
ORB_TEST_ENV="bats-"
if [ "${0#*"$ORB_TEST_ENV"}" = "$0" ]; then
deploy-docs
fi
environment:
CONDADIR: <<parameters.condadir>>
DEPLOY_DIR: <<parameters.deploy_dir>>
DRY_RUN: <<# parameters.dry_run >>1<</ parameters.dry_run >>
TARGET_BRANCH: <<parameters.target_branch>>
name: Deploy docs with gh-pages
deploy-pkg:
description: |
Deploy the conda to anaconda.
Note that you need a Context with an ANACONDA_API_TOKEN variable set or use the token parameter.
parameters:
branch_label:
default: true
description: Use the branch name as a label for the anaconda channel
type: boolean
condadir:
default: ~/miniconda3
description: Install location for anaconda
type: string
dry_run:
default: false
description: Do not change anything on anaconda, just do a dry run
type: boolean
label:
default: main
description: The channel label to deploy to
type: string
orb_version:
default: 1.5.33
description: |
Version for the python deploy package to use. See https://anaconda.org/psyplot/psyplot-ci-orb
type: string
python_version:
default: "3.8"
description: Python version
type: string
recipe_dir:
default: ci/conda-recipe
description: Path to the recipe to build relative to the project directory
type: string
token:
default: ""
description: |
Anaconda API token. This should be set through a context on CircleCI. If this is not set, we'll assume it's $BINSTAR_API_TOKEN or $ANACONDA_API_TOKEN
type: string
steps:
- run:
command: |
#!/bin/bash
deploy-pkg() {
# deploy to package to the anaconda channel
CONDADIR=$(eval echo "$CONDADIR")
which conda || eval "$("${CONDADIR}"/bin/conda shell.bash hook)"
conda activate base
if [ "${ORB_VERSION}" != "" ]; then
VERSION="===${ORB_VERSION}"
fi
# shellcheck disable=SC2143
if [ ! "$(pip freeze | grep -q psyplot-ci-orb)" ]; then
echo "Installing psyplot-ci-orb${VERSION}"
conda install anaconda-client conda-build
pip install -i https://pypi.anaconda.org/psyplot/simple --no-deps psyplot-ci-orb"${VERSION}"
fi
if [ "${LABEL}" != "" ]; then
ARGS="--label ${LABEL}"
fi
if [ "${USE_BRANCH}" == "1" ] && [ "${CIRCLE_TAG}" == "" ] && [ "${CIRCLE_BRANCH}" != "" ]; then
ARGS="${ARGS} --label ${CIRCLE_BRANCH/\//-}"
fi
if [ "${TOKEN}" != "" ]; then
ARGS="${ARGS} --token ${TOKEN}"
fi
# shellcheck disable=SC2086
deploy-conda-recipe "${RECIPEDIR}" ${ARGS} ${EXTRA_OPTS}
}
# Will not run if sourced for bats-core tests.
# View src/tests for more information.
ORB_TEST_ENV="bats-"
if [ "${0#*"$ORB_TEST_ENV"}" = "$0" ]; then
deploy-pkg
fi
environment:
CONDADIR: <<parameters.condadir>>
EXTRA_OPTS: <<# parameters.dry_run >> -n <</ parameters.dry_run >>
LABELS: << parameters.label >>
ORB_VERSION: << parameters.orb_version >>
PYTHON_VERSION: <<parameters.python_version>>
RECIPEDIR: <<parameters.recipe_dir>>
TOKEN: <<parameters.token>>
USE_BRANCH: <<# parameters.branch_label >>1<</ parameters.branch_label >>
name: Deploy the docs to anaconda
deploy-pypi:
description: Upload the python package to pypi.io
parameters:
condadir:
default: ~/miniconda3
description: Install location for anaconda
type: string
dry_run:
default: false
description: Do not make an upload, only a dry run
type: boolean
pypi_password:
default: ""
description: |
User password for pypi upload. We recomment to set this via the TWINE_PASSWORD environment variable in a context.
type: string
pypi_user:
default: ""
description: |
User name for pypi upload. We recomment to set this via the TWINE_USERNAME environment variable.
type: string
steps:
- run:
command: |-
#!/bin/bash
test-dist() {
CONDADIR=$(eval echo "$CONDADIR")
which conda || eval "$("${CONDADIR}"/bin/conda shell.bash hook)"
COMMIT_SUBJECT=$(git log -1 --pretty=%s)
# shellcheck disable=SC2001
RELEASE_TITLE="$(echo "${COMMIT_SUBJECT}" | sed 's/\s*\[semver:.*\]\s*//')"
which twine || pip install twine
if [ -d dist ]; then
rm -r dist
fi
python setup.py sdist
twine check dist/*.tar.gz
[ "${PYPI_USER}" ] && export TWINE_USERNAME="${PYPI_USER}"
[ "${PYPI_PASSWORD}" ] && export TWINE_PASSWORD="${PYPI_PASSWORD}"
if [ "${DRYRUN}" ]; then
echo "twine upload --non-interactive -c \"${RELEASE_TITLE}\"" dist/*.tar.gz
else
twine upload --non-interactive -c "${RELEASE_TITLE}" dist/*.tar.gz
fi
}
# Will not run if sourced for bats-core tests.
# View src/tests for more information.
ORB_TEST_ENV="bats-"
if [ "${0#*"$ORB_TEST_ENV"}" = "$0" ]; then
test-dist
fi
environment:
CONDADIR: <<parameters.condadir>>
DRYRUN: <<#parameters.dry_run>>true<</parameters.dry_run>>
PYPI_PASSWORD: << parameters.pypi_password >>
PYPI_USER: << parameters.pypi_user >>
name: Deploy the python package to pypi
- store_artifacts:
destination: dist
path: dist
install:
description: |
Install and build the conda package
parameters:
branch_label:
default: true
description: Use the branch name as a label for the anaconda channel
type: boolean
channels:
default: conda-forge
description: Further default channels for conda
type: string
checkout:
default: true
description: Do a checkout
type: boolean
condadir:
default: ~/miniconda3
description: Install location for anaconda
type: string
default_branch:
default: develop
description: Default branch channel for conda
type: string
install_opengl:
default: true
description: |
Whether to install opengl (necessary for GUI-based applications) or not
type: boolean
main_channel:
default: psyplot
description: Main channel to use with channels and for the branches
type: string
packages:
default: conda-build anaconda-client conda-verify
description: Extra packages to install into the base environment
type: string
steps:
- when:
condition: <<parameters.checkout>>
steps:
- checkout
- install-conda:
condadir: <<parameters.condadir>>
- when:
condition: <<parameters.install_opengl>>
steps:
- install-opengl
- configure-conda:
branch_label: << parameters.branch_label >>
channels: <<parameters.channels>>
default_branch: <<parameters.default_branch>>
main_channel: <<parameters.main_channel>>
packages: <<parameters.packages>>
install-conda:
description: Setup linux environment and install miniconda
parameters:
condadir:
default: ~/miniconda3
description: Install location for anaconda
type: string
steps:
- run:
command: |
#!/bin/bash
install-conda() {
CONDADIR=$(eval echo "$CONDADIR")
echo ""
echo "Installing a fresh version of Mambaforge."
MINICONDA_URL="https://github.com/conda-forge/miniforge/releases/latest/download/"
case "$(uname -s)" in
Linux*) machine=Linux;;
Darwin*) machine=MacOSX;;
*) >&2 echo "unsupported machine!" && return 1;;
esac
echo "Operating system: ${machine}"
MINICONDA_FILE="Mambaforge-${machine}-x86_64.sh"
curl -L -O "${MINICONDA_URL}/${MINICONDA_FILE}"
bash "$MINICONDA_FILE" -bp "${CONDADIR}"
rm "${MINICONDA_FILE}"
# add conda init
eval "$("${CONDADIR}"/bin/conda shell.bash hook)"
conda init
}
# Will not run if sourced for bats-core tests.
# View src/tests for more information.
ORB_TEST_ENV="bats-"
if [ "${0#*"$ORB_TEST_ENV"}" = "$0" ]; then
install-conda
fi
environment:
CONDADIR: <<parameters.condadir>>
name: Install conda
install-opengl:
description: |
"Install openGL for GUI-based applications (such as psyplot-gui or psy-view)"
steps:
- run:
command: |
#!/bin/bash
install-opengl() {
case "$(uname -s)" in
Linux*) echo "Installing libgl1-mesa-glx and libegl1-mesa-dev";;
*) echo "Not on Linux, so skipping" && return 0;;
esac
sudo apt-get update
sudo apt-get install libgl1-mesa-glx libegl1-mesa-dev
}
# Will not run if sourced for bats-core tests.
# View src/tests for more information.
ORB_TEST_ENV="bats-"
if [ "${0#*"$ORB_TEST_ENV"}" = "$0" ]; then
install-opengl
fi
name: install apt requirements
install-packages:
description: |
Run tests in parallel using circleci
parameters:
conda_env:
default: test
description: Name of the conda environment
type: string
condadir:
default: ~/miniconda3
description: Install location for anaconda
type: string
packages:
description: Extra packages to install
type: string
steps:
- run:
command: |-
#!/bin/bash
install-packages() {
CONDADIR=$(eval echo "$CONDADIR")
which conda || eval "$("${CONDADIR}"/bin/conda shell.bash hook)"
# shellcheck disable=SC2086
mamba install -n "${CONDAENV_NAME}" ${EXTRA_PACKAGES}
}
# Will not run if sourced for bats-core tests.
# View src/tests for more information.
ORB_TEST_ENV="bats-"
if [ "${0#*"$ORB_TEST_ENV"}" = "$0" ]; then
install-packages
fi
environment:
CONDADIR: <<parameters.condadir>>
CONDAENV_NAME: <<parameters.conda_env>>
EXTRA_PACKAGES: <<parameters.packages>>
name: Install extra packages
run-job:
description: Command to run jobs conditionally
parameters:
run-job:
default: true
description: Whether to run the job or stop it.
type: boolean
steps:
- unless:
condition: <<parameters.run-job>>
steps:
- run:
command: circleci-agent step halt
name: Stop the job
run-parallel-tests:
description: |
Run tests in parallel using circleci
parameters:
build_refs:
default: false
description: Build reference figures
type: boolean
conda_env:
default: test
description: Name of the conda environment
type: string
condadir:
default: ~/miniconda3
description: Install location for anaconda
type: string
pytest_args:
default: ""
description: Any arguments passed to the pytest call
type: string
reference_figures:
default: tests/reference_figures
description: Path to the reference figures
type: string
test_dir:
default: tests
description: Path to the test directory
type: string
test_figures:
default: tests/test_figures
description: Path to the test figures
type: string
test_upload_dir:
default: test-results
description: Path to the directory where to store XML test files
type: string
steps:
- conda-list:
conda_env: <<parameters.conda_env>>
condadir: <<parameters.condadir>>
- run:
command: |-
#!/bin/bash
run-parallel-tests() {
CONDADIR=$(eval echo "$CONDADIR")
which conda || eval "$("${CONDADIR}"/bin/conda shell.bash hook)"
conda activate "${CONDAENV_NAME}"
WORKDIR="$(pwd)"
cd "${TESTDIR}" || exit 1
TESTS="$(circleci tests glob "test_*.py" "*/test_*.py" | circleci tests split --split-by=timings)"
echo "Test files:"
echo "${TESTS}"
mkdir -p "${TESTUPLOADDIR}"
pytest -h || pip install pytest pytest-cov
if [ "${BUILDREFS}" ]; then
# shellcheck disable=SC2086
pytest -xv --ref --junitxml="${TESTUPLOADDIR}"/junit.xml ${PYTEST_ARGS} ${TESTS}
fi
# shellcheck disable=SC2086
pytest -xv --cov-append --junitxml="${TESTUPLOADDIR}"/junit.xml ${PYTEST_ARGS} ${TESTS}
cd "${WORKDIR}" || exit 1
conda deactivate
}
# Will not run if sourced for bats-core tests.
# View src/tests for more information.
ORB_TEST_ENV="bats-"
if [ "${0#*"$ORB_TEST_ENV"}" = "$0" ]; then
run-parallel-tests
fi
environment:
BUILDREFS: <<#parameters.build_refs>>true<</parameters.build_refs>>
CONDADIR: <<parameters.condadir>>
CONDAENV_NAME: <<parameters.conda_env>>
PYTEST_ARGS: <<parameters.pytest_args>>
TESTDIR: <<parameters.test_dir>>
TESTUPLOADDIR: <<parameters.test_upload_dir>>
name: Run tests
- store_test_results:
path: <<parameters.test_dir>>/<<parameters.test_upload_dir>>
- store_artifacts:
path: <<parameters.test_dir>>/<<parameters.test_upload_dir>>
- when:
condition: <<parameters.build_refs>>
steps:
- store_artifacts:
destination: reference_figures
path: <<parameters.reference_figures>>
- store_artifacts:
destination: test_figures
path: <<parameters.reference_figures>>
setup-conda-env:
description: |
Setup a conda environment
parameters:
conda_env:
default: test
description: Name of the conda environment
type: string
condadir:
default: ~/miniconda3
description: Install location for anaconda
type: string
environment_file:
default: ci/environment.yml
description: Path to the conda environment file
type: string
packages:
default: ""
description: Extra packages to install
type: string
python_version:
default: "3.8"
description: Python version to use. This does only have an effect if we do not use an environment file.
type: string
recipe_dir:
default: ci/conda-recipe
description: Path to the recipe to build relative to the project directory
type: string
steps:
- run:
command: |-
#!/bin/bash
setup-conda-env() {
CONDADIR=$(eval echo "$CONDADIR")
which conda || eval "$("${CONDADIR}"/bin/conda shell.bash hook)"
conda activate "${CONDAENV_NAME}" || MISSING=true
if [ "${MISSING}" ]; then
if [[ "${CONDAENV_FILE}" != "" ]] && [[ -e "${CONDAENV_FILE}" ]]; then
if [ "${CIRCLE_TAG}" == "" ] && [ "${CIRCLE_BRANCH}" != "" ]; then
sed -i "s#__CURRENTBRANCH__#${CIRCLE_BRANCH}#" "${CONDAENV_FILE}"
fi
mamba env create -n "${CONDAENV_NAME}" -f "${CONDAENV_FILE}"
if [[ "${EXTRA_PACKAGES}" != "" ]]; then
# shellcheck disable=SC2086
mamba install -n "${CONDAENV_NAME}" ${EXTRA_PACKAGES}
fi
else
PKG=$(show-package-name "${RECIPEDIR}")
# shellcheck disable=SC2086
mamba create -n "${CONDAENV_NAME}" -c local "${PKG}" pytest pytest-cov python="${PYTHON_VERSION}" ${EXTRA_PACKAGES}
fi
fi
}
# Will not run if sourced for bats-core tests.
# View src/tests for more information.
ORB_TEST_ENV="bats-"
if [ "${0#*"$ORB_TEST_ENV"}" = "$0" ]; then
setup-conda-env
fi
environment:
CONDADIR: <<parameters.condadir>>
CONDAENV_FILE: <<parameters.environment_file>>
CONDAENV_NAME: <<parameters.conda_env>>
EXTRA_PACKAGES: <<parameters.packages>>
PYTHON_VERSION: <<parameters.python_version>>
RECIPEDIR: <<parameters.recipe_dir>>
name: Create conda environment
- conda-list:
conda_env: <<parameters.conda_env>>
condadir: <<parameters.condadir>>
test-dist:
description: Test the dist for pypi via twine check
parameters:
condadir:
default: ~/miniconda3
description: Install location for anaconda
type: string
steps:
- run:
command: |-
#!/bin/bash
test-dist() {
CONDADIR=$(eval echo "$CONDADIR")
which conda || eval "$("${CONDADIR}"/bin/conda shell.bash hook)"
which twine || pip install twine
python setup.py sdist
twine check dist/*.tar.gz
}
# Will not run if sourced for bats-core tests.
# View src/tests for more information.
ORB_TEST_ENV="bats-"
if [ "${0#*"$ORB_TEST_ENV"}" = "$0" ]; then
test-dist
fi
environment:
CONDADIR: <<parameters.condadir>>
name: Test the dist
- store_artifacts:
destination: dist
path: dist/
trigger-release-workflow:
description: |
Check whether the commit message suggests a new release and if so, cancel the workflow.
parameters:
checkout:
default: true
description: |
Checkout as a first step? Default is true
type: boolean
pipeline-param-map:
default: '{\"deploy-release\": true}'
description: |
Map of pipeline parameters that the new pipeline will be invoked with. Make use of this to target the release workflow that should be triggered and exclude other workflows from being triggered.
type: string
token-variable:
default: CIRCLE_TOKEN
description: |
Name of environment variable containing your personal CircleCI API token
type: env_var_name
steps:
- when:
condition: <<parameters.checkout>>
steps:
- checkout
- run:
command: |
#!/bin/bash
# trigger the release workflow
#
# This command has been largely taken from the official orb-tools-orb at
# https://github.com/CircleCI-Public/orb-tools-orb/releases/tag/v10.0.5
Setup() {
VCS_TYPE=$(echo "${CIRCLE_BUILD_URL}" | cut -d '/' -f 4)
T=$(eval echo "$TOKEN")
}
BuildParams() {
PARAM_MAP=$(eval echo "${PARAM_MAP}")
# shellcheck disable=SC2016
REQUEST_PARAMS='{\"branch\": \"$CIRCLE_BRANCH\", \"parameters\": $PARAM_MAP}'
eval echo "${REQUEST_PARAMS}" > pipelineparams.json
}
DoCurl() {
curl -u "${T}": -X POST --header "Content-Type: application/json" -d @pipelineparams.json \
"https://circleci.com/api/v2/project/${VCS_TYPE}/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/pipeline" -o /tmp/curl-result.txt
}
Result() {
# shellcheck disable=SC2002
CURL_RESULT=$(cat /tmp/curl-result.txt)
if [[ $(echo "$CURL_RESULT" | jq -r .message) == "Not Found" || $(echo "$CURL_RESULT" | jq -r .message) == "Permission denied" || $(echo "$CURL_RESULT" | jq -r .message) == "Project not found" ]]; then
# shellcheck disable=SC2002
echo "Was unable to trigger integration test workflow. API response: $(cat /tmp/curl-result.txt | jq -r .message)"
exit 1
else
echo "Pipeline triggered!"
# shellcheck disable=SC2002
echo "https://app.circleci.com/jobs/${VCS_TYPE}/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/$(cat /tmp/curl-result.txt | jq -r .number)"
fi
}
TriggerRelease() {
Setup
BuildParams
DoCurl
Result
}
Main() {
COMMIT_SUBJECT=$(git log -1 --pretty=%s)
SEMVER_INCREMENT=$(echo "${COMMIT_SUBJECT}" | sed -En 's/.*\[semver:(major|minor|patch|skip)\].*/\1/p')
if [ -z "${SEMVER_INCREMENT}" ]; then
echo "No new version specified. Please indicate [semver:major/minor/patch] to create a new release"
elif [ "$SEMVER_INCREMENT" == "skip" ]; then
echo "Commit marked as skip for release."
else
echo "Semver release indicated. Trigger release workflow now."
TriggerRelease
fi
}
# Will not run if sourced for bats-core tests.
# View src/tests for more information.
ORB_TEST_ENV="bats-"
if [ "${0#*"$ORB_TEST_ENV"}" = "$0" ]; then
Main
fi
environment:
PARAM_MAP: <<parameters.pipeline-param-map>>
TOKEN: $<<parameters.token-variable>>
name: Check commit message
executors:
default:
description: |
The default machine executor
machine:
image: ubuntu-2004:202111-02
macos:
description: |
The default macos executor with xcode 12.2.0
macos:
xcode: 12.2.0
jobs:
build-docs:
description: |
Install and build the conda package
executor: <<parameters.exec_environment>>
parameters:
build_dir:
default: docs/_build
description: Directory where to build the docs
type: string
builders:
default: html linkcheck
description: Builders to use
type: string
conda_env:
default: docs
description: Name of the conda environment
type: string
condadir:
default: ~/miniconda3
description: Install location for anaconda
type: string
environment_file:
default: docs/environment.yml
description: |
Path to a conda environment file to install additional packages. Must install sphinx, too. If this is empty (or the default file does not exist), we will assume that everything is installed alread in the base conda environment.
type: string
exec_environment:
default: default
description: Set a custom executor for your job testing environment. By defeault the machine image will be used. Use "macos" for building on OS X.
type: executor
packages:
default: ""
description: Extra packages to install
type: string
run-job:
default: true
description: Whether to run the job or stop it.
type: boolean
source:
default: docs
description: Directory with the sphinx source files (i.e. with conf.py).
type: string
workspace:
default: "~"
description: A workspace to attach. Attach none if empty.
type: string
steps:
- run-job:
run-job: <<parameters.run-job>>
- when:
condition: << parameters.workspace >>
steps:
- attach_workspace:
at: << parameters.workspace >>
- build-docs:
build_dir: <<parameters.build_dir>>
builders: <<parameters.builders>>
conda_env: <<parameters.conda_env>>
condadir: <<parameters.condadir>>
environment_file: <<parameters.environment_file>>
packages: <<parameters.packages>>
source: <<parameters.source>>
create-tag:
description: |
Create a new tag in the git repository
executor: <<parameters.exec_environment>>
parameters:
checkout:
default: true
description: |
Whether to perform the CircleCI checkout step.
type: boolean
draft-release:
default: true
description: |
Whether to create the release as a draft or publish it directly.
type: boolean
exec_environment:
default: default
description: Set a custom executor for your job testing environment. By defeault the machine image will be used. Use "macos" for building on OS X.
type: executor
github-token:
default: ""
description: |
The Github API Token to use. If not set, we use the GITHUB_TOKEN environment variable
type: string
publish-release:
description: |
Publish the created tag as release on github
type: boolean
publish-version-tag:
description: |
Push a git tag describing the release that was just published? If `true`, make sure to pass SSH fingerprints, as well
type: boolean
run-job:
default: true
description: Whether to run the job or stop it.
type: boolean
ssh-fingerprints:
default: ""
description: The fingerprint of the SSH key to use for pushing to github
type: string
tag-prefix:
default: v
description: The prefix to use for the tag
type: string
user-name:
default: ""
description: |
Override git user name.
type: string
workspace:
default: "~"
description: A workspace to attach. Attach none if empty.
type: string
steps:
- run-job:
run-job: <<parameters.run-job>>
- unless:
condition: << parameters.checkout >>
steps:
- when:
condition: << parameters.workspace >>
steps:
- attach_workspace:
at: << parameters.workspace >>
- when:
condition: << parameters.checkout >>
steps:
- checkout
- configure-git:
user-name: << parameters.user-name >>
- create-tag:
tag-prefix: <<parameters.tag-prefix>>
- when:
condition: <<parameters.publish-version-tag>>
steps:
- add_ssh_keys:
fingerprints:
- <<parameters.ssh-fingerprints>>
- run:
command: git push origin "${NEW_TAG}"
name: Push tag to remote
- when:
condition: <<parameters.publish-release>>
steps:
- create-release:
draft: << parameters.draft-release >>
token: << parameters.github-token >>
- when:
condition: << parameters.workspace >>
steps:
- persist_to_workspace:
paths: ./*
root: << parameters.workspace >>
deploy-docs:
description: |
Install and build the conda package
executor: <<parameters.exec_environment>>
parameters:
condadir:
default: ~/miniconda3
description: Install location for anaconda
type: string
deploy_dir:
default: docs/_build/html
description: The docs to deploy
type: string
dry_run:
default: false
description: Do not change anything on Github, just do a dry run
type: boolean
exec_environment:
default: default
description: Set a custom executor for your job testing environment. By defeault the machine image will be used. Use "macos" for building on OS X.
type: executor
fingerprint:
description: The ssh fingerprint used for deploying to github pages
type: string
run-job:
default: true
description: Whether to run the job or stop it.
type: boolean
target_branch:
default: gh-pages
description: |
The branch in the git repository to deploy to
type: string
workspace:
default: "~"
description: A workspace to attach. Attach none if empty.
type: string
steps:
- run-job:
run-job: <<parameters.run-job>>
- when:
condition: << parameters.workspace >>
steps:
- attach_workspace:
at: << parameters.workspace >>
- deploy-docs:
condadir: <<parameters.condadir>>
deploy_dir: <<parameters.deploy_dir>>
dry_run: << parameters.dry_run >>
fingerprint: <<parameters.fingerprint>>
target_branch: <<parameters.target_branch>>
deploy-pkg:
description: |
Install and build the conda package
executor: <<parameters.exec_environment>>
parameters:
branch_label:
default: true
description: Use the branch name as a label for the anaconda channel
type: boolean
build_pkg:
default: false
description: Build the package prior to deployment
type: boolean
build_tool:
default: mamba
description: The build tool to use (default mamba)
type: string
channels:
default: conda-forge
description: Further default channels for conda
type: string
checkout:
default: false
description: Do a checkout
type: boolean
condadir:
default: ~/miniconda3
description: Install location for anaconda
type: string
dry_run:
default: false
description: Do not change anything on anaconda, just do a dry run
type: boolean
exec_environment:
default: default
description: Set a custom executor for your job testing environment. By defeault the machine image will be used. Use "macos" for building on OS X.
type: executor
install:
default: false
description: Install conda prior to deployment
type: boolean
label:
default: main
description: The channel label to deploy to
type: string
python_version:
default: "3.8"
description: Python version
type: string
recipe_append:
default: ""
description: The full content for recipe_append.yml
type: string
recipe_dir:
default: ci/conda-recipe
description: Path to the recipe to build relative to the project directory
type: string
run-job:
default: true
description: Whether to run the job or stop it.
type: boolean
token:
default: ""
description: |
Anaconda API token. This should be set through a context on CircleCI. If this is not set, we'll assume it's $BINSTAR_API_TOKEN or $ANACONDA_API_TOKEN
type: string
workspace:
default: "~"
description: A workspace to attach. Attach none if empty.
type: string
steps:
- run-job:
run-job: <<parameters.run-job>>
- when:
condition: << parameters.workspace >>
steps:
- attach_workspace:
at: << parameters.workspace >>
- when:
condition: << parameters.checkout >>
steps:
- checkout
- when:
condition: << parameters.install >>
steps:
- install:
channels: <<parameters.channels>>
condadir: <<parameters.condadir>>
main_channel: ""
packages: conda-build anaconda-client conda-verify
- when:
condition: << parameters.build_pkg >>
steps:
- configure-recipe:
recipe_append: <<parameters.recipe_append>>
recipe_dir: <<parameters.recipe_dir>>
- build-recipe:
build_args: --no-test
build_tool: << parameters.build_tool >>
condadir: << parameters.condadir >>
python_version: << parameters.python_version >>
recipe_dir: << parameters.recipe_dir >>
- deploy-pkg:
branch_label: << parameters.branch_label >>
condadir: << parameters.condadir >>
dry_run: << parameters.dry_run >>
label: << parameters.label >>
python_version: << parameters.python_version >>
recipe_dir: << parameters.recipe_dir >>
token: << parameters.token >>
deploy-pypi:
description: Test the dist for pypi via twine check
docker:
- image: circleci/python:3.8.12
parameters:
checkout:
default: false
description: Do a checkout
type: boolean
condadir:
default: ~/miniconda3
description: Install location for anaconda
type: string
dry_run:
default: false
description: Do not make an upload, only a dry run
type: boolean
pypi_password:
default: ""
description: |
User password for pypi upload. We recomment to set this via the TWINE_PASSWORD environment variable in a context.
type: string
pypi_user:
default: ""
description: |
User name for pypi upload. We recomment to set this via the TWINE_USERNAME environment variable.
type: string
run-job:
default: true
description: Whether to run the job or stop it.
type: boolean
workspace:
default: "~"
description: A workspace to attach. Attach none if empty.
type: string
steps:
- run-job:
run-job: <<parameters.run-job>>
- when:
condition: << parameters.workspace >>
steps:
- attach_workspace:
at: << parameters.workspace >>
- when:
condition: << parameters.checkout >>
steps:
- checkout
- deploy-pypi:
condadir: <<parameters.condadir>>
dry_run: << parameters.dry_run >>
pypi_password: << parameters.pypi_password >>
pypi_user: << parameters.pypi_user >>
install-and-build:
description: |
Install and build the conda package
executor: <<parameters.exec_environment>>
parameters:
build_args:
default: ""
description: Additional command line arguments for conda-build
type: string
build_dir:
default: docs/_build
description: Directory where to build the docs
type: string
build_docs:
default: true
description: Build the documentation
type: boolean
build_output:
default: linux-64
description: The output directory for the build
enum:
- linux-64
- osx-64
type: enum
build_recipe:
default: true
description: Build the conda recipe
type: boolean
build_tool:
default: mamba
description: The build tool to use (default mamba)
type: string
builders:
default: html
description: Builders to use
type: string
channels:
default: conda-forge
description: Further default channels for conda
type: string
checkout:
default: true
description: Do a checkout
type: boolean
conda_env:
default: test
description: Name of the conda environment for the tests
type: string
condadir:
default: ~/miniconda3
description: Install location for anaconda. Must end with miniconda3!
type: string
default_branch:
default: develop
description: Default branch channel for conda
type: string
docs_conda_env:
default: docs
description: Name of the conda environment for building the docs
type: string
docs_environment:
default: docs/environment.yml
description: |
Path to a conda environment file to install additional packages. Must install sphinx, too. If this is empty (or the default file does not exist), we will assume that everything is installed alread in the base conda environment.
type: string
env_packages:
default: ""
description: Extra packages to install
type: string
environment_file:
default: ci/environment.yml
description: Path to the conda environment file
type: string
exec_environment:
default: default
description: Set a custom executor for your job testing environment. By defeault the machine image will be used.
type: executor
install_opengl:
default: true
description: |
Whether to install opengl (necessary for GUI-based applications) or not
type: boolean
main_channel:
default: psyplot
description: Main channel to use with channels and for the branches
type: string
packages:
default: conda-build anaconda-client conda-verify
description: Extra packages to install into the base environment
type: string
python_version:
default: "3.8"
description: Python version
type: string
recipe_append:
default: ""
description: The full content for recipe_append.yml
type: string
recipe_dir:
default: ci/conda-recipe
description: Path to the recipe to build relative to the project directory
type: string
run-job:
default: true
description: Whether to run the job or stop it.
type: boolean
setup_env:
default: true
description: Setup a conda environment with the build package
type: boolean
source:
default: docs
description: Directory with the sphinx source files (i.e. with conf.py).
type: string
test_dist:
default: true
description: Build and test the python package with setuptools and twine
type: boolean
workspace:
default: "~"
description: A workspace to attach. Attach none if empty.
type: string
steps:
- run-job:
run-job: <<parameters.run-job>>
- install:
channels: <<parameters.channels>>
checkout: <<parameters.checkout>>
condadir: <<parameters.condadir>>
default_branch: <<parameters.default_branch>>
install_opengl: <<parameters.install_opengl>>
main_channel: <<parameters.main_channel>>
packages: <<parameters.packages>>
- when:
condition: << parameters.test_dist >>
steps:
- test-dist:
condadir: <<parameters.condadir>>
- when:
condition: << parameters.build_recipe >>
steps:
- configure-recipe:
recipe_append: <<parameters.recipe_append>>
recipe_dir: <<parameters.recipe_dir>>
- build-recipe:
build_args: <<parameters.build_args>>
build_output: <<parameters.build_output>>
build_tool: << parameters.build_tool >>
condadir: <<parameters.condadir>>
python_version: <<parameters.python_version>>
recipe_dir: <<parameters.recipe_dir>>
- when:
condition: << parameters.setup_env >>
steps:
- setup-conda-env:
conda_env: <<parameters.conda_env>>
condadir: <<parameters.condadir>>
environment_file: <<parameters.environment_file>>
packages: <<parameters.env_packages>>
python_version: <<parameters.python_version>>
recipe_dir: <<parameters.recipe_dir>>
- when:
condition: << parameters.build_docs >>
steps:
- build-docs:
build_dir: <<parameters.build_dir>>
builders: <<parameters.builders>>
conda_env: <<parameters.docs_conda_env>>
condadir: <<parameters.condadir>>
environment_file: <<parameters.docs_environment>>
source: <<parameters.source>>
- when:
condition: << parameters.workspace >>
steps:
- persist_to_workspace:
paths: ./*
root: << parameters.workspace >>
test-parallel:
description: |
Install and build the conda package
executor: <<parameters.exec_environment>>
parallelism: <<parameters.parallelism>>
parameters:
build_refs:
default: false
description: Build reference figures
type: boolean
codecov:
default: true
description: Upload test results to codecov.io
type: boolean
conda_env:
default: test
description: Name of the conda environment
type: string
condadir:
default: ~/miniconda3
description: Install location for anaconda. Must end with miniconda3!
type: string
exec_environment:
default: default
description: Set a custom executor for your job testing environment. By defeault the machine image will be used.
type: executor
packages:
default: ""
description: Extra packages to install
type: string
parallelism:
default: 4
description: How many parallel jobs to execute
type: integer
pytest_args:
default: ""
description: Any arguments passed to the pytest call
type: string
reference_figures:
default: tests/reference_figures
description: Path to the reference figures
type: string
run-job:
default: true
description: Whether to run the job or stop it.
type: boolean
test_dir:
default: tests
description: Path to the test directory
type: string
test_figures:
default: tests/test_figures
description: Path to the test figures
type: string
test_upload_dir:
default: test-results
description: Path to the directory where to store XML test files
type: string
workspace:
default: "~"
description: A workspace to attach. Attach none if empty.
type: string
steps:
- run-job:
run-job: <<parameters.run-job>>
- when:
condition: << parameters.workspace >>
steps:
- attach_workspace:
at: << parameters.workspace >>
- when:
condition: <<parameters.packages>>
steps:
- install-packages:
conda_env: <<parameters.conda_env>>
condadir: <<parameters.condadir>>
packages: <<parameters.packages>>
- run-parallel-tests:
build_refs: <<parameters.build_refs>>
conda_env: <<parameters.conda_env>>
condadir: <<parameters.condadir>>
pytest_args: <<parameters.pytest_args>>
reference_figures: <<parameters.reference_figures>>
test_dir: <<parameters.test_dir>>
test_figures: <<parameters.test_figures>>
test_upload_dir: <<parameters.test_upload_dir>>
- when:
condition: <<parameters.codecov>>
steps:
- codecov
trigger-release-workflow:
description: |
Trigger a new release workflow.
docker:
- image: cimg/base:edge
parameters:
checkout:
default: true
description: |
Checkout as a first step? Default is true
type: boolean
pipeline-param-map:
default: '{\"deploy-release\": true}'
description: |
Map of pipeline parameters that the new pipeline will be invoked with. Make use of this to target the release workflow that should be triggered and exclude other workflows from being triggered.
type: string
run-job:
default: true
description: Whether to run the job or stop it.
type: boolean
token-variable:
default: CIRCLE_TOKEN
description: |
Name of environment variable containing your personal CircleCI API token
type: env_var_name
steps:
- run-job:
run-job: <<parameters.run-job>>
- trigger-release-workflow:
checkout: <<parameters.checkout>>
pipeline-param-map: <<parameters.pipeline-param-map>>
token-variable: <<parameters.token-variable>>
examples:
example:
description: |
Sample example description.
usage:
version: "2.1"
orbs:
<orb-name>: <namespace>/<orb-name>@1.2.3
workflows:
use-my-orb:
jobs:
- <orb-name>/<job-name>