Skip to content

Commit

Permalink
feat: quick and dirty github step to install nightly mojo
Browse files Browse the repository at this point in the history
  • Loading branch information
kszucs committed Jul 21, 2024
0 parents commit ba75750
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Test Setup Mojo Action

on: [push]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Mojo
uses: ./
with:
version: '2024.7.1805'
- name: Verify Mojo installation
run: |
mojo --version
echo "Modular Home: $MODULAR_HOME"
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Github Action for setting up Mojo

Quick and dirty Github Action for setting up Mojo.

Usage:

```yaml
name: Test Setup Mojo Action

on: [push]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Mojo
uses: kszucs/setup-mojo@latest
with:
version: '2024.7.1805'
- name: Verify Mojo installation
run: |
mojo --version
echo "Modular Home: $MODULAR_HOME"
```
TODOs:
- [ ] Prefix the installation path with the version
- [ ] Bake in caching to speed up the installation
- [ ] Test other platforms
11 changes: 11 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: 'Setup Mojo'
description: 'Set up Mojo language'
inputs:
version:
description: 'The Mojo version to install'
required: true
runs:
using: 'composite'
steps:
- run: ./setup-mojo.sh ${{ inputs.version }}
shell: bash
11 changes: 11 additions & 0 deletions setup-mojo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
set -e

VERSION=$1

curl -s https://get.modular.com | sh -

modular auth test
modular install nightly/mojo --install-version $VERSION

echo "MODULAR_HOME=/home/runner/.modular" >> $GITHUB_ENV
echo "PATH=$PATH:/home/runner/.modular/pkg/packages.modular.com_nightly_mojo/bin" >> $GITHUB_ENV

0 comments on commit ba75750

Please sign in to comment.