Skip to content

Commit

Permalink
chore: separating from ucc-example repository
Browse files Browse the repository at this point in the history
  • Loading branch information
artemrys committed Sep 12, 2023
1 parent d174cf3 commit a06572a
Show file tree
Hide file tree
Showing 35 changed files with 6,583 additions and 117 deletions.
80 changes: 28 additions & 52 deletions .github/workflows/build-test-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,45 +97,20 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Install tools
run: |
curl -sSL https://install.python-poetry.org | python3 - --version 1.4.2
- name: Build Package
run: |
- run: curl -sSL https://install.python-poetry.org | python3 - --version 1.4.2
- run: |
poetry install
poetry build
- name: artifact-splunk-unpacked
uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v3
with:
name: package
path: dist/*
if: always()

prerequisites-ui-tests:
runs-on: ubuntu-latest
outputs:
ta_example_version: ${{ steps.ta-example.outputs.version }}
steps:
- name: Fetch latest version of Splunk_TA example
id: ta-example
run: |
ta_example_version=`basename $(curl -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' -s https://api.github.com/repos/splunk/splunk-add-on-for-ucc-example/releases/latest | jq -r '.assets | last | .browser_download_url')`
echo "version=$ta_example_version" >> $GITHUB_OUTPUT
- name: Cache Splunk_TA example
id: cache_ta
uses: actions/cache@v3
with:
path: Splunk_TA*.spl
key: ${{ steps.ta-example.outputs.version }}
- name: Download Splunk_TA example
if: steps.cache_ta.outputs.cache-hit != 'true'
run: curl -s https://api.github.com/repos/splunk/splunk-add-on-for-ucc-example/releases/latest | jq -r '.assets | last | .browser_download_url' | wget -i -

run-ui-tests:
needs:
- meta
- build
- prerequisites-ui-tests
runs-on: ubuntu-latest
permissions:
id-token: write
Expand All @@ -145,14 +120,15 @@ jobs:
fail-fast: false
matrix:
splunk: ${{ fromJson(needs.meta.outputs.matrix_supportedSplunk) }}
browser: ["chrome", "firefox"]
test_suit: [
browser: ["chrome"]
# browser: ["chrome", "firefox"]
test_suite: [
"test_splunk_ta_example_addon_logging",
"test_splunk_ta_example_addon_account",
"test_splunk_ta_example_addon_proxy",
"test_splunk_ta_example_addon_input",
"test_splunk_ta_example_addon_custom",
"test_splunk_ta_example_addon_alert_actions"
# "test_splunk_ta_example_addon_account",
# "test_splunk_ta_example_addon_proxy",
# "test_splunk_ta_example_addon_input",
# "test_splunk_ta_example_addon_custom",
# "test_splunk_ta_example_addon_alert_actions"
]
steps:
- uses: actions/checkout@v4
Expand All @@ -162,31 +138,31 @@ jobs:
with:
name: package
path: dist/
- name: update submodule
run: |
git submodule sync
git submodule update --recursive --remote
- name: Cache Splunk_TA example
id: cache_ta
uses: actions/cache@v3
- run: |
git submodule sync
git submodule update --recursive --remote
- uses: actions/setup-python@v4
with:
path: Splunk_TA*.spl
key: ${{ needs.prerequisites-ui-tests.outputs.ta_example_version }}
python-version: 3.7
- run: curl -sSL https://install.python-poetry.org | python3 - --version 1.4.2
- name: Setup for testing
run: |
mkdir output test-results
tar -xvf Splunk_TA*.spl -C output/
pip install git+https://github.com/pixelb/crudini
poetry install
poetry run ucc-gen build \
--source=tests/testdata/Splunk_TA_UCCExample/package \
--config=tests/testdata/Splunk_TA_UCCExample/globalConfig.json \
--ta-version=0.0.1
- name: Splunk Testing
run: |
mkdir test-results
export SPLUNK_VERSION=${{ matrix.splunk.version }}
SPLUNK_APP_ID=$(crudini --get tests/deps/splunk-add-on-for-ucc-example/package/default/app.conf id name)
SPLUNK_APP_ID=Splunk_TA_UCCExample
export SPLUNK_APP_ID
SPLUNK_APP_PACKAGE=output/$(ls output/)
SPLUNK_APP_PACKAGE=output/Splunk_TA_UCCExample
export SPLUNK_APP_PACKAGE
export TEST_SET=tests/ui
export TEST_BROWSER="${{ matrix.browser }}"
export TEST_SUITE="-k ${{ matrix.test_suit }}"
export TEST_SUITE="-k ${{ matrix.test_suite }}"
export SAUCE_USERNAME="${{ secrets.SAUCE_USERNAME }}"
export SAUCE_PASSWORD="${{ secrets.SAUCE_PASSWORD }}"
export SAUCE_TUNNEL_ID="${{ secrets.SAUCE_TUNNEL_ID }}"
Expand Down Expand Up @@ -229,12 +205,12 @@ jobs:
- uses: actions/upload-artifact@v3
if: always()
with:
name: test-results-${{ matrix.splunk }}_${{ matrix.python-version }}_${{ matrix.browser }}_${{ matrix.test_suit }}
name: test-results-${{ matrix.splunk }}_${{ matrix.python-version }}_${{ matrix.browser }}_${{ matrix.test_suite }}
path: test-results/*
- uses: dorny/test-reporter@v1
if: always()
with:
name: test-report-${{ matrix.splunk }}_${{ matrix.python-version }}_${{ matrix.browser }}_${{ matrix.test_suit }}
name: test-report-${{ matrix.splunk }}_${{ matrix.python-version }}_${{ matrix.browser }}_${{ matrix.test_suite }}
path: "test-results/*.xml"
reporter: java-junit

Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
Expand Down
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[submodule "tests/deps/splunk-add-on-for-ucc-example"]
path = tests/deps/splunk-add-on-for-ucc-example
branch = main
url = https://github.com/splunk/splunk-add-on-for-ucc-example
[submodule "tests/deps/build/addonfactory_test_matrix_splunk"]
path = tests/deps/build/addonfactory_test_matrix_splunk
url = https://github.com/splunk/addonfactory_test_matrix_splunk
Expand Down
10 changes: 1 addition & 9 deletions Dockerfile-saucelabs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
#Splunk Connect for Syslog (SC4S) by Splunk, Inc.
#
#To the extent possible under law, the person who associated CC0 with
#Splunk Connect for Syslog (SC4S) has waived all copyright and related or neighboring rights
#to Splunk Connect for Syslog (SC4S).
#
#You should have received a copy of the CC0 legalcode along with this
#work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
FROM circleci/python:3.7
RUN curl https://saucelabs.com/downloads/sc-4.6.2-linux.tar.gz -o /home/circleci/saucelabs.tar.gz
RUN tar -xzf /home/circleci/saucelabs.tar.gz --directory /home/circleci/
CMD /home/circleci/sc-4.6.2-linux/bin/sc -u $SAUCE_USERNAME -k $SAUCE_PASSWORD -i $SAUCE_TUNNEL_ID --no-remove-colliding-tunnels -v --se-port 4445
CMD /home/circleci/sc-4.6.2-linux/bin/sc -u $SAUCE_USERNAME -k $SAUCE_PASSWORD -i $SAUCE_TUNNEL_ID --no-remove-colliding-tunnels -v --se-port 4445
15 changes: 3 additions & 12 deletions Dockerfile-tests
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
#Splunk Connect for Syslog (SC4S) by Splunk, Inc.
#
#To the extent possible under law, the person who associated CC0 with
#Splunk Connect for Syslog (SC4S) has waived all copyright and related or neighboring rights
#to Splunk Connect for Syslog (SC4S).
#
#You should have received a copy of the CC0 legalcode along with this
#work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
FROM ubuntu:latest
RUN mkdir -p /work/tests
RUN mkdir -p /work/test-results/functional
Expand All @@ -36,17 +28,16 @@ RUN export DEBIAN_FRONTEND=noninteractive ;\
ENV LANG en_US.utf8

COPY dist /work/dist
COPY tests/pytest-ci.ini /work/pytest.ini
COPY tests/ui/pytest-ci.ini /work/pytest.ini
RUN pip install /work/dist/*.whl
RUN pip install pytest-splunk-addon
RUN pip install pytest-expect
RUN pip install pytest-rerunfailures
COPY tests/entrypoint.sh /
COPY tests/deps/splunk-add-on-for-ucc-example/tests /work/tests
COPY tests/deps/splunk-add-on-for-ucc-example/.pytest.expect /work/.pytest.expect
COPY tests /work/tests
COPY tests/ui/.pytest.expect /work/.pytest.expect
RUN cd /work/tests && ls
RUN cd ../..
COPY tests/deps/splunk-add-on-for-ucc-example/package /work/package

WORKDIR /work

Expand Down
Loading

0 comments on commit a06572a

Please sign in to comment.