Skip to main content

Add Github Actions to your existing library

tip

If you have setup your library following the template guide you can skip this page

If you already have an ArupCompute library and a Github repo setup, but you would like to set up CI/CD to deploy to ArupCompute then you can copy the template repo Github actions. On this page we will describe how to do this.

If your library was created using the template repo then you do not need to do this.

Requirements

In order to follow this guide you must:

  1. Have an ArupCompute python library already set up and pushed to ArupCompute
  2. Have a Github repo setup for your project
  3. Have your project set up in the same folder layout as the Sample Python Library
Repo folder structure

The folder structure should be organized so that the .zip file is located at the root of the repository. The Python file containing the calculations must be compressed into the .zip file.

Set up repo

From the Sample Python Library, copy the .github and .arupcompute folders and UploadScript.ps1 file and paste them into your repo.

folders

There are no Github secrets that need to be set up.

Edit config files

The folders that we just copied over contain the files required for the github actions and also the files that those actions use to publish new library versions to Arup Compute.

The main file that needs to be changed is .arupcompute/workflows/config.json. This file contains information about your library, each of these fields will need to be updated.

  1. LibraryName: You must change this to the name of your python file. Eg, if you class library was called ExampleLibrary then you should change LibraryName to ExampleLibrary
  2. LibraryId: This must be the id of your library. To find this, open your library on the ArupCompute website and then find the id in the url. For example, in the image below the id of the library would be 143:

sample library id

  1. UserId: This is your ArupCompute user id (note: this is different from your Arup Staff Id). To find this, go to the ArupCompute website and click on your profile picture in the top right. Your user id will be shown above the "Logout" button. Enter this value into the UserId section of the config.json

find user id

  1. Description: This must be the description of your library. This does not have to be the same as the description that you initially put for your library and it can be changed at any time

Once you have updated this file you should be able to run the build and release pipeline in the same way as a library generated from the template repo. For more on how to release a new version, see Making new library versions