-
Notifications
You must be signed in to change notification settings - Fork 0
Adding CI to a BHoM Repository
Fraser Greenroyd edited this page Apr 15, 2020
·
3 revisions
This page provides a brief introduction to how to set up a BHoM repository to include Continuous Integration (CI) checks.
There are some key terms to note for the use of this workflow.
- Check - an action (or collection of) that culminates in a definable operation that is checked against for code validation
- Pipeline - this is the document that outlines the steps a 'check' will undertake
- Bot - this is the automated system providing the CI check
- Make sure you have an issue raised on your repository outlining the desire to initiate CI checks for transparency and follow the usual BHoM guidelines on development (branch naming, PR process, etc.) during this process
- Clone
Test_Toolkit
onmaster
branch to get the latest, approved set of CI files required - Copy the folder
.ci
(found withinTest_Toolkit/.ci
) to your toolkit so that it matches the folder patternYour_Toolkit/.ci
- Open each
.yml
file within a text editor of your choice and alter the following variables:-
solution
- Update this to be the name of your.sln
file -
projectName
- Update this to be the name of your repository/folder/project - This needs to be done on:
check-all-dependants.yml
-
check-core.yml
- this should only be copied for Core BHoM repositories and not every toolkit should need this check-installer.yml
run-compliance-tests.yml
-
- Open
testSettings.runsettings
file within a text editor of your choice and alter the following variables (near the bottom of the file):-
projectName
- Update this to be the name of your project, same as the one used in item 5 above -
oMName
- Update this to be the name of your oM files,null
if you do not have an oM in your toolkit -
engineName
- Update this to be the name of your engine files,null
if you do not have an engine in your toolkit -
adapterName
- Update this to be the name of your adapter files,null
if you do not have an adapter in your toolkit
-
- Ensure the file
CloneTest.ps1
exists inYour_Toolkit/.ci/CloneTest.ps1
- but do not make any changes to this file - Set up your
dependencies.txt
file by adding all of the repositories which your repository is dependant on to build, in the format ofOrganisation/Repository
. For example, every toolkit should haveBHoM/BHoM
andBHoM/BHoM_Engine
listed in theirdependencies.txt
- Set up your
dependants.txt
file by adding all of the repositories which depend on your repository - this should not need to be used by most toolkits, but can be used to check downstream repositories when changes are made to yours - Commit these changes against the issue raised and raise a PR on your toolkit
- Contact the administrators in charge of your given CI platform to initiate pipelines against the repository you have set up CI checks on to begin the next step
This guidance is specific to the Azure DevOps CI workflow - for alternative workflows you may need to investigate yourself. Please feel free to append additional workflows to this wiki as appropriate.
This process should be repeated for every pipeline you wish to add
- Go to the
Pipelines/Builds
part of the Azure panel - Create a new folder with the name of your repository to house your pipelines
- Click to add a new build pipeline
- Select your code repository (most likely
GitHub
- not theEnterprise Server
) - Select your repository from the list
- Select
Existing Azure Pipelines YAML file
on the Configure page - Select the branch which stores your new
.ci
files - Select the path to the
.yml
file for this pipeline - Click continue
- Click run to run your pipeline for the first time
- After your pipeline has run, rename your pipeline to refer to the check being run (e.g.
Your_Toolkit.CheckInstaller
for the installer pipeline, etc.) - this name should make sense for the pipeline being run
Some pipelines will want to be triggered on different actions than commits. To do this, follow the steps below.
- Click Edit on the pipeline you wish to set up different triggers on
- Go to the triggers section
- Select the triggers for
Pull Request Validation
as appropriate - Click save and give a comment stating what you've done
CI checks are now set up on your repository!