Skip to content

Commit bc5244e

Browse files
committed
Allow specifying other pkgs; allow “chaste” mode (#137)
1 parent 73d1d42 commit bc5244e

5 files changed

Lines changed: 130 additions & 41 deletions

File tree

.github/workflows/cd.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ permissions:
77
contents: read
88

99
jobs:
10+
# check if this is a new release
1011
smoke:
1112
runs-on: ubuntu-latest
1213
outputs:
@@ -29,12 +30,12 @@ jobs:
2930
- uses: andymckay/cancel-action@0.2
3031
if: ${{ steps.rev-parse.outputs.result == 'cancel' }}
3132

32-
ci1:
33+
ci:
3334
needs: [smoke]
3435
uses: ./.github/workflows/ci.yml
3536
secrets: inherit
3637

37-
ci2:
38+
ci-pre-reqs:
3839
needs: [smoke]
3940
uses: ./.github/workflows/ci-pre-reqs.yml
4041
secrets: inherit
@@ -43,7 +44,7 @@ jobs:
4344
permissions:
4445
contents: write
4546
deployments: write
46-
needs: [ci1, ci2, smoke]
47+
needs: [ci, ci-pre-reqs, smoke]
4748
runs-on: ubuntu-latest
4849
steps:
4950
- name: Create Deployment

.github/workflows/ci.yml

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
env:
6363
VERBOSE: ${{ matrix.verbose }}
6464
- run: tea --env
65-
- run: tea --env xc test
65+
- run: tea --env xc check
6666
# ^^ tea -E necessary because we run the install script and not the action
6767
# so no additions to PATH or magic is installed
6868
- run: which tea
@@ -106,9 +106,46 @@ jobs:
106106
- run: test v$VERSION = v${{ steps.tea.outputs.version }}
107107
- run: tea --env
108108
- run: which tea
109-
- run: tea xc test
109+
- run: tea xc check
110110
- run: node --eval 'console.log(1)'
111111

112+
chaste:
113+
runs-on: ubuntu-latest
114+
container: debian:buster-slim
115+
steps:
116+
- uses: actions/checkout@v3
117+
- uses: ./
118+
with:
119+
chaste: true
120+
- run:
121+
if node --version; then
122+
exit 1;
123+
fi
124+
125+
additional-pkgs:
126+
runs-on: ubuntu-latest
127+
steps:
128+
- uses: actions/checkout@v3
129+
- uses: ./
130+
with:
131+
+deno.land: ^1.30
132+
# ^^ produces a warning, but we like this syntax
133+
# we're hoping GH allows us to suppress this warning in the future
134+
# discussion: https://github.com/octokit/request-action/issues/26
135+
- run: deno --version
136+
137+
additional-pkgs-2:
138+
runs-on: ubuntu-latest
139+
steps:
140+
- uses: actions/checkout@v3
141+
- uses: ./
142+
with:
143+
+: |
144+
deno.land^1.30
145+
cli.github.com
146+
- run: deno --version
147+
- run: gh --version
148+
112149
multiple-apply:
113150
runs-on: ubuntu-latest
114151
steps:

README.md

Lines changed: 48 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,64 @@
11
![tea](https://tea.xyz/banner.png)
22

3-
[`install.sh`](./install.sh) is delivered when you `curl tea.xyz`.
3+
* [`install.sh`](./install.sh) is delivered when you `curl tea.xyz`.
4+
* This repository also provides the `tea` GitHub Action.
45

5-
# GitHub Action 0.13.2
66

7-
This repository also provides the `tea` GitHub Action.
7+
# GitHub Action 0.14.0
88

99
```yaml
1010
- uses: teaxyz/setup@v0
1111
```
1212
13+
Installs tea, your dependencies (computed from your developer environment),
14+
adds your deps to `PATH` and exports some other *tea’ish* variables like
15+
`VERSION`.
1316

14-
# Usage
17+
See [`action.yml`] for all inputs and outputs, but here’s the usual ones:
1518

16-
## Via Terminal
19+
```yaml
20+
- uses: teaxyz/setup@v0
21+
with:
22+
+: |
23+
deno.land^1.30
24+
rust-lang.org^1.60
25+
```
26+
27+
Our packages are named after their homepages, to see what is available you
28+
can browse the pantry on our website:
29+
[tea.xyz] (we agree this isn’t great UX)
30+
31+
## Magic
32+
33+
We cannot install our shell magic into GitHub Actions. So unless you manually
34+
add a package with `+:` you will need to ensure it is called with a `tea`
35+
prefix, eg. `tea npx`.
36+
37+
## Interesting Usages
38+
39+
At tea, we consider the version in the `README` the definitive version.
40+
Thus we use GitHub Actions to automatically tag and publish that version when
41+
the README is edited and the version changes.
42+
43+
See our CI scripts for details.
44+
45+
46+
47+
# `tea` Installer
48+
49+
To install tea:
1750

1851
```sh
19-
sh <(curl tea.xyz)
52+
$ sh <(curl tea.xyz)
2053
2154
# - installs to `~/.tea`
2255
# - if tea is already installed, the script instead checks for updates
2356
```
2457

58+
To use tea to run a command in a temporary sandbox:
59+
2560
```sh
26-
sh <(curl -Ssf tea.xyz) gum spin -- sleep 5
61+
$ sh <(curl -Ssf tea.xyz) gum spin -- sleep 5
2762

2863
# - if tea is installed, uses that installation to run gum
2964
# - if tea is *not* installed, downloads gum and its deps to a safe and
@@ -32,44 +67,26 @@ sh <(curl -Ssf tea.xyz) gum spin -- sleep 5
3267

3368
> NOTE we omit `https://` for clarity, *please* include it in all your usages.
3469
35-
### Options
70+
## Options
3671

3772
* `sh <(curl tea.xyz) --yes` assumes affirmative for all prompts
3873
* `sh <(curl tea.xyz) --prefix foo` change install location (you can use this option to force a re-install)
3974
* `sh <(curl tea.xyz) --version 1.2.3` install a specific version of tea
4075

4176

42-
## Via GitHub Actions
43-
44-
```yaml
45-
- uses: teaxyz/setup@v0
46-
```
47-
48-
Installs tea, your dependencies (listed in your `README.md`), adds your deps
49-
to `PATH` and exports some other *tea’ish* variables like `VERSION`.
50-
51-
See [`action.yml`] for all inputs and outputs.
52-
53-
> NOTE: we cannot install our shell magic, so if eg. `npx` is not listed in
54-
> your dependencies you will need to invoke it as `tea npx` to use it.
55-
56-
### Interesting Usages
57-
58-
At tea, we consider the version in the `README` the definitive version.
59-
Thus we use GitHub Actions to automatically tag and publish that version when
60-
the README is edited and the version changes.
61-
62-
See our CI scripts for details.
6377

78+
&nbsp;
6479

6580
# Tasks
6681

67-
## Test
82+
## Check
6883

69-
Run this with `xc test`.
84+
Run this with `xc check`.
7085

7186
```sh
7287
node --check ./action.js
7388
```
7489

90+
7591
[`action.yml`]: ./action.yml
92+
[tea.xyz]: https://tea.xyz

action.js

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@ async function go() {
2020
return path.normalize(TEA_DIR)
2121
})()
2222

23+
const additional_pkgs = []
24+
for (let key in process.env) {
25+
if (key.startsWith("INPUT_+")) {
26+
const value = process.env[key]
27+
if (key == 'INPUT_+') {
28+
for (const item of value.split(/\s+/)) {
29+
if (item.trim()) {
30+
additional_pkgs.push(`+${item}`)
31+
}}} else {
32+
key = key.slice(6).toLowerCase()
33+
additional_pkgs.push(key+value)
34+
}}}
35+
2336
// we build to /opt and special case this action so people new to
2437
// building aren’t immediatelyt flumoxed
2538
if (PREFIX == '/opt' && os.platform == 'darwin') {
@@ -91,17 +104,19 @@ async function go() {
91104
const vv = parseFloat(v)
92105
const env_flag = vv >= 0.19 ? '--env --keep-going' : '--env'
93106

94-
// install packages
95-
execSync(`${teafile} --sync ${env_flag} echo`, {env})
96-
97107
// get env FIXME one call should do init
98108

99-
const args = vv >= 0.21
109+
let args = vv >= 0.21
100110
? ""
101111
: vv >= 0.19
102112
? "--dry-run"
103113
: "--dump"
104-
out = execSync(`${teafile} ${env_flag} ${args}`, {env}).toString()
114+
115+
if (process.env["INPUT_CHASTE"] == "true") {
116+
args += " --chaste"
117+
}
118+
119+
out = execSync(`${teafile} --sync ${env_flag} ${args} ${additional_pkgs.join(" ")}`, {env}).toString()
105120

106121
const lines = out.split("\n")
107122
for (const line of lines) {
@@ -134,6 +149,7 @@ async function go() {
134149
}
135150
}
136151

152+
//TODO deprecated exe/md
137153
const target = process.env['INPUT_TARGET']
138154
if (target) {
139155
execSync(`${teafile} ${target}`, {stdio: "inherit", env})

action.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,24 @@ inputs:
1212
The version of teaxyz/cli to install.
1313
Defaults to the most recent published version.
1414
required: false
15+
chaste:
16+
description: >
17+
Do not install packages.
18+
Defaults to `false`.
19+
default: false
20+
+:
21+
description: |
22+
Whitespace separated, pkgs to supplement the environment. eg.
23+
24+
```yaml
25+
+: |
26+
deno.land^1.30
27+
rust-lang.org^1.60
28+
```
29+
30+
By default tea reads your developer environment and adds those packages.
31+
Specifying additional packages here is a way to augment that.
32+
required: false
1533
srcroot:
1634
description: |
1735
Override detection of `$SRCROOT`.

0 commit comments

Comments
 (0)