Skip to content

Continuous Integration and Continuous developement for scientific applications

License

Notifications You must be signed in to change notification settings

ci-for-research/example-python-monte-carlo-pi

Repository files navigation

image

image

image

👩‍🚀 📡 🔬 Continuous Integration for Scientific Applications

This repository contains a brief example of Continuous integration for scientific applications, using miniconda and Python3.

Overview

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.

🛠️ Setting up a CI workflow

GitHub actions

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.

Travis CI

The Travis configuration file contains the configuration to call a CI workflow using Travis. See Travis tutorial.

GitLab CI ******* The `GitLabCI configuration file <.gitlab-ci.yml>`_ contains the configuration to call aCI** workflow using the Gitlab CI. A comprehensive documentation is available for the GitLab CI tool.

Azure pipelines

If you want to use Azure pipelines, have a look at Tania Allard's great tutorial.

🚀 Running on your own infrascture

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:

🎮 Running the package examples

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,

  1. Get a copy of miniconda
  2. Create a new environment by running the following command:

    conda create --name ci_for_science python=3.7 -y -q

  3. Activate the environment:

    conda activate ci_for_science

Now to install this package,

  1. Fork and clone this repo
  2. install cython:

    pip install cython

  3. install the library from the repo root folder:

    cd ci_for_science && pip install -e .

7. run the command line interface like:

compute_pi -n 1000

The previous command will estimate π using 1000 random points.

Contributing

If you want to contribute to the development of ci_for_science, have a look at the contribution guidelines.

License

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.

Credits

This package was created with Cookiecutter and the NLeSC/python-template.

About

Continuous Integration and Continuous developement for scientific applications

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published