-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (87 loc) · 2.64 KB
/
ci.yaml
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
name: CI
run-name: CI
on:
pull_request:
branches:
- main
workflow_dispatch:
inputs:
version:
description: The version to install
required: false
default: latest
type: string
channel:
description: The channel from which to install
required: false
default: stable
type: string
jobs:
set-matrix:
name: Set Testing Matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ env.MATRIX }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- if: github.event_name == 'workflow_dispatch'
run: |
echo "MATRIX=[ {\"version\": \"${{ inputs.version }}\", \"channel\": \"${{ inputs.channel }}\"} ]" >> $GITHUB_ENV
- uses: actions/setup-python@v5
if: github.event_name != 'workflow_dispatch'
with:
python-version: '3.11' # for better datetime.fromisoformat() support
- id: set-matrix
if: github.event_name != 'workflow_dispatch'
run: echo "MATRIX=$( python ./.github/scripts/set-matrix.py )" >> $GITHUB_ENV
- name: echo matrix
run: jq <<< '${{ env.MATRIX }}'
test-action:
name: Test Setup Crossplane CLI
runs-on: ubuntu-latest
needs: set-matrix
strategy:
fail-fast: false
matrix:
inputs: ${{ fromJSON(needs.set-matrix.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: setup-crossplane-cli-default
uses: ./
- name: setup-crossplane-cli-not-stable
uses: ./
with:
channel: master
- name: setup-crossplane-cli
uses: ./
with:
channel: ${{ matrix.inputs.channel }}
version: ${{ matrix.inputs.version }}
- name: Validate version
# versions pulled from channels other than "stable" may not have a --version flag
if: matrix.inputs.version != 'latest' && matrix.inputs.channel == 'stable'
run: |
set +e
crossplane version --client &> /dev/null
code=$?
set -e
if [ $code -eq 0 ]; then
[[ "$(crossplane version --client)" == *"${{ matrix.inputs.version }}"* ]] || exit 1
else
[[ "$(crossplane --version)" == *"${{ matrix.inputs.version }}"* ]] || exit 1
fi
ci-status:
name: CI Status
runs-on: ubuntu-latest
needs: test-action
if: always()
steps:
- name: CI Success
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: CI Failure
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1