Skip to content

Commit

Permalink
chore: update everything according to the latest standards (#791)
Browse files Browse the repository at this point in the history
* chore: update everything according to the latest standards

* chore: forgot about .addonmatrix

* ci: remove codecov integration

* chore: wait for Splunk's KVStore to be ready

* chore: attach credentials when making request to KVStore API

* style: pre-commit run --all-files

* chore: actually use response.json() instead of response

* chore: update list of internal errors to ignore error from splunk_secure_gateway app

* chore: remove KVStore additional verification
  • Loading branch information
artemrys authored and mbruzda-splunk committed Jul 25, 2023
1 parent 125e135 commit ca6b2c3
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 1,186 deletions.
1 change: 1 addition & 0 deletions .addonmatrix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--splunkfeatures METRICS_MULTI,PYTHON3
88 changes: 40 additions & 48 deletions .github/workflows/build-test-release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
name: Build Test Release

on:
push:
branches:
Expand All @@ -16,6 +14,15 @@ concurrency:
cancel-in-progress: true

jobs:
meta:
runs-on: ubuntu-latest
outputs:
matrix_supportedSplunk: ${{ steps.matrix.outputs.supportedSplunk }}
steps:
- uses: actions/checkout@v3
- id: matrix
uses: splunk/addonfactory-test-matrix-action@v1

fossa-scan:
continue-on-error: true
runs-on: ubuntu-latest
Expand All @@ -40,13 +47,10 @@ jobs:
FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY }}

compliance-copyrights:
name: Compliance Copyright Headers
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Check License Header
uses: apache/skywalking-eyes@v0.3.0
- uses: actions/checkout@v3
- uses: apache/skywalking-eyes@v0.4.0

pre-commit:
runs-on: ubuntu-latest
Expand All @@ -63,8 +67,7 @@ jobs:
if: github.actor != 'dependabot[bot]'
steps:
- uses: actions/checkout@v3
- name: Semgrep
id: semgrep
- id: semgrep
uses: returntocorp/semgrep-action@v1
with:
publishToken: ${{ secrets.SEMGREP_PUBLISH_TOKEN }}
Expand All @@ -84,27 +87,16 @@ jobs:
scanArguments: "--max_dept 50 -x .github/workflows/exclude-patterns.txt"

test-splunk-unit:
name: Unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install dependencies
run: |
curl -sSL https://install.python-poetry.org | python3 -
curl -sSL https://install.python-poetry.org | python3 - --version 1.4.2
poetry install
poetry run coverage run --source=./pytest_splunk_addon/standard_lib -m pytest -v tests/unit
poetry run coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
directory: ./coverage/reports/
env_vars: OS,PYTHON
fail_ci_if_error: true
verbose: true
poetry run pytest -v tests/unit
test-splunk-doc:
name: Test Docs
Expand All @@ -118,14 +110,14 @@ jobs:
python-version: 3.7
- name: Install and run tests
run: |
curl -sSL https://install.python-poetry.org | python3 -
curl -sSL https://install.python-poetry.org | python3 - --version 1.4.2
poetry install --with docs -E docker
poetry run pytest -v -m doc tests/e2e
test-splunk-external:
runs-on: ubuntu-latest
name: Test splunk external
needs:
- meta
- pre-commit
- fossa-scan
- compliance-copyrights
Expand All @@ -135,22 +127,21 @@ jobs:
strategy:
fail-fast: false
matrix:
splunk-version: ["8.1", "8.2", "9.0"]
splunk: ${{ fromJson(needs.meta.outputs.matrix_supportedSplunk) }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Setup for testing
run: |
pip install git+https://github.com/pixelb/crudini
mkdir test-results-${{ matrix.splunk-version }}
mkdir test-results-${{ matrix.splunk.version }}
- name: Splunk Up
run: |
export SPLUNK_APP_PACKAGE=./tests/e2e/addons/TA_fiction
export SPLUNK_ADDON=TA_fiction
export SPLUNK_APP_ID=TA_fiction
ls -l deps/build/addonfactory_test_matrix_splunk/splunk_matrix.conf
export SPLUNK_VERSION=$(crudini --get deps/build/addonfactory_test_matrix_splunk/splunk_matrix.conf ${{ matrix.splunk-version }} VERSION)
export SPLUNK_VERSION=${{ matrix.splunk.version }}
echo $SPLUNK_VERSION
docker-compose -f "docker-compose-ci.yml" build
SPLUNK_PASSWORD=Chang3d! docker-compose -f docker-compose-ci.yml up -d splunk
Expand All @@ -174,8 +165,8 @@ jobs:
test-results-${{ matrix.splunk-version }}
test-splunk-matrix:
name: Test Matrix
needs:
- meta
- pre-commit
- fossa-scan
- compliance-copyrights
Expand All @@ -186,7 +177,7 @@ jobs:
strategy:
fail-fast: false
matrix:
splunk-version: ["8.1", "8.2", "9.0"]
splunk: ${{ fromJson(needs.meta.outputs.matrix_supportedSplunk) }}
test-marker: [
"splunk_connection_docker",
"splunk_app_fiction",
Expand All @@ -203,18 +194,15 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up OS=ubuntu-latest::Python=3.7::Splunk=${{ matrix.splunk-version }}
uses: actions/setup-python@v4
- uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Install and run tests
run: |
curl -sSL https://install.python-poetry.org | python3 -
- run: |
curl -sSL https://install.python-poetry.org | python3 - --version 1.4.2
poetry install -E docker
poetry run pytest -v --splunk-version=${{ matrix.splunk-version }} -m docker -m ${{ matrix.test-marker }} tests/e2e
poetry run pytest -v --splunk-version=${{ matrix.splunk.version }} -m docker -m ${{ matrix.test-marker }} tests/e2e
publish:
name: publish
needs:
- test-splunk-external
- test-splunk-matrix
Expand All @@ -226,8 +214,7 @@ jobs:
# build if this is not set false
submodules: false
persist-credentials: false
- name: Setup python
uses: actions/setup-python@v4
- uses: actions/setup-python@v4
with:
python-version: "3.7"
- uses: actions/download-artifact@v3
Expand All @@ -237,16 +224,21 @@ jobs:
run: cp -f THIRDPARTY NOTICE
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v3.0.0
with:
semantic_version: 19.0.2
curl -sSL https://install.python-poetry.org | python3 - --version 1.4.2
- id: semantic
uses: splunk/semantic-release-action@v1.3
with:
git_committer_name: ${{ secrets.SA_GH_USER_NAME }}
git_committer_email: ${{ secrets.SA_GH_USER_EMAIL }}
gpg_private_key: ${{ secrets.SA_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.SA_GPG_PASSPHRASE }}
extra_plugins: |
@semantic-release/exec
@semantic-release/git
@google/semantic-release-replace-plugin
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_ADMIN }}
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
- if: ${{ steps.semantic.outputs.new_release_published == 'true' }}
uses: splunk/pypi-publish-action@v1.0
with:
pypi_username: ${{ secrets.PYPI_USERNAME }}
pypi_token: ${{ secrets.PYPI_TOKEN }}

5 changes: 0 additions & 5 deletions .github/workflows/sr-prepare.sh

This file was deleted.

6 changes: 0 additions & 6 deletions .github/workflows/sr-release.sh

This file was deleted.

5 changes: 2 additions & 3 deletions .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,8 @@
[
"@semantic-release/exec",
{
"prepareCmd": "./.github/workflows/sr-prepare.sh ${nextRelease.version}",
"publishCmd": "./.github/workflows/sr-release.sh",
"shell": "bash"
"verifyReleaseCmd": "echo \"version=${nextRelease.version}\" >> $GITHUB_OUTPUT",
"successCmd": "echo \"new_release_published=${'true'}\" >> $GITHUB_OUTPUT"
},
],
[
Expand Down
Loading

0 comments on commit ca6b2c3

Please sign in to comment.