-
Notifications
You must be signed in to change notification settings - Fork 16
151 lines (142 loc) · 3.94 KB
/
Copy pathcli.yaml
File metadata and controls
151 lines (142 loc) · 3.94 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
# Copyright Built On Envoy
# SPDX-License-Identifier: Apache-2.0
# The full text of the Apache license is available in the LICENSE file at
# the root of the repo.
name: CLI
on:
push:
branches:
- main
- release/**
pull_request:
branches:
- main
- release/**
env:
GOPROXY: https://proxy.golang.org
jobs:
changes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: dorny/paths-filter@v4
id: changes
with:
filters: |
code:
- '!**/*.md'
- '!examples/**'
- '!website/**'
- '!CODEOWNERS'
predicate-quantifier: every # Make the filters be AND-ed
token: "" # don't use github api
outputs:
code: ${{ steps.changes.outputs.code }}
check:
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./cli
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v6
with:
node-version: '22'
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- run: make check
- run: make lint
build:
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./cli
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v6
with:
node-version: '22'
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- run: make build
test:
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./cli
env:
TEST_OPTS: -race
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v6
with:
node-version: '22'
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- run: make test-coverage
- uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: cli
e2e:
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./cli
env:
# For PRs, skip the long running tests. For pushes to main or release branches, run all tests.
GO_TEST_ARGS: ${{ github.event_name == 'pull_request' && '-v -test.short' || '-v' }}
TEST_BOE_REQUEST_TIMEOUT: 10s
TEST_BOE_REGISTRY: ghcr.io/tetratelabs/built-on-envoy
TEST_BOE_REGISTRY_USERNAME: ${{ github.actor }}
TEST_BOE_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v6
with:
node-version: '22'
- uses: dtolnay/rust-toolchain@stable
- uses: docker/setup-buildx-action@v4
- uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- run: make build_image
- run: make test-e2e
# Aggregate all the required jobs and make it easier to customize CI required jobs
cli-checks:
runs-on: ubuntu-latest
needs:
- check
- build
- test
- e2e
# We need this to run always to force-fail (and not skip) if any needed
# job has failed. Otherwise, a skipped job will not fail the workflow.
if: always()
steps:
- run: |
echo "CI checks completed"
[ "${{
contains(needs.*.result, 'failure') ||
contains(needs.*.result, 'cancelled')
}}" == "false" ] || exit 1