-
Notifications
You must be signed in to change notification settings - Fork 47
174 lines (149 loc) · 4.23 KB
/
ci.installer.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
on:
workflow_call:
pull_request:
paths:
- installer.sh
- .github/workflows/ci.installer.yml
concurrency:
group: ${{ github.ref || 'ci' }}/installer.sh
cancel-in-progress: true
permissions:
contents: read
jobs:
install-pkgx:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- macos-latest
- ubuntu-latest
steps:
- uses: actions/checkout@v4
# using cat | sh to emulate the curl command we tell people to use
- run: cat ./installer.sh | sh
- run: pkgx --version
usage-as-proxy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cat ./installer.sh | sh -s node --eval 'console.log(1)'
- run: ./installer.sh sh -c "which pkgx"
- run: source <(cat ./installer.sh) duf
- run: if command -v pkgx; then exit 1; fi
sudo-not-required:
runs-on: ubuntu-latest
container: debian:buster-slim
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
ref: curl
path: bin
- run: ./installer.sh
env:
PATH: ${{ github.workspace }}/bin:/usr/bin:/bin
eval-bash:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
eval "$(cat ./installer.sh)"
env +duf
duf --version
test -n "$BASH_VERSION"
test -z "$ZSH_VERSION"
shell: bash -e {0}
# check pkgx was installed despite executing via `eval`
- run:
pkgx duf --version
eval-zsh:
runs-on: ubuntu-latest
steps:
- name: prep
run: sudo apt-get update && sudo apt-get install -y zsh
- uses: actions/checkout@v4
- run: |
eval "$(cat ./installer.sh)"
env +duf
duf --version
test -n "$ZSH_VERSION"
test -z "$BASH_VERSION"
shell: zsh -e {0}
eval-posix-sh:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
eval "$(cat ./installer.sh)"
env +duf
duf --version
test -z "$ZSH_VERSION"
test -z "$BASH_VERSION"
shell: /bin/sh -e {0}
sudo-required:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: sudo chmod go-w /usr/local/bin
# ^^ we run as `runner` but this dir has 999 perms
- name: check
run: if touch /usr/local/bin/foo; then exit 1; fi
- run: ./installer.sh
- run: test "$(which pkgx)" = /usr/local/bin/pkgx
no-dirs:
strategy:
matrix:
dir: [/usr/local, /usr/local/bin]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: sudo mv ${{ matrix.dir }} $(mktemp -d)
- run: ./installer.sh
- run: pkgx duf --version
multiple-apply-is-ok:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cat ./installer.sh | sh
- run: cat ./installer.sh | sh
linuxen:
continue-on-error: true
runs-on: ubuntu-latest
strategy:
matrix:
container:
- debian:buster-slim
- debian:bullseye-slim
- debian:bookworm-slim
- archlinux:latest
# - ubuntu:trusty glibc too old
# - ubuntu:xenial glibc too old
# - ubuntu:bionic glibc too old
- ubuntu:focal
- ubuntu:jammy
- ubuntu:lunar
- fedora:latest
# - nixos/nix:latest can’t exec
# - alpine:latest pkgx binary doesn’t actually end up on the system (wtf)
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
ref: curl
path: bin
- run: ./installer.sh
env:
PATH: ${{ github.workspace }}/bin:/usr/bin:/bin
- run: pkgx node --eval 'console.log(1)'
upgrades:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run:
curl https://dist.pkgx.dev/pkgx.sh/linux/x86-64/v1.0.0.tar.gz |
tar xz --strip-components=3
- run: mv pkgx /usr/local/bin
- run: test "$(pkgx --version)" = 'pkgx 1.0.0'
- run: ./installer.sh
- run: pkgx semverator gt $(pkgx --version | awk '{print $2}') 1.0.0