GithubHelp home page GithubHelp logo

philipluk / setup-rez Goto Github PK

View Code? Open in Web Editor NEW

This project forked from j0yu/setup-rez

1.0 1.0 0.0 1.39 MB

Github Action to setup rez package system

Home Page: https://j0yu.github.io/setup-rez/

License: MIT License

JavaScript 100.00%
pluk-universal-pipeline pluk-rez pluk-githubactions

setup-rez's Introduction

CI

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'

    # Install using "python" as the Python interpreter
    pythonExe: 'python'

    # 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

For VMs, make sure you run actions/setup-python before using j0yu/setup-rez so it has access to a Python Interpreter.

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

Containers

If you're using container you'll need to install Python as per the image/system instead of using actions/setup-python.

name: CI
on: [push]

jobs:
  test-centos7:
    name: Test CentOS 7 (${{ matrix.yum_python }})
    runs-on: ubuntu-latest
    container:
      image: "centos:7"
    strategy:
      matrix:
        yum_python:
          - "python"  # Python 2.7
          - "python3" # Python 3.6

    steps:
      - run: yum install -y ${{ matrix.yum_python }}
      - uses: j0yu/setup-rez@v1
        with:
          pythonExe: ${{ matrix.yum_python }}
      - run: rez --version
      - run: rez python -V

In this example, centos:7 uses an old glibc and isn't compatible with actions/setup-python. But rez is ok with Python 2.7 and above (as recent as 2.93.0):

  • python: j0yu/setup-rez will use a slightly updated Python 2.7 interpreter that's already shipped with centos:7.
  • python3: j0yu/setup-rez will run rez's install.py using python3 (nice coincidence) as the interpreter, instead of the default python.

How it works

Everything is done in the run function in index.js:

  1. Get cached install for the source and ref input combination

  2. If there is no installs/tools cache install rez:

    1. Downloads and extracts from https://github.com/${source}/archive/${ref}.tar.gz

    2. If install.py exists, install via python install.py DEST

      else, if setup.py exists, install via pip install --target DEST SRC

    3. Store required environment variable paths to append in a setup.json

  3. Load and append environment variables paths from setup.json

    Typically PATH for rez command, PYTHONPATH if used pip install --target.

  4. Create any rez config package_paths folders if required.

  5. 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:

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.

  1. Clone this repository.

  2. cd into the repository.

  3. Edit the action.yml

  4. Setup npm package 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
  5. Edit the index.js

  6. 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

setup-rez's People

Contributors

j0yu avatar dependabot[bot] avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.