|
| 1 | +name: CI - Pull Request |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + |
| 8 | +jobs: |
| 9 | + test: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v2 |
| 13 | + |
| 14 | + - uses: actions/setup-python@v2 |
| 15 | + with: |
| 16 | + python-version: '3.8' |
| 17 | + |
| 18 | + - name: Install pipenv |
| 19 | + run: python -m pip install pipenv |
| 20 | + |
| 21 | + - uses: actions/cache@v2 |
| 22 | + with: |
| 23 | + path: ~/.cache |
| 24 | + key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }} |
| 25 | + restore-keys: | |
| 26 | + ${{ runner.os }}-pipenv- |
| 27 | +
|
| 28 | + - name: Get dependencies |
| 29 | + run: pipenv install -d |
| 30 | + |
| 31 | + - name: Lint |
| 32 | + continue-on-error: true |
| 33 | + run: | |
| 34 | + # stop the build if there are Python syntax errors or undefined names |
| 35 | + pipenv run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 36 | + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 37 | + pipenv run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 38 | +
|
| 39 | + - name: Travis Test - Start agent |
| 40 | + id: start_agent |
| 41 | + env: |
| 42 | + PYTHON_SDC_TEST_ACCESS_KEY: ${{ secrets.STAGING_AGENT_KEY }} |
| 43 | + run: | |
| 44 | + sudo apt-get install linux-headers-$(uname -r) dkms gcc-multilib g++-multilib |
| 45 | + ./test/start_agent.sh |
| 46 | +
|
| 47 | + - name: Travis Test - Install dependencies |
| 48 | + run: pip install . |
| 49 | + |
| 50 | + - name: Travis Test - Monitor APIs |
| 51 | + env: |
| 52 | + PYTHON_SDC_TEST_MONITOR_API_TOKEN: ${{ secrets.STAGING_MONITOR_API_TOKEN }} |
| 53 | + run: ./test/test_monitor_apis.sh |
| 54 | + |
| 55 | + - name: Travis Test - Secure APIs |
| 56 | + env: |
| 57 | + PYTHON_SDC_TEST_API_TOKEN: ${{ secrets.STAGING_SECURE_API_TOKEN }} |
| 58 | + run: ./test/test_secure_apis.sh |
| 59 | + |
| 60 | + - name: Travis Test - Stop agent |
| 61 | + run: ./test/stop_agent.sh |
| 62 | + if: steps.start_agent.outcome == 'success' |
| 63 | + |
| 64 | + - name: Test in staging |
| 65 | + env: |
| 66 | + SDC_MONITOR_TOKEN: ${{ secrets.STAGING_MONITOR_API_TOKEN }} |
| 67 | + SDC_SECURE_TOKEN: ${{ secrets.STAGING_SECURE_API_TOKEN }} |
| 68 | + SDC_MONITOR_URL: "https://app-staging.sysdigcloud.com" |
| 69 | + SDC_SECURE_URL: "https://secure-staging.sysdig.com" |
| 70 | + run: | |
| 71 | + pipenv run mamba -f documentation |
0 commit comments