-
Notifications
You must be signed in to change notification settings - Fork 39
207 lines (184 loc) · 5.53 KB
/
test.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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
name: Test
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
permissions:
contents: write
jobs:
remove-cache:
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install github cli
run: |
(type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \
&& sudo mkdir -p -m 755 /etc/apt/keyrings \
&& wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
- run: |
gh cache delete --all || true
env:
GH_TOKEN: ${{ github.token }}
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: ./
- name: Install dependencies
run: bun install
- name: Run tests
run: bun test --coverage
setup-bun:
runs-on: ${{ matrix.os }}
continue-on-error: true
needs: [remove-cache, tests]
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
bun-version:
- latest
- canary
- "1.1.0"
- "1.x"
- "1"
- "> 1.0.0"
- "< 2"
# Disable <sha> support for now. This is because Github Artifacts
# expire after 90 days, and we don't have another source of truth yet.
# - "822a00c4d508b54f650933a73ca5f4a3af9a7983" # 1.0.0 commit
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: ./
id: setup_bun
with:
bun-version: ${{ matrix.bun-version }}
- name: Run Bun
id: run_bun
run: |
bun --version
setup-bun-from-file:
name: setup-bun from (${{ matrix.os }}, ${{ matrix.file.name }})
runs-on: ${{ matrix.os }}
continue-on-error: true
needs: [remove-cache, tests]
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
file:
- name: package.json ([email protected])
file: package.json
run: |
echo "$(jq '. += {"packageManager": "[email protected]"}' package.json)" > package.json
- name: /foo/package.json ([email protected])
file: /foo/package.json
run: |
echo "$(jq '. += {"packageManager": "[email protected]"}' package.json)" > /foo/package.json
- name: package.json (yarn@[email protected])
file: package.json
run: |
echo "$(jq '. += {"packageManager": "yarn@[email protected]"}' package.json)" > package.json
- name: .tool-versions (bun 1.1.0)
file: .tool-versions
run: |
echo "bun 1.1.0" > .tool-versions
- name: .tool-versions (bun1.1.0)
file: .tool-versions
run: |
echo "bun1.1.0" > .tool-versions
- name: .tool-versions (bun 1.1.0)
file: .tool-versions
run: |
echo "bun 1.1.0" > .tool-versions
- name: .bumrc (1.1.0)
file: .bumrc
run: |
echo "1.1.0" > .bumrc
- name: .bun-version (1.1.0)
file: .bun-version
run: |
echo "1.1.0" > .bun-version
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup file
run: ${{ matrix.file.run }}
- name: Setup Bun
uses: ./
with:
bun-version-file: ${{ matrix.file.file }}
- name: Compare versions
uses: ./.github/actions/compare-bun-version
with:
bun-version: "1.1.0"
setup-bun-download-url:
name: setup-bun from (${{ matrix.os }}, download url)
runs-on: ${{ matrix.os }}
continue-on-error: true
needs: [remove-cache, tests]
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: ./
id: setup_bun
with:
bun-download-url: "https://github.com/oven-sh/bun/releases/latest/download/bun-${{runner.os == 'macOS' && 'darwin' || runner.os}}-${{ runner.arch == 'X64' && 'x64' || 'aarch64' }}.zip"
- name: Run Bun
id: run_bun
run: |
bun --version
setup-bun-registry:
name: setup-bun registry (${{ matrix.os }})
runs-on: ${{ matrix.os }}
continue-on-error: true
needs: [remove-cache, tests]
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: ./
id: setup_bun
with:
registries: |
[
{
"url": "https://username:[email protected]/",
"scope": "@myorg"
}
]
- name: Run Bun
id: run_bun
run: |
bun --version
bun add @myorg/example