Skip to content

Commit f2896d4

Browse files
committed
Initial commit
0 parents  commit f2896d4

File tree

6 files changed

+200
-0
lines changed

6 files changed

+200
-0
lines changed

.github/workflows/test.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: coiled-login-action
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
branches:
10+
- '*'
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Check out code
17+
uses: actions/checkout@v4
18+
19+
- name: Coiled Login
20+
uses: coiled/login-action@v1
21+
with:
22+
token: ${{ secrets.PROD_TEST_BOT_TOKEN }}
23+
24+
- name: Coiled Run
25+
uses: ./
26+
with:
27+
command: echo "Hello, world!"

.github/workflows/update_semver.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Update Semver Tags
2+
on:
3+
push:
4+
branches-ignore:
5+
- '**'
6+
tags:
7+
- 'v*.*.*'
8+
jobs:
9+
update-semver:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: haya14busa/action-update-semver@v1

CODEOWNERS

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# These owners will be the default owners/reviewers for everything in
2+
# the repo. Unless a later match takes precedence,
3+
# the entire @coiled/platform team will be requested for
4+
# review when someone opens a pull request in this repo.
5+
* @coiled/platform
6+

LICENSE

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2024, Coiled
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
1. Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
2. Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
3. Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Coiled Run GitHub Action
2+
3+
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).
4+
5+
```yaml
6+
- name: Coiled Login
7+
uses: coiled/login-action@v1
8+
with:
9+
token: ${{ secrets.COILED_API_TOKEN }}
10+
- name: Coiled Run
11+
uses: coiled/run-action@v1
12+
with:
13+
command: "dask-scheduler"
14+
```

action.yml

+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: 'Coiled Login'
2+
description: 'GitHub Action to run CLI jobs on VM via Coiled'
3+
author: 'Coiled'
4+
5+
branding:
6+
icon: 'command'
7+
color: 'blue'
8+
9+
inputs:
10+
command:
11+
description: "Command to run on VM."
12+
required: true
13+
name:
14+
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."
15+
required: false
16+
workspace:
17+
description: "Coiled workspace (uses default workspace if not specified)."
18+
required: false
19+
software:
20+
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."
21+
required: false
22+
container:
23+
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."
24+
required: false
25+
vm-type:
26+
description: "VM type to use. Specify multiple times to provide multiple options."
27+
required: false
28+
gpu:
29+
description: "Have a GPU available."
30+
required: false
31+
region:
32+
description: "The cloud provider region in which to run the notebook."
33+
required: false
34+
disk-size:
35+
description: "Use larger-than-default disk on VM, specified in GiB."
36+
required: false
37+
keepalive:
38+
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."
39+
required: false
40+
file:
41+
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/``."
42+
required: false
43+
env:
44+
description: "Environment variables securely transmitted to run command environment. Format is ``KEY=val``, multiple vars can be set with separate ``--env`` for each."
45+
required: false
46+
subdomain:
47+
description: "Custom subdomain for the VM hostname."
48+
required: false
49+
allow-ssh-from:
50+
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]"
51+
required: false
52+
port:
53+
description: "Open extra ports in network firewall for inbound connections (multiple ports can be set with separate ``--port`` for each)."
54+
required: false
55+
interactive:
56+
description: "Open an interactive session, e.g., ``coiled run --interactive bash`` or ``coiled run --interactive python``."
57+
required: false
58+
detach:
59+
description: "Start the run in the background, don't wait for the results."
60+
required: false
61+
sync:
62+
description: "Sync files between local working directory and ``/scratch/synced``."
63+
required: false
64+
root:
65+
description: "Act as root in Docker container."
66+
required: false
67+
forward-gcp-adc:
68+
description: "Forward long-lived Google Cloud Application Default Credentials to VM for data access."
69+
required: false
70+
tag:
71+
description: "Tags. Format is ``KEY=val``, multiple vars can be set with separate ``--tag`` for each."
72+
required: false
73+
sync-ignore:
74+
description: "Paths to not sync when using ``--sync``."
75+
required: false
76+
mount-bucket:
77+
description: "S3 or GCS bucket(s) to mount as volumes."
78+
required: false
79+
80+
runs:
81+
using: 'composite'
82+
steps:
83+
- name: Check if token is set
84+
shell: bash
85+
run: |
86+
if [[ -z "${{ inputs.token }}" ]]; then
87+
echo "Token is required."
88+
exit 1
89+
fi
90+
- uses: actions/checkout@v4
91+
- name: Install conda environment
92+
uses: mamba-org/setup-micromamba@v1
93+
with:
94+
cache-downloads-key: coiled-run-downloads-${{ runner.arch }}
95+
cache-environment-key: coiled-run-env-${{ runner.arch }}
96+
generate-run-shell: false
97+
environment-name: coiled-run
98+
create-args: >-
99+
python=3.12
100+
coiled=1.45.0
101+
102+
- name: Run coiled run
103+
shell: bash
104+
run: |
105+
args=()
106+
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
107+
if [[ -n "${{ inputs.$input }}" ]]; then
108+
args+=("--$input" "${{ inputs.$input }}")
109+
fi
110+
done
111+
micromamba run -n coiled-run coiled run "${{ inputs.command }}" "${args[@]}"

0 commit comments

Comments
 (0)