Skip to content

Commit 0554305

Browse files
authored
ci: update pipeline so it passes (#346)
1 parent ede9500 commit 0554305

File tree

4 files changed

+35
-92
lines changed

4 files changed

+35
-92
lines changed

.github/dependabot.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ updates:
33
- package-ecosystem: "gitsubmodule"
44
directory: "/"
55
schedule:
6-
interval: "daily"
6+
interval: "weekly"
77
- package-ecosystem: "pip"
88
directory: "/"
99
schedule:
10-
interval: "daily"
10+
interval: "weekly"
1111
- package-ecosystem: "github-actions"
1212
directory: "/"
1313
target-branch: "main"
1414
schedule:
15-
interval: "daily"
15+
interval: "weekly"

.github/workflows/agreements.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
call-workflow-agreements:
10-
uses: splunk/addonfactory-github-workflows/.github/workflows/reusable-agreements.yaml@v1.2.1
10+
uses: splunk/addonfactory-github-workflows/.github/workflows/reusable-agreements.yaml@v1.3
1111
secrets:
1212
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1313
PERSONAL_ACCESS_TOKEN: ${{ secrets.PAT_CLATOOL }}

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

Lines changed: 31 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- uses: actions/checkout@v3
22-
- name: run fossa anlyze and create report
22+
- name: run fossa analyze and create report
2323
run: |
2424
curl -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/fossas/fossa-cli/master/install-latest.sh | bash
2525
fossa analyze --debug
@@ -55,20 +55,6 @@ jobs:
5555
python-version: "3.7"
5656
- uses: pre-commit/action@v3.0.0
5757

58-
review_secrets:
59-
name: security-detect-secrets
60-
runs-on: ubuntu-latest
61-
steps:
62-
- name: Checkout
63-
uses: actions/checkout@v3
64-
with:
65-
submodules: false
66-
fetch-depth: "0"
67-
- name: Trufflehog Actions Scan
68-
uses: edplato/trufflehog-actions-scan@v0.9j-beta
69-
with:
70-
scanArguments: "--max_dept 50 -x .github/workflows/exclude-patterns.txt"
71-
7258
semgrep:
7359
runs-on: ubuntu-latest
7460
name: security-sast-semgrep
@@ -81,12 +67,40 @@ jobs:
8167
with:
8268
publishToken: ${{ secrets.SEMGREP_PUBLISH_TOKEN }}
8369

70+
run-unit-tests:
71+
runs-on: ubuntu-latest
72+
strategy:
73+
fail-fast: false
74+
steps:
75+
- uses: actions/checkout@v3
76+
with:
77+
submodules: true
78+
- name: Set up Python
79+
uses: actions/setup-python@v4
80+
with:
81+
python-version: 3.7
82+
- name: Install dependencies
83+
run: |
84+
curl -sSL https://install.python-poetry.org | python3 -
85+
- name: Test with pytest
86+
run: |
87+
poetry install
88+
poetry run coverage run --source=./pytest_splunk_addon_ui_smartx -m pytest -v tests/unit
89+
poetry run coverage json
90+
- name: Archive test coverage results
91+
uses: actions/upload-artifact@v3
92+
with:
93+
name: code-coverage-report-unit-tests
94+
path: coverage.json
95+
8496
build:
8597
name: build
8698
runs-on: ubuntu-latest
8799
needs:
88100
- fossa-scan
89101
- compliance-copyrights
102+
- pre-commit
103+
- run-unit-tests
90104
steps:
91105
- uses: actions/checkout@v3
92106
with:
@@ -95,18 +109,12 @@ jobs:
95109
uses: actions/setup-python@v4
96110
with:
97111
python-version: 3.7
98-
- name: Get pip cache dir
99-
id: pip-cache
100-
run: |
101-
echo "::set-output name=dir::$(pip cache dir)"
102112
- name: Install tools
103113
run: |
104-
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
114+
curl -sSL https://install.python-poetry.org | python3 -
105115
- name: Build Package
106116
id: uccgen
107117
run: |
108-
# shellcheck source=/dev/null
109-
source "$HOME"/.poetry/env
110118
poetry install
111119
poetry run poetry-dynamic-versioning
112120
poetry build
@@ -117,46 +125,7 @@ jobs:
117125
path: dist/*
118126
if: always()
119127

120-
run-unit-tests:
121-
runs-on: ubuntu-latest
122-
strategy:
123-
fail-fast: false
124-
steps:
125-
- uses: actions/checkout@v3
126-
with:
127-
submodules: true
128-
- name: Set up Python
129-
uses: actions/setup-python@v4
130-
with:
131-
python-version: 3.7
132-
- name: Install dependencies
133-
run: |
134-
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
135-
curl https://pyenv.run | bash
136-
export PATH="$HOME/.pyenv/bin:$PATH"
137-
eval "$(pyenv init -)"
138-
pyenv install 3.7.8
139-
pyenv local 3.7.8
140-
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
141-
# shellcheck source=/dev/null
142-
source ~/.poetry/env
143-
- name: Test with pytest
144-
run: |
145-
export PATH="$HOME/.pyenv/bin:$PATH"
146-
eval "$(pyenv init -)"
147-
# shellcheck source=/dev/null
148-
source ~/.poetry/env
149-
poetry install
150-
poetry run coverage run --source=./pytest_splunk_addon_ui_smartx -m pytest -v tests/unit
151-
poetry run coverage json
152-
- name: Archive test coverage results
153-
uses: actions/upload-artifact@v3
154-
with:
155-
name: code-coverage-report-unit-tests
156-
path: coverage.json
157-
158128
run-ui-tests:
159-
if: always()
160129
needs:
161130
- build
162131
runs-on: ubuntu-latest
@@ -270,34 +239,13 @@ jobs:
270239
reporter: java-junit
271240

272241
publish:
273-
if: always()
274242
needs:
275243
- pre-commit
276244
- build
277-
- review_secrets
278245
- run-ui-tests
279246
- run-unit-tests
280247
runs-on: ubuntu-latest
281-
env:
282-
NEEDS: ${{ toJson(needs) }}
283248
steps:
284-
- name: check if tests have passed or skipped
285-
if: github.event_name != 'pull_request'
286-
id: check
287-
shell: bash
288-
run: |
289-
RUN_PUBLISH=$(echo "$NEEDS" | jq ".[] | select( ( .result != \"skipped\" ) and .result != \"success\" ) | length == 0")
290-
if [[ $RUN_PUBLISH != *'false'* ]]
291-
then
292-
echo "::set-output name=run-publish::true"
293-
else
294-
echo "::set-output name=run-publish::false"
295-
fi
296-
- name: exit without publish
297-
if: ${{ steps.check.outputs.run-publish == 'false' || github.event_name == 'pull_request'}}
298-
run: |
299-
echo " some test job failed. "
300-
exit 1
301249
- name: Checkout
302250
uses: actions/checkout@v3
303251
with:
@@ -308,7 +256,7 @@ jobs:
308256
with:
309257
python-version: "3.7"
310258
- name: Install Poetry
311-
run: curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3 -
259+
run: curl -sSL https://install.python-poetry.org | python3 -
312260
- name: Semantic Release
313261
uses: cycjimmy/semantic-release-action@v3.0.0
314262
with:

.pre-commit-config.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ repos:
44
hooks:
55
- id: pyupgrade
66
args: [--py3-plus]
7-
- repo: https://github.com/PyCQA/isort
8-
rev: 5.10.1
9-
hooks:
10-
- id: isort
11-
args: ["--profile", "black"]
127
- repo: https://github.com/psf/black
138
rev: 22.3.0
149
hooks:

0 commit comments

Comments
 (0)