|
1 | 1 | name: Python |
2 | 2 |
|
3 | | -on: [push, pull_request] |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + schedule: |
| 9 | + - cron: "0 8 * * *" |
4 | 10 |
|
5 | | -env: |
6 | | - GO_VERSION: 1.18 |
| 11 | +concurrency: |
| 12 | + group: check-${{ github.ref }} |
| 13 | + cancel-in-progress: true |
7 | 14 |
|
8 | 15 | permissions: |
9 | 16 | contents: read |
10 | 17 | pull-requests: write |
11 | 18 |
|
12 | 19 | jobs: |
13 | 20 | build: |
14 | | - runs-on: ubuntu-latest |
| 21 | + name: test with ${{ matrix.py }} on ${{ matrix.os }} |
| 22 | + runs-on: ${{ matrix.os }} |
15 | 23 | strategy: |
| 24 | + fail-fast: false |
16 | 25 | matrix: |
17 | | - python-version: ["3.7", "3.8", "3.9", "3.10"] |
| 26 | + py: |
| 27 | + - "3.11" |
| 28 | + - "3.10" |
| 29 | + - "3.9" |
| 30 | + - "3.8" |
| 31 | + - "3.7" |
| 32 | + os: |
| 33 | + - ubuntu-latest |
| 34 | + - macos-latest |
| 35 | + - windows-latest |
18 | 36 | steps: |
19 | | - - name: Checkout |
20 | | - uses: actions/checkout@v3 |
21 | | - - name: Poetry |
22 | | - uses: descope/.github/.github/actions/python/poetry/setup@main |
| 37 | + - uses: actions/checkout@v3 |
| 38 | + with: |
| 39 | + fetch-depth: 0 |
| 40 | + - name: Setup python for test ${{ matrix.py }} |
| 41 | + uses: actions/setup-python@v4 |
| 42 | + with: |
| 43 | + python-version: ${{ matrix.py }} |
| 44 | + - name: Install tox |
| 45 | + run: python -m pip install tox-gh>=1.2 poetry |
| 46 | + - name: Setup test suite |
| 47 | + run: tox -vv --notest |
| 48 | + - name: Run test suite |
| 49 | + run: tox --skip-pkg-install |
| 50 | + env: |
| 51 | + COVERAGE_FILE: ".coverage.${{ matrix.py }}" |
| 52 | + |
| 53 | + - name: Store coverage file |
| 54 | + uses: actions/upload-artifact@v3 |
23 | 55 | with: |
24 | | - python-version: ${{ matrix.python-version }} |
| 56 | + name: coverage |
| 57 | + path: .coverage.${{ matrix.py }} |
25 | 58 |
|
26 | | - - name: Run tests |
27 | | - run: | |
28 | | - poetry run pytest --junitxml=/tmp/pytest.xml --cov-report=term-missing:skip-covered --cov=descope tests/ --cov-report=xml:/tmp/cov.xml |
| 59 | + coverage: |
| 60 | + name: Coverage |
| 61 | + runs-on: ubuntu-latest |
| 62 | + needs: build |
| 63 | + permissions: |
| 64 | + pull-requests: write |
| 65 | + contents: write |
| 66 | + steps: |
| 67 | + - uses: actions/checkout@v4 |
29 | 68 |
|
30 | | - - name: Post Pytest coverage comment |
31 | | - if: ${{ github.event_name == 'pull_request' }} |
32 | | - id: coverageComment |
33 | | - uses: MishaKav/pytest-coverage-comment@main |
| 69 | + - uses: actions/download-artifact@v3 |
| 70 | + id: download |
34 | 71 | with: |
35 | | - pytest-xml-coverage-path: /tmp/cov.xml |
36 | | - create-new-comment: false |
37 | | - |
38 | | - - name: Coverage |
39 | | - if: ${{ github.event_name == 'pull_request' }} |
40 | | - run: | |
41 | | - echo "Coverage Percantage - ${{ steps.coverageComment.outputs.coverage }}" |
42 | | - echo "Coverage Color - ${{ steps.coverageComment.outputs.color }}" |
43 | | - echo "Coverage Html - ${{ steps.coverageComment.outputs.coverageHtml }}" |
44 | | - echo "Coverage Warnings - ${{ steps.coverageComment.outputs.warnings }}" |
45 | | - echo "Coverage Errors - ${{ steps.coverageComment.outputs.errors }}" |
46 | | - echo "Coverage Failures - ${{ steps.coverageComment.outputs.failures }}" |
47 | | - echo "Coverage Skipped - ${{ steps.coverageComment.outputs.skipped }}" |
48 | | - echo "Coverage Tests - ${{ steps.coverageComment.outputs.tests }}" |
49 | | - echo "Coverage Time - ${{ steps.coverageComment.outputs.time }}" |
50 | | - echo "Not Success Test Info - ${{ steps.coverageComment.outputs.notSuccessTestInfo }}" |
51 | | -
|
52 | | - - name: Gitleaks |
53 | | - uses: ./.github/actions/gitleaks |
| 72 | + name: "coverage" |
| 73 | + |
| 74 | + - name: Coverage comment |
| 75 | + id: coverage_comment |
| 76 | + uses: py-cov-action/python-coverage-comment-action@v3 |
| 77 | + with: |
| 78 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 79 | + MERGE_COVERAGE_FILES: true |
| 80 | + |
| 81 | + gitleaks: |
| 82 | + name: gitleaks |
| 83 | + runs-on: ubuntu-latest |
| 84 | + steps: |
| 85 | + - uses: actions/checkout@v3 |
54 | 86 | with: |
55 | | - go_version: ${{ env.GO_VERSION }} |
| 87 | + fetch-depth: 0 |
| 88 | + - uses: gitleaks/gitleaks-action@v2 |
| 89 | + env: |
| 90 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 91 | + GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE}} |
0 commit comments