|
| 1 | +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions |
| 2 | +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions |
| 3 | + |
| 4 | +name: Python package |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: [ master ] |
| 9 | + pull_request: |
| 10 | + branches: [ master ] |
| 11 | + |
| 12 | +jobs: |
| 13 | + lint_markdown_files: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v3 |
| 17 | + - name: Set up Ruby |
| 18 | + uses: ruby/setup-ruby@v1 |
| 19 | + with: |
| 20 | + ruby-version: '2.6' |
| 21 | + bundler-cache: true # runs 'bundle install' and caches installed gems automatically |
| 22 | + - name: Install gem |
| 23 | + run: | |
| 24 | + gem install awesome_bot |
| 25 | + - name: Run tests |
| 26 | + run: find . -type f -name '*.md' -exec awesome_bot {} \; |
| 27 | + |
| 28 | + linting: |
| 29 | + runs-on: ubuntu-latest |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v3 |
| 32 | + - name: Set up Python 3.9 |
| 33 | + uses: actions/setup-python@v3 |
| 34 | + with: |
| 35 | + python-version: 3.9 |
| 36 | + # flake8 version should be same as the version in requirements/test.txt |
| 37 | + # to avoid lint errors on CI |
| 38 | + - name: pip install flak8 |
| 39 | + run: pip install flake8>=4.1.0 |
| 40 | + - name: Lint with flake8 |
| 41 | + run: | |
| 42 | + flake8 |
| 43 | + # stop the build if there are Python syntax errors or undefined names |
| 44 | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 45 | + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 46 | + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 47 | + |
| 48 | + integration_tests: |
| 49 | + uses: optimizely/python-sdk/.github/workflows/integration_test.yml@master |
| 50 | + secrets: |
| 51 | + CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} |
| 52 | + TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} |
| 53 | + |
| 54 | + fullstack_production_suite: |
| 55 | + uses: optimizely/python-sdk/.github/workflows/integration_test.yml@master |
| 56 | + with: |
| 57 | + FULLSTACK_TEST_REPO: ProdTesting |
| 58 | + secrets: |
| 59 | + CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }} |
| 60 | + TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} |
| 61 | + |
| 62 | + test: |
| 63 | + runs-on: ubuntu-latest |
| 64 | + strategy: |
| 65 | + fail-fast: false |
| 66 | + matrix: |
| 67 | + python-version: ["pypy-3.7-v7.3.5", "3.7", "3.8", "3.9", "3.10.0"] |
| 68 | + steps: |
| 69 | + - uses: actions/checkout@v3 |
| 70 | + - name: Set up Python ${{ matrix.python-version }} |
| 71 | + uses: actions/setup-python@v3 |
| 72 | + with: |
| 73 | + python-version: ${{ matrix.python-version }} |
| 74 | + - name: Install dependencies |
| 75 | + run: | |
| 76 | + python -m pip install --upgrade pip |
| 77 | + pip install -r requirements/core.txt;pip install -r requirements/test.txt |
| 78 | + - name: Test with pytest |
| 79 | + run: | |
| 80 | + pytest --cov=optimizely |
0 commit comments