-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (60 loc) · 1.9 KB
/
test.yaml
File metadata and controls
68 lines (60 loc) · 1.9 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
name: Tests
on:
push:
branches:
- main
pull_request: {}
workflow_dispatch: {}
defaults:
run:
shell: bash
jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
version: [2.11.27, latest]
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install deps and build
run: npm ci && npm run build
- name: Setup kosli CLI
id: setup
uses: ./
with:
version: ${{ matrix.version }}
- name: Capture kosli version installed
run: |
export KOSLI_VERSION=$( kosli version --short)
echo 'KOSLI_VERSION_INSTALLED<<EOF' >> $GITHUB_ENV
kosli version --short >> $GITHUB_ENV
echo "\n" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Verify pinned version
if: matrix.version != 'latest'
shell: python
env:
KOSLI_VERSION_EXPECTED: ${{ matrix.version }}
run: |
import sys, os
sys.exit(
int(not os.environ["KOSLI_VERSION_EXPECTED"] in os.environ["KOSLI_VERSION_INSTALLED"])
)
- name: Verify latest resolved to a semver
if: matrix.version == 'latest'
shell: python
env:
KOSLI_VERSION_RESOLVED: ${{ steps.setup.outputs.version }}
run: |
import os, re, sys
installed = os.environ["KOSLI_VERSION_INSTALLED"].strip()
resolved = os.environ["KOSLI_VERSION_RESOLVED"].strip()
if not re.match(r"^\d+\.\d+\.\d+", resolved):
print(f"resolved version {resolved!r} does not look like semver")
sys.exit(1)
if resolved not in installed:
print(f"resolved {resolved!r} not found in installed {installed!r}")
sys.exit(1)