-
Notifications
You must be signed in to change notification settings - Fork 12
247 lines (215 loc) · 7.74 KB
/
shaptools-ci.yml
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
---
name: Package CI
# - this workflow will
# - test on
# - SLE 12 SP5
# - python 2.7
# - SLE 15 SP5
# - python 3.6
# - deliver the package content to the configured repository
# - submit the new package content to the upstream repository
on: [push, pull_request] # yamllint disable-line rule:truthy
env:
PACKAGE_NAME: salt-shaptools
jobs:
tab:
name: 'tabspace checking'
runs-on: ubuntu-22.04
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
defaults:
run:
shell: bash
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v2
- name: tab
run: make test-tab
codespell:
name: 'spell checking'
runs-on: ubuntu-22.04
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
defaults:
run:
shell: bash
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v2
- name: Install linting tools
run: |
sudo apt-get update
sudo apt-get install -y git python3 python3-pip
python3 -m pip install codespell
- name: codespell
run: make test-codespell
shellcheck:
name: 'script syntax check'
runs-on: ubuntu-22.04
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
defaults:
run:
shell: bash
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v2
- name: Install linting tools
run: |
sudo apt-get update
sudo apt-get install -y git python3 python3-pip shellcheck
- name: shellcheck
run: make test-shellcheck
yamllint:
name: 'yaml linting'
runs-on: ubuntu-22.04
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
defaults:
run:
shell: bash
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v2
- name: Install linting tools
run: |
sudo apt-get update
sudo apt-get install -y git python3 python3-pip
python3 -m pip install yamllint
- name: yamllint
run: make test-yamllint
jsonlint:
name: 'json linting'
runs-on: ubuntu-22.04
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
defaults:
run:
shell: bash
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v2
- name: Install linting tools
run: |
sudo apt-get update
sudo apt-get install -y git python3 python3-pip
python3 -m pip install jsonlint
- name: jsonlint
run: make test-jsonlint
mlc:
name: 'markup link checker'
runs-on: ubuntu-22.04
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest
defaults:
run:
shell: bash
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v2
- name: Install linting tools
run: |
mkdir -p bin
curl -L https://github.com/becheran/mlc/releases/download/v0.14.3/mlc-x86_64-linux -o bin/mlc
chmod +x bin/mlc
echo "$PWD/bin" >> $GITHUB_PATH
- name: mlc
run: make test-mlc
python:
runs-on: ubuntu-22.04
strategy:
# do not fail if other test fails
fail-fast: false
matrix:
container:
- registry.suse.com/suse/sles12sp5:latest # python 2.7
- registry.suse.com/bci/bci-base:15.5 # python 3.6
container:
image: ${{ matrix.container }}
steps:
- name: Auth to SCC and minimal dependencies
run: |
echo "username=${{ secrets.SCC_USERNAME }}" >/etc/zypp/credentials.d/SCCcredentials
echo "password=${{ secrets.SCC_PASSWORD }}" >>/etc/zypp/credentials.d/SCCcredentials
zypper ref -s
zypper -n in -y tar gzip git
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install dependencies
run: |
zypper -n in -y make python
if test -f /usr/bin/python3; then
# minimal salt, python packages and compilers
zypper -n in -y salt python3-pip python3-devel gcc
# use current salt version shipped with SLE 15
git clone --branch=openSUSE/release/3006.0 --depth=50 https://github.com/openSUSE/salt ../salt
# python 3.6 - official requirements from salt (works with python >3.6)
pip install -r ../salt/requirements/pytest.txt
pip install -r tests/requirements.3.6.yaml # pinned pytest-cov
else
zypper -n in -y SUSEConnect
SUSEConnect -p sle-module-adv-systems-management/12/x86_64
# minimal salt, python packages and compilers
zypper -n in -y salt python-pip python-devel gcc gcc-c++
# python 2.7 - latest available versions for old python release
pip install --ignore-installed -r tests/requirements.2.7.yaml
# use current salt version shipped with SLE 12
git clone --branch=openSUSE/release/3000.3 --depth=50 https://github.com/openSUSE/salt ../salt
fi
rm ../salt/tests/conftest.py
- name: execute test script
run: make test-python
delivery:
needs: [tab, codespell, shellcheck, yamllint, jsonlint, mlc, python]
runs-on: ubuntu-22.04
if: ${{ github.event_name != 'pull_request' }}
container:
image: shap/continuous_deliver
env:
OBS_USER: ${{ secrets.OBS_USER }}
OBS_PASS: ${{ secrets.OBS_PASS }}
OBS_PROJECT: ${{ secrets.OBS_PROJECT }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: configure OSC
# OSC credentials must be configured beforehand as the HOME variables cannot be changed from /github/home
# that is used to run osc commands
run: |
/scripts/init_osc_creds.sh
mkdir -p $HOME/.config/osc
cp /root/.config/osc/oscrc $HOME/.config/osc
- name: deliver package
run: |
sed -i 's~%%VERSION%%~${{ github.sha }}~' _service && \
sed -i 's~%%REPOSITORY%%~${{ github.repository }}~' _service && \
/scripts/upload.sh
submit:
needs: [tab, codespell, shellcheck, yamllint, jsonlint, mlc, python, delivery]
runs-on: ubuntu-22.04
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master' }}
container:
image: shap/continuous_deliver
env:
OBS_USER: ${{ secrets.OBS_USER }}
OBS_PASS: ${{ secrets.OBS_PASS }}
OBS_PROJECT: ${{ secrets.OBS_PROJECT}}
TARGET_PROJECT: ${{ secrets.TARGET_PROJECT}}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: configure OSC
# OSC credentials must be configured beforehand as the HOME variables cannot be changed from /github/home
# that is used to run osc commands
run: |
/scripts/init_osc_creds.sh
mkdir -p $HOME/.config/osc
cp /root/.config/osc/oscrc $HOME/.config/osc
- name: submit package
run: |
sed -i 's~%%VERSION%%~${{ github.sha }}~' _service && \
sed -i 's~%%REPOSITORY%%~${{ github.repository }}~' _service && \
/scripts/submit.sh