diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..ffb7dc144 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,51 @@ +name: Python CI + +on: + [push, pull_request] + +jobs: + build: + + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + python: [2.7, 3.7] + splunk-version: + - "8.0" + - "latest" + fail-fast: false + + services: + splunk: + image: splunk/splunk:${{matrix.splunk-version}} + env: + SPLUNK_START_ARGS: --accept-license + SPLUNK_HEC_TOKEN: 11111111-1111-1111-1111-1111111111113 + SPLUNK_PASSWORD: changed! + SPLUNK_APPS_URL: https://github.com/splunk/sdk-app-collection/releases/download/v1.0.0/sdk-app-collection.tgz + ports: + - 8000:8000 + - 8088:8088 + - 8089:8089 + + steps: + - uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + - name: Create .splunkrc file + run: | + cd ~ + echo host=localhost > .splunkrc + echo port=8089 >> .splunkrc + echo username=admin >> .splunkrc + echo password=changed! >> .splunkrc + echo scheme=https >> .splunkrc + echo version=${{ matrix.splunk }} >> .splunkrc + - name: Install tox + run: pip install tox + - name: Test Execution + run: tox -e py diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 882f41b33..000000000 --- a/.travis.yml +++ /dev/null @@ -1,44 +0,0 @@ -notifications: - email: false -sudo: required - -services: - - docker - -before_install: - # Create .splunkrc file with default credentials - - echo host=127.0.0.1 >> $HOME/.splunkrc - - echo username=admin >> $HOME/.splunkrc - - echo password=changed! >> $HOME/.splunkrc - # Set SPLUNK_HOME - - export SPLUNK_HOME="/opt/splunk" - # Add DOCKER to iptables, 1/10 times this is needed, force 0 exit status - - sudo iptables -N DOCKER || true - # Start docker-compose in detached mode - - docker-compose up -d - # Health Check (3 minutes) - - for i in `seq 0 180`; do if docker exec -it splunk /sbin/checkstate.sh &> /dev/null; then break; fi; echo $i; sleep 1; done - # The upload test needs to refer to a file that Splunk has in the docker - # container - - export INPUT_EXAMPLE_UPLOAD=$SPLUNK_HOME/var/log/splunk/splunkd_ui_access.log - # After initial setup, we do not want to give the SDK any notion that it has - # a local Splunk installation it can use, so we create a blank SPLUNK_HOME - # for it, and make a placeholder for log files (which some tests generate) - - export SPLUNK_HOME=`pwd`/splunk_home - - mkdir -p $SPLUNK_HOME/var/log/splunk - -language: python - -env: - - SPLUNK_VERSION=7.3 - - SPLUNK_VERSION=8.0 - -python: - - "2.7" - - "3.7" - -install: pip install tox-travis - -before_script: python setup.py build dist - -script: tox