This repository contains a brief example of Continuous integration for scientific applications, using miniconda and Python3.
Continuous Integration (CI) helps to automate the testing and delivery of scientific software tools. A CI is just a workflow that runs automatically 🤖 as a result of a certain action taken in the source code (e.g. a push, pull-request, etc.).
This repository contains 3 different configuration files for Github Actions, Travis and Gitlab CI. These configuration files encode the actions to perform with the code on a given architecture, like installing the library from scratch in a Ubuntu machine.
The Github actions configuration can be found at Python actions file. There is comprehensive documentation of what Github actions are and how to use them.
The Travis configuration file contains the configuration to call a CI workflow using Travis. See Travis tutorial.
The GitLabCI configuration file contains the configuration to call a CI workflow using the Gitlab CI. A comprehensive documentation is available for the GitLab CI tool.
If you want to use Azure pipelines, have a look at Tania Allard's great tutorial.
Sometimes you want to have more control over the hardware infrascture, compilers, etc. when performing continuous integration. GitHub Actions and GitLab CI/CD allow you to set up your infrascture. The following links contains a guide to help you run a CI workflow on your own infrascture:
This package contains a toy example to estimate the value of π using the Monte Carlo method. To run the Monte Carlo calculator, you will need to have python install. We recommend you create a conda virtual environment by following the instructions below,
- Get a copy of miniconda
- Create a new environment by running the following command:
conda create --name ci_for_science python=3.7 -y -q
- Activate the environment:
conda activate ci_for_science
Now to install this package,
- Fork and clone this repo
- install cython:
pip install cython
- install the library from the repo root folder:
cd ci_for_science && pip install -e .
- run the command line interface like:
compute_pi -n 1000
The previous command will estimate π using 1000 random points.
If you want to contribute to the development of ci_for_science, have a look at the contribution guidelines.
Copyright (c) 2019-2020,
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
This package was created with Cookiecutter and the NLeSC/python-template.