Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc fixes & linting #31

Merged
merged 8 commits into from
Jun 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 43 additions & 48 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,71 +1,66 @@
name: "Check CML GitHub Action"

name: Check CML GitHub Action
on: [push]

jobs:
check:
if: "!contains(github.event.head_commit.message, '[ci skip]')"
defaults:
run:
shell: bash
strategy:
matrix:
runs-on: [ '{"runs-on": "ubuntu-latest"}',
'{"runs-on": "macos-latest"}',
'{"runs-on": "ubuntu-latest", "container": "ubuntu:18.04"}',
'{"runs-on": "windows-latest"}']

runs-on: ${{ fromJSON(matrix.runs-on).runs-on }}
container: ${{ fromJSON(matrix.runs-on).container }}

system:
- ubuntu-latest
- macos-latest
- windows-latest
include:
- system: ubuntu-18.04
container: ubuntu:18.04
runs-on: ${{ matrix.system }}
container: ${{ matrix.container }}
steps:
- name: "git"
if: "fromJSON(matrix.runs-on).container == 'ubuntu:18.04'"
- name: install deps

This comment was marked as off-topic.

if: matrix.container == 'ubuntu:18.04'
run: |
apt update -y
apt install software-properties-common -y
apt update
apt install -y software-properties-common
add-apt-repository ppa:git-core/ppa
apt -y update && apt install -y git

apt update
apt install -y git fontconfig make gcc pkg-config
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we document these deps?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#23; probably (?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alternatively we could add this to the action itself?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're there just because the Ubuntu Docker images are really bare-bones and doesn't include them. We can include them in the action, but that would imply including operating system checks. What if users choose a container with Alpine Linux? 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be safer to either ignore or document them.

- uses: actions/checkout@v2

- uses: actions/setup-node@v1
if: "fromJSON(matrix.runs-on).container == 'ubuntu:18.04'
|| contains(fromJSON(matrix.runs-on).runs-on, 'windows')"
- uses: actions/setup-node@v2
if:
matrix.container == 'ubuntu:18.04' || matrix.system ==
'windows-latest'
with:
node-version: '12'

- uses: iterative/setup-cml@v1
- run: npm ci
- run: npm run lint
- run: npm run test
casperdcl marked this conversation as resolved.
Show resolved Hide resolved
- name: local action with '0.3.0'
uses: ./
with:
version: '0.1.30'

- name: "CML specific version test"
if: "!contains(fromJSON(matrix.runs-on).runs-on, 'windows')"
version: '0.3.0'
- name: test CML specific version
if: matrix.system != 'windows-latest'
run: |
CML_VER=$(npm list -g --depth=0 | grep dvcorg/cml | cut -d'@' -f 3)
if [ $CML_VER != '0.1.30' ]; then
CML_VER="$(cml-publish --version 2>&1)"
if [ "$CML_VER" != '0.3.0' ]; then
exit 1
fi

- uses: iterative/setup-cml@v1

- name: "CML unistall and install latest test"
if: "!contains(fromJSON(matrix.runs-on).runs-on, 'windows')"
- name: local action with defaults
uses: ./
- name: test CML latest version
if: matrix.system != 'windows-latest'
run: |
CML_VER=$(npm list -g --depth=0 | grep dvcorg/cml | cut -d'@' -f 3)
echo $CML_VER
if [ $CML_VER == '0.1.30' ]; then
CML_VER="$(cml-publish --version 2>&1)"
if [ "$CML_VER" == '0.3.0' ]; then
exit 1
fi

- name: "Install fontconfig"
if: "contains(fromJSON(matrix.runs-on).container, 'ubuntu:18.04')"
run: apt install --yes fontconfig

- name: "CML test"
if: "!contains(fromJSON(matrix.runs-on).runs-on, 'windows')"
- name: test CML
env:
repo_token: ${{ secrets.GITHUB_TOKEN }}
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo 'Hello CML!' > report.md
echo 'Hello CML from ${{ matrix.system }}!' > report.md

vl2svg assets/vega-lite.json | cml-publish --md >> report.md
vl2png assets/vega-lite.json | cml-publish --md >> report.md

Expand Down
2 changes: 0 additions & 2 deletions .restyled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@ restylers:
- name: prettier
arguments: ['--write']
include:
- 'src/**/*.js'
- 'bin/**/*.js'
- 'assets/*.json'
- './**/*.{yaml,yml,md,json}'
77 changes: 29 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,40 @@

![CML](https://user-images.githubusercontent.com/414967/90448663-1ce39c00-e0e6-11ea-8083-710825d2e94e.png)

Continuous Machine Learning ([CML](https://cml.dev/)) is an open-source library
Continuous Machine Learning ([CML](https://cml.dev)) is an open-source library
for implementing continuous integration & delivery (CI/CD) in machine learning
projects. Use it to automate parts of your development workflow, including model
training and evaluation, comparing ML experiments across your project history,
and monitoring changing datasets.
projects. Use it to automate parts of your development workflow, including
machine provisioning; model training and evaluation; comparing ML experiments
across your project history, and monitoring changing datasets.

The [iterative/setup-cml](https://github.com/iterative/setup-cml) action is a
JavaScript workflow that provides [CML](https://cml.dev/) functions in your
GitHub Actions workflow. The action allows users to install CML without using
the CML Docker container.
The [iterative/setup-cml](https://github.com/iterative/setup-cml) can be used as
a GitHub Action to provide [CML](https://cml.dev) functions in your workflow.
The action allows users to install CML without using the CML Docker container.

This action gives you:

- Functions like `cml-publish` and `cml-send-comment` for publishing data
visualization and metrics from your CI workflow as comments in a pull request.
- `cml-runner`, a function that enables workflows to provision cloud and
on-premise computing resources for training models
- Access to all [CML functions](https://github.com/iterative/cml#cml-functions).
For example:
- `cml-publish` and `cml-send-comment` for publishing data visualization and
metrics from your CI workflow as comments in a pull request.
- `cml-pr` to create a pull request.
- `cml-runner`, a function that enables workflows to provision cloud and
on-premise computing resources for training models.
- The freedom 🦅 to mix and match CML with your favorite data science tools and
environments
environments.

Note that CML does not include DVC and its dependencies- for that, you want the
[Setup DVC Action](https://github.com/iterative/setup-dvc).
Note that CML does not include DVC and its dependencies (see the
[Setup DVC Action](https://github.com/iterative/setup-dvc)).

## Usage

This action has been tested on `ubuntu-latest` and `macos-latest`.
This action is tested on `ubuntu-latest`, `macos-latest` and `windows-latest`.

Basic usage:

```yaml
steps:
- uses: actions/checkout@v2

- uses: iterative/setup-cml@v1
```

Expand All @@ -43,42 +44,33 @@ A specific version can be pinned to your workflow.
```yaml
steps:
- uses: actions/checkout@v2

- uses: iterative/setup-cml@v1
with:
version: '1.0.1'
version: '3.0.0'
```

## Inputs

The following inputs are supported.

- `version` - (optional) The version of CML to install. A value of `latest` will
install the latest version of CML functions. Defaults to `latest`.

## Outputs

Setup CML has no outputs.
- `version` - (optional) The version of CML to install (e.g. '3.0.0'). Defaults
to 'latest' for the
[most recent CML release](https://github.com/iterative/cml/releases).

## A complete example

![](https://github.com/iterative/cml/blob/master/imgs/cml_first_report.png) _A
sample CML report from a machine learning project displayed in a Pull Request._
![](https://static.iterative.ai/img/cml/first_report.png) _A sample CML report
from a machine learning project displayed in a Pull Request._

Assume that we have a machine learning script, `train.py`, that outputs an image
`plot.png`.
Assume that we have a machine learning script, `train.py` which outputs an image
`plot.png`:

```yaml
steps:
- uses: actions/checkout@v2

- uses: iterative/setup-cml@v1
with:
version: latest

- run: |
# train will generate plot.png
python train.py
python train.py --output plot.png

echo 'My first CML report' > report.md
cml-publish plot.png --md > report.md
Expand All @@ -87,16 +79,5 @@ steps:

### CML functions

CML provides several helper functions to help package outputs from ML workflows,
such as numeric data and data vizualizations about model performance, into a CML
report. Below is a list of functions for writing markdown reports and delivering
those reports to your Pull Request as a comment.
[Read the docs](https://github.com/iterative/cml#readme).

| Function | Description | Inputs |
| ----------------------- | ----------------------------------------------------------- | --------------------------------------------------------- |
| `cml-send-comment` | Return CML report as a comment in your GitHub pull request. | `<path to report> --head-sha <sha>` |
| `cml-send-github-check` | Return CML report as a check in GitHub | `<path to report> --head-sha <sha>` |
| `cml-publish` | Publish an image for writing to CML report. | `<path to image> --title <image title> --md` |
| `cml-tensorboard-dev` | Return a link to a Tensorboard.dev page | `--logdir <path to logs> --title <experiment title> --md` |
| `cml-runner` | Starts a runner locally or in cloud providers | [check docs](https://github.com/iterative/cml#arguments) |
CML provides several helper functions. See
[the docs](https://github.com/iterative/cml#cml-functions).
18 changes: 9 additions & 9 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: 'Setup CML (Continuous Machine Learning)'
description: 'Sets up CML (Continuous Machine Learning) in your GitHub Actions workflow.'
author: 'Iterative, Inc.'
name: Setup CML (Continuous Machine Learning)
description: Sets up CML (Continuous Machine Learning) - https://cml.dev.
author: Iterative, Inc.
inputs:
version:
description: 'The version of CML to install. A value of `latest` will install the latest version of CML. Defaults to `latest`.'
default: 'latest'
description: The version of CML to install (e.g. '3.0.0').
default: latest
required: false
runs:
using: 'node12'
main: 'dist/index.js'
using: node12
main: dist/index.js
branding:
icon: 'terminal'
color: 'purple'
icon: terminal
color: purple
Loading