-
Notifications
You must be signed in to change notification settings - Fork 14
140 lines (129 loc) · 3.98 KB
/
lint_and_integration.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
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
name: Lint and integration tests
on:
push:
paths-ignore:
- 'docs/**'
branches:
- main
- autoupdate/strict
- autoupdate/moonray
- 'release-[0-9]+.[0-9]+'
- 'autoupdate/release-[0-9]+.[0-9]+-strict'
pull_request:
paths-ignore:
- 'docs/**'
permissions:
contents: read
jobs:
build-snap:
name: Build k8s-snap ${{ matrix.patch }}
uses: ./.github/workflows/build-snap.yaml
strategy:
matrix:
patch: ["", "moonray"]
with:
flavor: ${{ matrix.patch }}
test-branches:
name: Test Branch Management
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Install tox
run: pip install tox
- name: Run branch_management tests
run: |
tox -c tests/branch_management -e test
python-lint:
name: Python lint
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install tox
run: pip install tox
- name: Lint
run: |
cd tests/integration && tox -e lint
go-lint-and-unit:
name: Go lint and unit tests
uses: ./.github/workflows/go.yaml
permissions:
contents: read # for actions/checkout to fetch code
pull-requests: write # for marocchino/sticky-pull-request-comment to create or update PR comment
checks: write # for golangci/golangci-lint-action to checks to allow the action to annotate code in the PR.
get-e2e-tags:
name: Get e2e test tags
runs-on: ubuntu-latest
outputs:
test-tags: ${{ steps.get-e2e-tags.outputs.test-tags }}
needs: [build-snap, go-lint-and-unit, python-lint]
steps:
- name: Checking out repo
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Get e2e test tags
id: get-e2e-tags
run: |
tags="pull_request"
if ${{ github.event_name == 'pull_request' }}; then
# Run all tests if there are test changes. In case of a PR, we'll
# get a merge commit that includes all changes.
if git diff HEAD HEAD~1 --name-only | grep "tests/"; then
tags="up_to_weekly"
fi
# Run all tests on backports.
if echo ${{ github.base_ref }} | grep "release-"; then
tags="up_to_weekly"
fi
fi
echo "test-tags=$tags" >> "$GITHUB_OUTPUT"
test-integration:
name: Test ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu:20.04", "ubuntu:22.04", "ubuntu:24.04"]
needs: [build-snap, get-e2e-tags, go-lint-and-unit, python-lint]
uses: ./.github/workflows/e2e-tests.yaml
with:
arch: amd64
os: ${{ matrix.os }}
test-tags: ${{ needs.get-e2e-tags.outputs.test-tags}}
artifact: k8s.snap
test-integration-informing:
name: Test informing ${{ matrix.os }} ${{ matrix.patch }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu:24.04"]
patch: ["moonray"]
needs: [build-snap, get-e2e-tags, go-lint-and-unit, python-lint]
if: success() && github.event_name == 'pull_request'
uses: ./.github/workflows/e2e-tests.yaml
with:
arch: amd64
os: ${{ matrix.os }}
test-tags: ${{ needs.get-e2e-tags.outputs.test-tags}}
artifact: k8s-${{ matrix.patch }}.snap
flavor: ${{ matrix.patch }}
security-scan:
name: Security scan
needs: build-snap
uses: ./.github/workflows/security-scan.yaml
with:
artifact: ${{ needs.build-snap.outputs.snap-artifact}}
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results