Skip to content

Commit c51f3c0

Browse files
authored
Initial release (#1)
* Initial README with idea * Initial action.yml * Initial index.js * Updated README, added node.js paths * Added testing CI * Added checkout, disabled outputs * Removed await * Wrapped in async run * Using our getInstallPy * Added muchos log messages * toString? * backticks? * Added typeof * more typeof * Fixed srcFolder * getInstallPy thorws error * Switched some to use core.debug * Defined makePackagesPaths, binds. Fixed macOS * Using comma separated instead * Initial implementation of binds and packages_path * Trying fs.mkdir instead * Trying with os.EOL split * Replacing before mkdirP * Fixed trimRight * Added inputs test * Excluding mottosso master, updated versions * WIP README update, index.js tidy * Added notes on new pip style install fallback * New logic for falling back to setup.py * Renamed, using filePath variable * Disabled most CI, added debug messages * Fixing str/object path error * Testing bleeding rez * Switched to use getDirentPath * Fixed bad var name * Initial rezInstall env vars object * Debugging * New addToEnv * Added ignore for jsdoc * Added jsdocs CI * Updated, fixed some documentations * Updated README and CI * Fixed no jekyll, bad setuptools bind * Test bind rez and hello world * Ready for merge and release
1 parent 8ed99bf commit c51f3c0

File tree

579 files changed

+192515
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

579 files changed

+192515
-1
lines changed

.github/workflows/ci.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: CI
2+
on: [push]
3+
4+
jobs:
5+
docs:
6+
name: JSDocs
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v2
11+
- uses: actions/setup-node@v1
12+
with:
13+
node-version: '12.x'
14+
- run: npm install jsdoc
15+
- run: ./node_modules/.bin/jsdoc index.js README.md
16+
- uses: actions/upload-artifact@v1
17+
with:
18+
name: jsdoc
19+
path: out
20+
- name: Force push to GitHub pages
21+
if: github.ref == 'refs/heads/master'
22+
run: |
23+
mv .git out/.git
24+
cd out
25+
git checkout -B gh-pages
26+
git config user.name "${{ github.actor }}"
27+
git config user.email "${{ github.actor }}@${{ github.sha }}"
28+
touch .nojekyll
29+
git add .
30+
git commit \
31+
-m "Generated from GitHub "${{ github.workflow }}" Workflow" \
32+
-m "See https://github.com/${{ github.repository }}/runs/${GITHUB_ACTION}" \
33+
&& git push --force origin gh-pages \
34+
|| echo "Nothing new to commit and push"
35+
36+
37+
test:
38+
name: ${{ matrix.os }} Py${{ matrix.python }}
39+
runs-on: ${{ matrix.os }}
40+
strategy:
41+
matrix:
42+
os:
43+
- ubuntu-latest
44+
- macOS-latest
45+
- windows-latest
46+
python:
47+
- 2.7
48+
- 3.7
49+
fail-fast: true
50+
51+
steps:
52+
- uses: actions/checkout@v2
53+
- uses: actions/setup-python@v1
54+
with:
55+
python-version: "${{ matrix.python }}"
56+
57+
- uses: ./
58+
59+
- run: rez --version
60+
- run: rez config local_packages_path
61+
- run: rez config release_packages_path
62+
- run: rez config packages_path
63+
- run: rez view os
64+
- run: rez view python
65+
66+
inputs:
67+
name: ${{ matrix.ref }}@${{ matrix.source }}:${{ matrix.makePackagesPaths }} ${{ matrix.binds }}
68+
runs-on: ubuntu-latest
69+
strategy:
70+
max-parallel: 10
71+
matrix:
72+
source:
73+
- nerdvegas/rez
74+
- mottosso/bleeding-rez
75+
ref:
76+
- master
77+
- 2.33.0
78+
binds:
79+
- ''
80+
- 'os, python'
81+
- 'rez, hello_world'
82+
makePackagesPaths:
83+
- true
84+
- false
85+
86+
steps:
87+
- uses: actions/checkout@v2
88+
- uses: actions/setup-python@v1
89+
with:
90+
python-version: 2.7
91+
92+
- uses: ./
93+
with:
94+
source: ${{ matrix.source }}
95+
ref: ${{ matrix.ref }}
96+
binds: ${{ matrix.binds }}
97+
makePackagesPaths: ${{ matrix.makePackagesPaths }}
98+
99+
- run: rez status

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# jsdoc
2+
/out/
3+
14
# Logs
25
logs
36
*.log

README.md

Lines changed: 149 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,150 @@
1+
![CI](https://github.com/j0yu/setup-rez/workflows/CI/badge.svg?branch=master)
2+
13
# setup-rez
2-
Github Action to setup rez package system
4+
5+
Github Action to setup [rez] package system.
6+
7+
8+
## Usage
9+
10+
```yaml
11+
# Ensure there is a python interpreter first to install rez!
12+
- uses: actions/setup-python@v1
13+
with:
14+
python-version: "${{ matrix.python }}"
15+
16+
- uses: j0yu/setup-rez@v1
17+
# ALL below inputs are optional, these values are the default ones
18+
with:
19+
# GitHub repository to install rez from.
20+
source: 'nerdvegas/rez'
21+
22+
# Git tag/branch/commit to use.
23+
ref: 'master'
24+
25+
# Create all default "rez config packages_path".
26+
makePackagesPaths: true
27+
28+
# Comma separated packages to rez bind, e.g. "pip, python, os".
29+
# To disable, just pass in an empty string "bind: ''"
30+
# See "rez bind --list".
31+
# Will force the creation of "rez config local_packages_path"
32+
binds: "os, python"
33+
```
34+
35+
## Example
36+
37+
Make sure you run [actions/setup-python](github.com/actions/setup-python)
38+
before using [j0yu/setup-rez](github.com/j0yu/setup-rez)
39+
40+
```yaml
41+
name: CI
42+
on: [push]
43+
44+
jobs:
45+
test:
46+
name: Test
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/setup-python@v1
50+
with:
51+
python-version: 2.7
52+
53+
# Using custom rez repository and version
54+
- uses: j0yu/setup-rez@v1
55+
with:
56+
source: "mottosso/bleeding-rez"
57+
ref: "2.33.0"
58+
59+
# Check if rez is on PATH, check configs and rez bind packages
60+
- run: rez --version
61+
- run: rez config local_packages_path
62+
- run: rez config release_packages_path
63+
- run: rez config packages_path
64+
- run: rez view os
65+
- run: rez view python
66+
67+
# If our repository has a package.py, let's try test build/installing it
68+
- uses: actions/checkout@v2
69+
- run: rez build --install
70+
```
71+
72+
## How it works
73+
74+
Everything is done in the `run` function in `index.js`:
75+
76+
1. Get cached install for the `source` and `ref` input combination
77+
1. If there is no installs/tools cache install rez:
78+
1. Downloads and extracts from `https://github.com/${source}/archive/${ref}.tar.gz`
79+
1. If `install.py` exists, install via `python install.py DEST`
80+
81+
else, if `setup.py` exists, install via `pip install --target DEST SRC`
82+
1. Store required environment variable paths to append in a `setup.json`
83+
1. Load and append environment variables paths from `setup.json`
84+
85+
Typically `PATH` for `rez` command, `PYTHONPATH` if used `pip install --target`.
86+
87+
1. Create any `rez config package_paths` folders if required.
88+
1. Create any `rez bind PKG...` packages if required.
89+
90+
Notes on install style availability:
91+
92+
Rez | (1st) install.py | (2nd) pip install
93+
----------------------|------------------|------------------
94+
nerdvegas/rez | Always | 2.33.0+
95+
mottosso/bleeding-rez | NEVER | Always
96+
97+
98+
## Developing
99+
100+
Clone this repository down and modify:
101+
102+
- `index.js` for the inner workings and logic.
103+
104+
- [Node.js 12x] API docs
105+
- [GitHub Action Toolkit Sub-Packages]
106+
107+
- `action.yml` for input/output and action definition.
108+
109+
- [GitHub: Building actions] specifically [Metadata Syntax]
110+
111+
- `.github/workflows/ci.yml` for tests.
112+
113+
114+
115+
<details><summary>at the humble beginnings...</summary>
116+
117+
I didn't want to have npm installed, so here's the Docker contained way I
118+
worked on CentOS-7. See [Creating a JavaScript action].
119+
120+
1. Clone this repository.
121+
1. `cd` into the repository.
122+
1. Edit the `action.yml`
123+
1. Setup `npm` package using Docker container.
124+
125+
```bash
126+
alias npm="docker run --rm -it -v "$(pwd):$(pwd)" --user "$(id -u):$(id -g)" -w "$(pwd)" node:12 npm"
127+
npm init -y
128+
npm install @actions/core --save
129+
npm install @actions/exec --save
130+
npm install @actions/io --save
131+
npm install @actions/tool-cache --save
132+
```
133+
1. Edit the `index.js`
134+
1. Add paths required, then push:
135+
136+
```bash
137+
git add --force action.yml index.js node_modules/* package.json package-lock.json README.md
138+
git commit
139+
git push
140+
```
141+
142+
</details>
143+
144+
[GitHub Action Toolkit Sub-Packages]: https://github.com/actions/toolkit#packages
145+
[Metadata Syntax]: https://help.github.com/en/actions/building-actions/metadata-syntax-for-github-actions
146+
[Node.js 12x]: https://nodejs.org/dist/latest-v12.x/docs/api/
147+
[GitHub: Building actions]: https://help.github.com/en/actions/building-actions
148+
[rez]: https://github.com/nerdvegas/rez
149+
[actions/setup-python]: https://github.com/actions/setup-python
150+
[Creating a JavaScript action]: https://help.github.com/en/actions/building-actions/creating-a-javascript-action

action.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: "Setup rez"
2+
description: "Install and bind rez packages."
3+
4+
inputs:
5+
source:
6+
description: "GitHub repository to install rez from."
7+
required: false
8+
default: 'nerdvegas/rez'
9+
10+
ref:
11+
description: "Git tag/branch/commit to use."
12+
required: false
13+
default: 'master'
14+
15+
makePackagesPaths:
16+
description: Create all default "rez config packages_path".
17+
required: false
18+
default: true
19+
20+
binds:
21+
description: >
22+
Comma separated packages to rez bind, e.g. "os, python".
23+
See "rez bind --list". Will force the creation of
24+
"rez config local_packages_path"
25+
required: false
26+
default: os, python
27+
28+
runs:
29+
using: 'node12'
30+
main: 'index.js'

0 commit comments

Comments
 (0)