Skip to content

Commit caddde4

Browse files
committed
ci: make tests run in parallel (#553)
* ci: try with parallel runs * ci: do not install additional deps * ci: reorganize long-running tests to make tests faster * ci: do not need to upload dist when publishing * ci: remove snyk * ci: upload NOTICE file
1 parent 50de532 commit caddde4

File tree

1 file changed

+67
-75
lines changed

1 file changed

+67
-75
lines changed

.github/workflows/build-test-release.yml

Lines changed: 67 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -70,30 +70,7 @@ jobs:
7070
uses: returntocorp/semgrep-action@v1
7171
with:
7272
publishToken: ${{ secrets.SEMGREP_PUBLISH_TOKEN }}
73-
74-
snyk:
75-
name: security-vuln-snyk
76-
runs-on: ubuntu-latest
77-
steps:
78-
- uses: actions/checkout@v2
79-
- name: Setup python
80-
uses: actions/setup-python@v2
81-
with:
82-
python-version: 3.7
83-
- uses: snyk/actions/setup@master
84-
- uses: actions/[email protected]
85-
with:
86-
go-version: "1.13"
87-
- name: Snyk monitor
88-
run: snyk test --sarif-file-output=snyk-scan_requirements.sarif --all-projects --print-deps --severity-threshold=high
89-
env:
90-
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
91-
- uses: actions/upload-artifact@v2
92-
if: always()
93-
with:
94-
name: snyk-results
95-
path: snyk-scan_requirements.sarif
96-
73+
9774
review_secrets:
9875
name: security-detect-secrets
9976
runs-on: ubuntu-latest
@@ -116,10 +93,57 @@ jobs:
11693
uses: reviewdog/[email protected]
11794
with:
11895
github_token: ${{ secrets.GITHUB_TOKEN }}
119-
96+
97+
test-splunk-unit:
98+
name: Unit tests
99+
runs-on: ubuntu-latest
100+
steps:
101+
- uses: actions/checkout@v2
102+
with:
103+
submodules: true
104+
- name: Install dependencies
105+
run: |
106+
curl -sSL https://install.python-poetry.org | python3 -
107+
poetry install
108+
poetry run coverage run --source=./pytest_splunk_addon/standard_lib -m pytest -v tests/unit
109+
poetry run coverage xml
110+
- name: Upload coverage to Codecov
111+
uses: codecov/codecov-action@v2
112+
with:
113+
token: ${{ secrets.CODECOV_TOKEN }}
114+
files: ./coverage.xml
115+
directory: ./coverage/reports/
116+
env_vars: OS,PYTHON
117+
fail_ci_if_error: true
118+
verbose: true
119+
120+
test-splunk-doc:
121+
name: Test Docs
122+
runs-on: ubuntu-latest
123+
steps:
124+
- uses: actions/checkout@v2
125+
with:
126+
submodules: true
127+
- uses: actions/setup-python@v1
128+
with:
129+
python-version: 3.7
130+
- name: Install and run tests
131+
run: |
132+
curl -sSL https://install.python-poetry.org | python3 -
133+
poetry install -E docker
134+
poetry run pytest -v --splunk-version=${{ matrix.splunk-version }} -m doc
135+
120136
test-splunk-external:
121137
runs-on: ubuntu-latest
122138
name: Test splunk external
139+
needs:
140+
- pre-commit
141+
- compliance-dependencies
142+
- compliance-copyrights
143+
- test-splunk-doc
144+
- test-splunk-unit
145+
- review_secrets
146+
- review-dog-misspell
123147
strategy:
124148
fail-fast: false
125149
matrix:
@@ -160,31 +184,13 @@ jobs:
160184
name: splunk ${{ matrix.splunk-version }} external test artifacts
161185
path: |
162186
test-results-${{ matrix.splunk-version }}
163-
164-
test-splunk-doc:
165-
name: Test Docs
166-
runs-on: ubuntu-latest
167-
steps:
168-
- uses: actions/checkout@v2
169-
with:
170-
submodules: true
171-
- uses: actions/setup-python@v1
172-
with:
173-
python-version: 3.7
174-
- name: Install and run tests
175-
run: |
176-
sudo apt-get install -y build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl git
177-
curl -sSL https://install.python-poetry.org | python3 -
178-
poetry install -E docker
179-
poetry run pytest -v --splunk-version=${{ matrix.splunk-version }} -m doc
180187
181188
test-splunk-matrix:
182189
name: Test Matrix
183190
needs:
184191
- pre-commit
185192
- compliance-dependencies
186193
- compliance-copyrights
187-
- test-splunk-external
188194
- test-splunk-doc
189195
- test-splunk-unit
190196
- review_secrets
@@ -194,6 +200,15 @@ jobs:
194200
fail-fast: false
195201
matrix:
196202
splunk-version: [8.1, 8.2]
203+
test-name: [
204+
"test_splunk_connection_docker",
205+
"test_splunk_app_fiction",
206+
"test_splunk_app_broken",
207+
"test_splunk_app_cim",
208+
"test_splunk_fiction_indextime",
209+
"test_splunk_setup_fixture",
210+
"test_splunk_app_requirements"
211+
]
197212
steps:
198213
- uses: actions/checkout@v2
199214
with:
@@ -204,37 +219,14 @@ jobs:
204219
python-version: 3.7
205220
- name: Install and run tests
206221
run: |
207-
sudo apt-get install -y build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl git
208222
curl -sSL https://install.python-poetry.org | python3 -
209223
poetry install -E docker
210-
poetry run pytest -v --splunk-version=${{ matrix.splunk-version }} -m docker
224+
poetry run pytest -v --splunk-version=${{ matrix.splunk-version }} -m docker -k ${{ matrix.test-name }}
211225
212-
test-splunk-unit:
213-
name: Unit tests
214-
runs-on: ubuntu-latest
215-
steps:
216-
- uses: actions/checkout@v2
217-
with:
218-
submodules: true
219-
- name: Install dependencies
220-
run: |
221-
sudo apt-get install -y build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl git
222-
curl -sSL https://install.python-poetry.org | python3 -
223-
poetry install
224-
poetry run coverage run --source=./pytest_splunk_addon/standard_lib -m pytest -v tests/unit
225-
poetry run coverage xml
226-
- name: Upload coverage to Codecov
227-
uses: codecov/codecov-action@v2
228-
with:
229-
token: ${{ secrets.CODECOV_TOKEN }}
230-
files: ./coverage.xml
231-
directory: ./coverage/reports/
232-
env_vars: OS,PYTHON
233-
fail_ci_if_error: true
234-
verbose: true
235226
publish:
236227
name: publish
237228
needs:
229+
- test-splunk-external
238230
- test-splunk-matrix
239231
runs-on: ubuntu-latest
240232
steps:
@@ -251,15 +243,15 @@ jobs:
251243
uses: actions/setup-python@v2
252244
with:
253245
python-version: "3.7"
254-
- name: Install and build
246+
- uses: actions/download-artifact@v2
247+
with:
248+
name: analysis-reports
249+
path: /tmp/analysis-reports
250+
- name: Update Notices
251+
run: cp -f /tmp/analysis-reports/NOTICE_summary NOTICE
252+
- name: Install Poetry
255253
run: |
256254
curl -sSL https://install.python-poetry.org | python3 -
257-
poetry build
258-
- uses: actions/upload-artifact@v2
259-
if: always()
260-
with:
261-
name: Package
262-
path: dist/
263255
- name: Semantic Release
264256
uses: cycjimmy/[email protected]
265257
with:

0 commit comments

Comments
 (0)