-
Notifications
You must be signed in to change notification settings - Fork 0
157 lines (140 loc) · 4.87 KB
/
Copy pathtest.yml
File metadata and controls
157 lines (140 loc) · 4.87 KB
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
name: Test
on:
push:
branches: [main]
pull_request:
branches: [main]
# Daily canary: the action installs from neokapi/neokapi releases, so it can
# break without a commit here (a renamed release asset did exactly that for
# 1.2.0). The schedule catches that class of breakage; the prerelease job
# below catches it while it is still an RC.
schedule:
- cron: "17 5 * * *"
workflow_dispatch:
jobs:
test-latest:
name: "Latest (${{ matrix.os }})"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v6
- name: Setup kapi (latest)
id: setup
uses: ./
with:
token: ${{ secrets.NEOKAPI_GITHUB_TOKEN }}
- name: Verify version output
shell: bash
env:
INSTALLED_VERSION: ${{ steps.setup.outputs.version }}
run: |
echo "Installed version: ${INSTALLED_VERSION}"
test -n "${INSTALLED_VERSION}"
- name: Verify kapi is on PATH
shell: bash
run: kapi version
test-pinned:
name: "Pinned version (${{ matrix.os }})"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v6
- name: Get latest version for pinned test
id: version
shell: bash
env:
GH_TOKEN: ${{ secrets.NEOKAPI_GITHUB_TOKEN }}
# Use the action's own resolver rather than a second copy of the logic.
# This step used to call `releases/latest` directly and hit exactly the
# bug the action had: neokapi/neokapi publishes plugin and app releases
# alongside CLI ones, so that flag lands on whichever was published last
# (a plugin, today), and the pinned test then asked for version
# "check-v0.1.0".
run: |
VERSION=$(./scripts/resolve-version.sh latest)
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "Pinning to CLI version ${VERSION}"
- name: Setup kapi (pinned)
id: setup
uses: ./
with:
token: ${{ secrets.NEOKAPI_GITHUB_TOKEN }}
version: ${{ steps.version.outputs.version }}
- name: Verify correct version
shell: bash
env:
EXPECTED: ${{ steps.version.outputs.version }}
ACTUAL: ${{ steps.setup.outputs.version }}
run: |
echo "Expected: ${EXPECTED}, Actual: ${ACTUAL}"
test "${EXPECTED}" = "${ACTUAL}"
# Canary against the newest CLI prerelease. Release packaging changes land
# on RCs first (the kapi_ → kapi-cli_ archive rename shipped on 1.2.0-rc1),
# so installing the newest prerelease here fails weeks before the same
# breakage would reach a stable release and every consumer workflow.
test-prerelease:
name: "Prerelease canary"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Resolve newest CLI prerelease
id: prerelease
shell: bash
env:
GH_TOKEN: ${{ secrets.NEOKAPI_GITHUB_TOKEN }}
# Same tag discipline as resolve-version.sh: only vX.Y.Z-… CLI tags,
# never plugin/app tags (check-v…, asr-v…, bowrain-v…).
run: |
VERSION=$(
gh api "repos/neokapi/neokapi/releases?per_page=100" --paginate \
--jq '.[] | select(.draft == false and .prerelease == true) | .tag_name' |
grep -E '^v[0-9]+\.[0-9]+\.[0-9]+-' |
sed 's/^v//' |
sort -V |
tail -n 1
) || true
if [ -z "${VERSION}" ]; then
echo "No CLI prerelease found — nothing to canary."
else
echo "Newest CLI prerelease: ${VERSION}"
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
- name: Setup kapi (prerelease)
if: steps.prerelease.outputs.version != ''
id: setup
uses: ./
with:
token: ${{ secrets.NEOKAPI_GITHUB_TOKEN }}
version: ${{ steps.prerelease.outputs.version }}
- name: Verify kapi is on PATH
if: steps.prerelease.outputs.version != ''
shell: bash
run: kapi version
test-cache:
name: "Cache hit (${{ matrix.os }})"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v6
# First install — populates cache
- name: Setup kapi (first)
uses: ./
with:
token: ${{ secrets.NEOKAPI_GITHUB_TOKEN }}
# Second install — should hit cache
- name: Setup kapi (cached)
uses: ./
with:
token: ${{ secrets.NEOKAPI_GITHUB_TOKEN }}
- name: Verify kapi works from cache
shell: bash
run: kapi version