setup-rez
Github Action to setup rez package system.
Usage
# Ensure there is a python interpreter first to install rez!
- uses: actions/setup-python@v1
with:
python-version: "${{ matrix.python }}"
- uses: j0yu/setup-rez@v1
# ALL below inputs are optional, these values are the default ones
with:
# GitHub repository to install rez from.
source: 'nerdvegas/rez'
# Git tag/branch/commit to use.
ref: 'master'
# Create all default "rez config packages_path".
makePackagesPaths: true
# Comma separated packages to rez bind, e.g. "pip, python, os".
# To disable, just pass in an empty string "bind: ''"
# See "rez bind --list".
# Will force the creation of "rez config local_packages_path"
binds: "os, python"
Example
Make sure you run actions/setup-python before using j0yu/setup-rez
name: CI
on: [push]
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v1
with:
python-version: 2.7
# Using custom rez repository and version
- uses: j0yu/setup-rez@v1
with:
source: "mottosso/bleeding-rez"
ref: "2.33.0"
# Check if rez is on PATH, check configs and rez bind packages
- run: rez --version
- run: rez config local_packages_path
- run: rez config release_packages_path
- run: rez config packages_path
- run: rez view os
- run: rez view python
# If our repository has a package.py, let's try test build/installing it
- uses: actions/checkout@v2
- run: rez build --install
How it works
Everything is done in the run function in index.js:
-
Get cached install for the
sourceandrefinput combination -
If there is no installs/tools cache install rez:
-
Downloads and extracts from
https://github.com/${source}/archive/${ref}.tar.gz -
If
install.pyexists, install viapython install.py DESTelse, if
setup.pyexists, install viapip install --target DEST SRC -
Store required environment variable paths to append in a
setup.json
-
-
Load and append environment variables paths from
setup.jsonTypically
PATHforrezcommand,PYTHONPATHif usedpip install --target. -
Create any
rez config package_pathsfolders if required. -
Create any
rez bind PKG...packages if required.
Notes on install style availability:
| Rez | (1st) install.py | (2nd) pip install |
|---|---|---|
| nerdvegas/rez | Always | 2.33.0+ |
| mottosso/bleeding-rez | NEVER | Always |
Developing
Clone this repository down and modify:
-
index.jsfor the inner workings and logic. -
action.ymlfor input/output and action definition.- GitHub: Building actions specifically Metadata Syntax
-
.github/workflows/ci.ymlfor tests.
at the humble beginnings...
I didn't want to have npm installed, so here's the Docker contained way I worked on CentOS-7. See Creating a JavaScript action.
-
Clone this repository.
-
cdinto the repository. -
Edit the
action.yml -
Setup
npmpackage using Docker container.alias npm="docker run --rm -it -v "$(pwd):$(pwd)" --user "$(id -u):$(id -g)" -w "$(pwd)" node:12 npm" npm init -y npm install @actions/core --save npm install @actions/exec --save npm install @actions/io --save npm install @actions/tool-cache --save -
Edit the
index.js -
Add paths required, then push:
git add --force action.yml index.js node_modules/* package.json package-lock.json README.md git commit git push