1- name : Build Test Release
2-
31on :
42 push :
53 branches :
@@ -16,6 +14,15 @@ concurrency:
1614 cancel-in-progress : true
1715
1816jobs :
17+ meta :
18+ runs-on : ubuntu-latest
19+ outputs :
20+ matrix_supportedSplunk : ${{ steps.matrix.outputs.supportedSplunk }}
21+ steps :
22+ - uses : actions/checkout@v3
23+ - id : matrix
24+ uses : splunk/addonfactory-test-matrix-action@v1
25+
1926 fossa-scan :
2027 continue-on-error : true
2128 runs-on : ubuntu-latest
@@ -40,13 +47,10 @@ jobs:
4047 FOSSA_API_KEY : ${{ secrets.FOSSA_API_KEY }}
4148
4249 compliance-copyrights :
43- name : Compliance Copyright Headers
4450 runs-on : ubuntu-latest
4551 steps :
46- - name : Checkout
47- uses : actions/checkout@v3
48- - name : Check License Header
49- uses : apache/skywalking-eyes@v0.3.0
52+ - uses : actions/checkout@v3
53+ - uses : apache/skywalking-eyes@v0.4.0
5054
5155 pre-commit :
5256 runs-on : ubuntu-latest
6367 if : github.actor != 'dependabot[bot]'
6468 steps :
6569 - uses : actions/checkout@v3
66- - name : Semgrep
67- id : semgrep
70+ - id : semgrep
6871 uses : returntocorp/semgrep-action@v1
6972 with :
7073 publishToken : ${{ secrets.SEMGREP_PUBLISH_TOKEN }}
@@ -84,27 +87,16 @@ jobs:
8487 scanArguments : " --max_dept 50 -x .github/workflows/exclude-patterns.txt"
8588
8689 test-splunk-unit :
87- name : Unit tests
8890 runs-on : ubuntu-latest
8991 steps :
9092 - uses : actions/checkout@v3
9193 with :
9294 submodules : true
9395 - name : Install dependencies
9496 run : |
95- curl -sSL https://install.python-poetry.org | python3 -
97+ curl -sSL https://install.python-poetry.org | python3 - --version 1.4.2
9698 poetry install
97- poetry run coverage run --source=./pytest_splunk_addon/standard_lib -m pytest -v tests/unit
98- poetry run coverage xml
99- - name : Upload coverage to Codecov
100- uses : codecov/codecov-action@v3
101- with :
102- token : ${{ secrets.CODECOV_TOKEN }}
103- files : ./coverage.xml
104- directory : ./coverage/reports/
105- env_vars : OS,PYTHON
106- fail_ci_if_error : true
107- verbose : true
99+ poetry run pytest -v tests/unit
108100
109101 test-splunk-doc :
110102 name : Test Docs
@@ -118,14 +110,14 @@ jobs:
118110 python-version : 3.7
119111 - name : Install and run tests
120112 run : |
121- curl -sSL https://install.python-poetry.org | python3 -
113+ curl -sSL https://install.python-poetry.org | python3 - --version 1.4.2
122114 poetry install --with docs -E docker
123115 poetry run pytest -v -m doc tests/e2e
124116
125117 test-splunk-external :
126118 runs-on : ubuntu-latest
127- name : Test splunk external
128119 needs :
120+ - meta
129121 - pre-commit
130122 - fossa-scan
131123 - compliance-copyrights
@@ -135,22 +127,21 @@ jobs:
135127 strategy :
136128 fail-fast : false
137129 matrix :
138- splunk-version : ["8.1", "8.2", "9.0"]
130+ splunk : ${{ fromJson(needs.meta.outputs.matrix_supportedSplunk) }}
139131 steps :
140132 - uses : actions/checkout@v3
141133 with :
142134 submodules : true
143135 - name : Setup for testing
144136 run : |
145137 pip install git+https://github.com/pixelb/crudini
146- mkdir test-results-${{ matrix.splunk- version }}
138+ mkdir test-results-${{ matrix.splunk. version }}
147139 - name : Splunk Up
148140 run : |
149141 export SPLUNK_APP_PACKAGE=./tests/e2e/addons/TA_fiction
150142 export SPLUNK_ADDON=TA_fiction
151143 export SPLUNK_APP_ID=TA_fiction
152- ls -l deps/build/addonfactory_test_matrix_splunk/splunk_matrix.conf
153- export SPLUNK_VERSION=$(crudini --get deps/build/addonfactory_test_matrix_splunk/splunk_matrix.conf ${{ matrix.splunk-version }} VERSION)
144+ export SPLUNK_VERSION=${{ matrix.splunk.version }}
154145 echo $SPLUNK_VERSION
155146 docker-compose -f "docker-compose-ci.yml" build
156147 SPLUNK_PASSWORD=Chang3d! docker-compose -f docker-compose-ci.yml up -d splunk
@@ -174,8 +165,8 @@ jobs:
174165 test-results-${{ matrix.splunk-version }}
175166
176167 test-splunk-matrix :
177- name : Test Matrix
178168 needs :
169+ - meta
179170 - pre-commit
180171 - fossa-scan
181172 - compliance-copyrights
@@ -186,7 +177,7 @@ jobs:
186177 strategy :
187178 fail-fast : false
188179 matrix :
189- splunk-version : ["8.1", "8.2", "9.0"]
180+ splunk : ${{ fromJson(needs.meta.outputs.matrix_supportedSplunk) }}
190181 test-marker : [
191182 " splunk_connection_docker" ,
192183 " splunk_app_fiction" ,
@@ -203,18 +194,15 @@ jobs:
203194 - uses : actions/checkout@v3
204195 with :
205196 submodules : true
206- - name : Set up OS=ubuntu-latest::Python=3.7::Splunk=${{ matrix.splunk-version }}
207- uses : actions/setup-python@v4
197+ - uses : actions/setup-python@v4
208198 with :
209199 python-version : 3.7
210- - name : Install and run tests
211- run : |
212- curl -sSL https://install.python-poetry.org | python3 -
200+ - run : |
201+ curl -sSL https://install.python-poetry.org | python3 - --version 1.4.2
213202 poetry install -E docker
214- poetry run pytest -v --splunk-version=${{ matrix.splunk- version }} -m docker -m ${{ matrix.test-marker }} tests/e2e
203+ poetry run pytest -v --splunk-version=${{ matrix.splunk. version }} -m docker -m ${{ matrix.test-marker }} tests/e2e
215204
216205 publish :
217- name : publish
218206 needs :
219207 - test-splunk-external
220208 - test-splunk-matrix
@@ -226,8 +214,7 @@ jobs:
226214 # build if this is not set false
227215 submodules : false
228216 persist-credentials : false
229- - name : Setup python
230- uses : actions/setup-python@v4
217+ - uses : actions/setup-python@v4
231218 with :
232219 python-version : " 3.7"
233220 - uses : actions/download-artifact@v3
@@ -237,16 +224,21 @@ jobs:
237224 run : cp -f THIRDPARTY NOTICE
238225 - name : Install Poetry
239226 run : |
240- curl -sSL https://install.python-poetry.org | python3 -
241- - name : Semantic Release
242- uses : cycjimmy/semantic-release-action@v3.0.0
243- with :
244- semantic_version : 19.0.2
227+ curl -sSL https://install.python-poetry.org | python3 - --version 1.4.2
228+ - id : semantic
229+ uses : splunk/semantic-release-action@v1.3
230+ with :
231+ git_committer_name : ${{ secrets.SA_GH_USER_NAME }}
232+ git_committer_email : ${{ secrets.SA_GH_USER_EMAIL }}
233+ gpg_private_key : ${{ secrets.SA_GPG_PRIVATE_KEY }}
234+ passphrase : ${{ secrets.SA_GPG_PASSPHRASE }}
245235 extra_plugins : |
246- @semantic-release/exec
247- @semantic-release/git
248236 @google/semantic-release-replace-plugin
249237 env :
250238 GITHUB_TOKEN : ${{ secrets.GH_TOKEN_ADMIN }}
251- PYPI_USERNAME : ${{ secrets.PYPI_USERNAME }}
252- PYPI_TOKEN : ${{ secrets.PYPI_TOKEN }}
239+ - if : ${{ steps.semantic.outputs.new_release_published == 'true' }}
240+ uses : splunk/pypi-publish-action@v1.0
241+ with :
242+ pypi_username : ${{ secrets.PYPI_USERNAME }}
243+ pypi_token : ${{ secrets.PYPI_TOKEN }}
244+
0 commit comments