Github
Learn how to setup Github Actions so publishing your data science work becomes automatic!!

Prerequisites

  • Have a Kyso account - either on kyso.io or on your company's private Kyso installation.
  • Create a Kyso access token - follow these instructions.
  • Ensure your directory (or folders) contains a valid kyso.yaml file. Check the following instructions for more info.

How to integrate Kyso and Github Actions

  1. 1.
    Create a .github/workflows directory in your repository on GitHub if this directory does not already exist.
  2. 2.
    In the .github/workflows directory, create a file named kyso-action.yml.
  3. 3.
    Copy the following YAML contents into kyso-action.yml:
1
name: Push To Kyso.io
2
on: [push]
3
jobs:
4
Push-To-Kyso:
5
runs-on: ubuntu-latest
6
steps:
7
- uses: actions/[email protected]
8
- uses: actions/[email protected]
9
with:
10
node-version: 14
11
- run: npm install -g kyso
12
- run: kyso login --kysoInstallUrl https://kyso.io --provider kyso --username [YOUR_EMAIL] --token [YOUR_ACCESS_TOKEN]
13
- run: kyso push
Copied!
Note that `--kysoInstallUrl` needs to point to your company's Kyso deployment. So if your company, Acme Inc., has their Kyso on https://acme.kyso.io, then that is your install url address!

Examples in Action

Below are some examples of Github repositories that demo automating the publishing of reports to Kyso with Github actions.
1.HTML reports:
GitHub - KyleOS/kyso-html-example: Example Kyso HTML reports
GitHub
2. Multiple Jupyter projects in one repository (a Kyso "meta" folder):
GitHub - KyleOS/kyso-notebook-example: Example Jupyter notebook Kyso reports
GitHub
These repositories both have the following specifications for the purpose of this documentation:
Note that both repositories contain multiple sub-folders and so take on the type: meta , and each sub-folder will have it's own kyso.yaml file with specifications on that individual project's metadata (e.g. title, description, type, tags, etc.)
1
main: index.html
2
title: "The html example"
3
organization: kyle-o-shea
4
team: general
5
type: website
Copied!
Following these instructions, we have generated an access token and logged into Kyso under the user [email protected]
Then, to upload the report to Kyso we only need to create the kyso-action.yml and add the following stages:
1
name: Push To Kyso.io
2
on: [push]
3
jobs:
4
Push-To-Kyso:
5
runs-on: ubuntu-latest
6
steps:
7
- uses: actions/[email protected]
8
- uses: actions/[email protected]
9
with:
10
node-version: 14
11
- run: npm install -g kyso
12
- run: kyso login --kysoInstallUrl https://kyso.io --provider kyso --username [YOUR_EMAIL] --token [YOUR_ACCESS_TOKEN]
13
- run: kyso push
Copied!
This means that on each new push to the repository, a Github action will be generated to run the commands in our action file above.
However, by integrating Kyso into Git actions, the workflow is super flexible and you can refine this further and select if you want to integrate a specific branch, tag, or whatever else fits your specific workflow needs!
Here is a link to all the different event types that trigger these workflows:
Events that trigger workflows - GitHub Docs
GitHub Docs

Executing the CI/CD Pipeline

When we commit our work to Github, an Action will queued to execute. If we navigate to https://github.com/KyleOS/kyso-notebook-example we'll see that our runs are executing, first by installing the kyso CLI, logging in, and then publishing the report.
If we check the logs, this is what we will see:
1
$ npm install -g kyso
2
added 234 packages, and audited 235 packages in 19s
3
33 packages are looking for funding
4
run `npm fund` for details
5
found 0 vulnerabilities
6
$ kyso login --kysoInstallUrl https://kyso.io --provider kyso --username [YOUR USERNAME] --token [YOUR TOKEN]
7
Logged successfully
8
$ kyso push
9
Uploading report '.'
10
Founded 4 files:
11
Processing .github/workflows/kyso-action.yml
12
Processing README.md
13
Processing index.html
14
Processing kyso.yaml
15
Uploading files. Wait a moment..
16
πŸŽ‰πŸŽ‰πŸŽ‰ Reports were uploaded
17
https://kyso.io/kyle-o-shea/general/
18
πŸŽ‰πŸŽ‰πŸŽ‰
Copied!
As the reports from this repo are public, we can some examples at the following links here: