Skip to content

Commit ba211f5

Browse files
committed
Replace env vars with flags to the installer. (#111)
* support --prefix/--version/--help * numerous tidy * ++robustness
1 parent fcd95b0 commit ba211f5

File tree

6 files changed

+197
-94
lines changed

6 files changed

+197
-94
lines changed

.github/smoke-test.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
set -xe
3+
test "$(~/.tea/tea.xyz/v0/bin/tea --prefix)" = "$HOME"/.tea

.github/workflows/cd.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,18 @@ jobs:
2626
- uses: andymckay/cancel-action@0.2
2727
if: ${{ steps.rev-parse.outputs.result == 'cancel' }}
2828

29-
ci:
29+
ci1:
3030
needs: [smoke]
3131
uses: ./.github/workflows/ci.yml
3232
secrets: inherit
3333

34+
ci2:
35+
needs: [smoke]
36+
uses: ./.github/workflows/ci-pre-reqs.yml
37+
secrets: inherit
38+
3439
put:
35-
needs: [ci, smoke]
40+
needs: [ci1, ci2, smoke]
3641
runs-on: ubuntu-latest
3742
steps:
3843
- name: Create Deployment

.github/workflows/ci-pre-reqs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
on:
2+
workflow_call:
23
pull_request:
34
paths:
45
- pre-reqs.ts

.github/workflows/ci.yml

Lines changed: 52 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,47 @@ jobs:
1616
runs-on: ${{ matrix.os }}
1717
strategy:
1818
matrix:
19+
verbose:
20+
- null
1921
os:
2022
- macos-latest
2123
- ubuntu-latest
22-
VERBOSE:
23-
- 1
24-
- ~
24+
include:
25+
- os: ubuntu-latest
26+
verbose: VERBOSE
2527
steps:
2628
- uses: actions/checkout@v3
2729
- run: echo foo > foo
28-
- run: ./install.sh cat ./foo
30+
- run: ./install.sh --yes cat ./foo
2931
env:
30-
VERBOSE: ${{ matrix.VERBOSE }}
31-
YES: 1
32+
VERBOSE: ${{ matrix.verbose }}
33+
3234
direct:
3335
runs-on: ${{ matrix.os }}
3436
strategy:
3537
matrix:
3638
os:
37-
- macos-latest
38-
- ubuntu-latest
39-
VERBOSE:
40-
- 1
41-
- ~
39+
- macos-latest
40+
- ubuntu-latest
41+
prefix:
42+
- ~
43+
- foo
44+
include:
45+
- os: ubuntu-latest
46+
verbose: VERBOSE
47+
prefix: /opt/tea
48+
# ^^ test absolute path (on mac this path is not writable with the
49+
# default runner user)
4250
steps:
4351
- uses: actions/checkout@v3
44-
- run: ./install.sh
52+
- run: ./install.sh --yes --prefix ${{ matrix.prefix }}
53+
if: ${{ matrix.prefix }}
4554
env:
46-
VERBOSE: ${{ matrix.VERBOSE }}
47-
YES: 1
55+
VERBOSE: ${{ matrix.verbose }}
56+
- run: ./install.sh --yes
57+
if: ${{ matrix.prefix == null }}
58+
env:
59+
VERBOSE: ${{ matrix.verbose }}
4860
- run: tea --env --dump
4961
- run: tea test
5062
- run: which tea
@@ -96,6 +108,7 @@ jobs:
96108
- run: tea --version
97109
- uses: ./
98110
- run: tea --version
111+
- run: ./install.sh # also test our script does a headless update in this case
99112

100113
# tests that we don’t require a “srcroot”
101114
emptier:
@@ -122,40 +135,55 @@ jobs:
122135
- run: brew install gum
123136
- uses: actions/checkout@v3
124137
- uses: ./
138+
- run: test ! -d ~/.tea/charm.sh
125139

126140
specific-version:
127141
runs-on: ubuntu-latest
142+
continue-on-error: true
143+
strategy:
144+
matrix:
145+
system:
146+
- gha
147+
- direct
148+
version:
149+
- 0.13.8
128150
steps:
129151
- uses: actions/checkout@v3
130152
- uses: ./
153+
if: ${{ matrix.system == 'gha' }}
131154
with:
132-
version: 0.13.8
133-
- run:
134-
test "$(tea --version)" = "tea 0.13.8"
155+
version: ${{ matrix.version }}
156+
- run: ./install.sh --yes --version ${{ matrix.version }}
157+
if: ${{ matrix.system == 'direct' }}
158+
- run: test "$(tea --version)" = "tea ${{ matrix.version }}"
135159

136160
sudo-not-required:
137161
runs-on: ubuntu-latest
138162
container: debian:buster-slim
139163
steps:
140164
- uses: actions/checkout@v3
141165
- run: apt-get update && apt-get --yes install curl
142-
- run: ./install.sh
166+
- run: ./install.sh --yes
143167

144168
sudo-required:
145169
runs-on: ubuntu-latest
146170
steps:
147171
- uses: actions/checkout@v3
148172
- run: sudo chmod go-w /usr/local/bin
149173
# ^^ we run as `runner` but this dir has 999 perms
150-
- run: ./install.sh
174+
- run: ./install.sh --yes
175+
- run: .github/smoke-test.sh
176+
- run: test $(which tea) = /usr/local/bin/tea
151177

152178
no-usr-local:
153179
runs-on: ubuntu-latest
154180
steps:
155181
- uses: actions/checkout@v3
156182
- run: sudo rm -rf /usr/local # this is fine, right?
157183
- run: sudo chmod 777 /usr # and this
158-
- run: ./install.sh
184+
- run: ./install.sh --yes
185+
- run: .github/smoke-test.sh
186+
- run: test $(which tea) = /usr/local/bin/tea
159187

160188
installs-if-gitea-found:
161189
runs-on: ubuntu-latest
@@ -174,12 +202,13 @@ jobs:
174202
which tea
175203
tea --help
176204
- uses: actions/checkout@v3
177-
- run: ./install.sh
178-
- run: test $(~/.tea/tea.xyz/v0/bin/tea --prefix) = $HOME/.tea
205+
- run: ./install.sh --yes
206+
- run: .github/smoke-test.sh
179207

180208
run-without-which:
181209
runs-on: ubuntu-latest
182210
container: archlinux:latest
183211
steps:
184212
- uses: actions/checkout@v3
185-
- run: ./install.sh
213+
- run: ./install.sh --yes
214+
- run: .github/smoke-test.sh

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[`install.sh`](./install.sh) is delivered when you `curl tea.xyz`.
44

5-
# GitHub Action 0.8.0
5+
# GitHub Action 0.9.0
66

77
This repository also provides the `tea` GitHub Action.
88

@@ -32,8 +32,9 @@ sh <(curl tea.xyz) +charm.sh/gum gum spin -- sleep 5
3232

3333
### Options
3434

35-
* `YES=1`, for headless environments, assumes affirmative for all prompts
36-
* `TEA_PREFIX=/path` change install location
35+
* `sh <(curl tea.xyz) --yes` assumes affirmative for all prompts
36+
* `sh <(curl tea.xyz) --prefix foo` change install location (you can use this option to false a re-install)
37+
* `sh <(curl tea.xyz) --version 1.2.3` install a specific version
3738

3839

3940
## Via GitHub Actions

0 commit comments

Comments
 (0)