Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-blanchard committed Aug 28, 2024
0 parents commit f2896d4
Show file tree
Hide file tree
Showing 6 changed files with 200 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: coiled-login-action

on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- '*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Coiled Login
uses: coiled/login-action@v1
with:
token: ${{ secrets.PROD_TEST_BOT_TOKEN }}

- name: Coiled Run
uses: ./
with:
command: echo "Hello, world!"
13 changes: 13 additions & 0 deletions .github/workflows/update_semver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Update Semver Tags
on:
push:
branches-ignore:
- '**'
tags:
- 'v*.*.*'
jobs:
update-semver:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: haya14busa/action-update-semver@v1
6 changes: 6 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# These owners will be the default owners/reviewers for everything in
# the repo. Unless a later match takes precedence,
# the entire @coiled/platform team will be requested for
# review when someone opens a pull request in this repo.
* @coiled/platform

29 changes: 29 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2024, Coiled
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Coiled Run GitHub Action

This GitHub Action runs a command on a [Coiled](https://coiled.io) cluster by adding the following steps to your workflow. For more details see our [CLI job docs](https://docs.coiled.io/user_guide/cli-jobs.html).

```yaml
- name: Coiled Login
uses: coiled/login-action@v1
with:
token: ${{ secrets.COILED_API_TOKEN }}
- name: Coiled Run
uses: coiled/run-action@v1
with:
command: "dask-scheduler"
```
111 changes: 111 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: 'Coiled Login'
description: 'GitHub Action to run CLI jobs on VM via Coiled'
author: 'Coiled'

branding:
icon: 'command'
color: 'blue'

inputs:
command:
description: "Command to run on VM."
required: true
name:
description: "Run name. This identifier controls whether `coiled run` invocations are dispatched to the same cloud VM or not. Use the same name to run multiple commands on the same VM. Defaults to a unique name with no VM reuse."
required: false
workspace:
description: "Coiled workspace (uses default workspace if not specified)."
required: false
software:
description: "Software environment name to use. If neither software nor container is specified, all the currently-installed Python packages are replicated on the VM using package sync."
required: false
container:
description: "Container image to use. If neither software nor container is specified, all the currently-installed Python packages are replicated on the VM using package sync."
required: false
vm-type:
description: "VM type to use. Specify multiple times to provide multiple options."
required: false
gpu:
description: "Have a GPU available."
required: false
region:
description: "The cloud provider region in which to run the notebook."
required: false
disk-size:
description: "Use larger-than-default disk on VM, specified in GiB."
required: false
keepalive:
description: "Keep your VM running for the specified time, even after your command completes. In seconds (``--keepalive 60``) unless you specify units (``--keepalive 3m`` for 3 minutes).Default to shutdown immediately after the command finishes."
required: false
file:
description: "Local files required to run command. Can be either individual file or entire directory. Multiple values can be specified, such as ``--file foo.txt --file my-subdir/``."
required: false
env:
description: "Environment variables securely transmitted to run command environment. Format is ``KEY=val``, multiple vars can be set with separate ``--env`` for each."
required: false
subdomain:
description: "Custom subdomain for the VM hostname."
required: false
allow-ssh-from:
description: "IP address or CIDR from which connections to port 22 (SSH) are open; can also be specified as 'everyone' (0.0.0.0/0) or 'me' (automatically determines public IP detected for your local client). Note that ``coiled run`` relies on SSH connection for executing commands on VM. [default: me]"
required: false
port:
description: "Open extra ports in network firewall for inbound connections (multiple ports can be set with separate ``--port`` for each)."
required: false
interactive:
description: "Open an interactive session, e.g., ``coiled run --interactive bash`` or ``coiled run --interactive python``."
required: false
detach:
description: "Start the run in the background, don't wait for the results."
required: false
sync:
description: "Sync files between local working directory and ``/scratch/synced``."
required: false
root:
description: "Act as root in Docker container."
required: false
forward-gcp-adc:
description: "Forward long-lived Google Cloud Application Default Credentials to VM for data access."
required: false
tag:
description: "Tags. Format is ``KEY=val``, multiple vars can be set with separate ``--tag`` for each."
required: false
sync-ignore:
description: "Paths to not sync when using ``--sync``."
required: false
mount-bucket:
description: "S3 or GCS bucket(s) to mount as volumes."
required: false

runs:
using: 'composite'
steps:
- name: Check if token is set
shell: bash
run: |
if [[ -z "${{ inputs.token }}" ]]; then
echo "Token is required."
exit 1
fi
- uses: actions/checkout@v4
- name: Install conda environment
uses: mamba-org/setup-micromamba@v1
with:
cache-downloads-key: coiled-run-downloads-${{ runner.arch }}
cache-environment-key: coiled-run-env-${{ runner.arch }}
generate-run-shell: false
environment-name: coiled-run
create-args: >-
python=3.12
coiled=1.45.0
- name: Run coiled run
shell: bash
run: |
args=()
for input in name workspace software container vm-type gpu region disk-size keepalive file env subdomain allow-ssh-from port interactive detach sync root forward-gcp-adc tag sync-ignore mount-bucket; do
if [[ -n "${{ inputs.$input }}" ]]; then
args+=("--$input" "${{ inputs.$input }}")
fi
done
micromamba run -n coiled-run coiled run "${{ inputs.command }}" "${args[@]}"

0 comments on commit f2896d4

Please sign in to comment.