|
| 1 | +name: ci |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - master |
| 10 | + |
| 11 | +defaults: |
| 12 | + run: |
| 13 | + shell: bash |
| 14 | + |
| 15 | +env: |
| 16 | + LANG: en_US.utf-8 |
| 17 | + LC_ALL: en_US.utf-8 |
| 18 | + PYTHONIOENCODING: UTF-8 |
| 19 | + |
| 20 | +jobs: |
| 21 | + |
| 22 | + quality: |
| 23 | + |
| 24 | + runs-on: ubuntu-latest |
| 25 | + |
| 26 | + steps: |
| 27 | + - name: Checkout |
| 28 | + uses: actions/checkout@v3 |
| 29 | + |
| 30 | + - name: Set up PDM |
| 31 | + uses: pdm-project/setup-pdm@v3 |
| 32 | + with: |
| 33 | + python-version: "3.8" |
| 34 | + |
| 35 | + - name: Resolving dependencies |
| 36 | + run: pdm lock -v --no-cross-platform -G ci-quality |
| 37 | + |
| 38 | + - name: Install dependencies |
| 39 | + run: pdm install -G ci-quality |
| 40 | + |
| 41 | + - name: Check if the documentation builds correctly |
| 42 | + run: pdm run duty check-docs |
| 43 | + |
| 44 | + - name: Check the code quality |
| 45 | + run: pdm run duty check-quality |
| 46 | + |
| 47 | + - name: Check if the code is correctly typed |
| 48 | + run: pdm run duty check-types |
| 49 | + |
| 50 | + - name: Check for vulnerabilities in dependencies |
| 51 | + run: pdm run duty check-dependencies |
| 52 | + |
| 53 | + - name: Check for breaking changes in the API |
| 54 | + run: pdm run duty check-api |
| 55 | + |
| 56 | + exclude-test-jobs: |
| 57 | + runs-on: ubuntu-latest |
| 58 | + outputs: |
| 59 | + jobs: ${{ steps.exclude-jobs.outputs.jobs }} |
| 60 | + steps: |
| 61 | + - id: exclude-jobs |
| 62 | + run: | |
| 63 | + if ${{ github.repository_owner == 'pawamoy-insiders' }}; then |
| 64 | + echo 'jobs=[ |
| 65 | + {"os": "macos-latest"}, |
| 66 | + {"os": "windows-latest"}, |
| 67 | + {"python-version": "3.8"}, |
| 68 | + {"python-version": "3.9"}, |
| 69 | + {"python-version": "3.10"}, |
| 70 | + {"python-version": "3.11"} |
| 71 | + ]' | tr -d '[:space:]' >> $GITHUB_OUTPUT |
| 72 | + else |
| 73 | + echo 'jobs=[]' >> $GITHUB_OUTPUT |
| 74 | + fi |
| 75 | +
|
| 76 | + tests: |
| 77 | + |
| 78 | + needs: exclude-test-jobs |
| 79 | + strategy: |
| 80 | + max-parallel: 4 |
| 81 | + matrix: |
| 82 | + os: |
| 83 | + - ubuntu-latest |
| 84 | + - macos-latest |
| 85 | + - windows-latest |
| 86 | + python-version: |
| 87 | + - "3.7" |
| 88 | + - "3.8" |
| 89 | + - "3.9" |
| 90 | + - "3.10" |
| 91 | + - "3.11" |
| 92 | + exclude: ${{ fromJSON(needs.exclude-test-jobs.outputs.jobs) }} |
| 93 | + |
| 94 | + runs-on: ${{ matrix.os }} |
| 95 | + |
| 96 | + steps: |
| 97 | + - name: Checkout |
| 98 | + uses: actions/checkout@v3 |
| 99 | + |
| 100 | + - name: Set up PDM |
| 101 | + uses: pdm-project/setup-pdm@v3 |
| 102 | + with: |
| 103 | + python-version: ${{ matrix.python-version }} |
| 104 | + |
| 105 | + - name: Resolving dependencies |
| 106 | + run: pdm lock -v --no-cross-platform -G ci-tests |
| 107 | + |
| 108 | + - name: Install dependencies |
| 109 | + run: pdm install --no-editable -G ci-tests |
| 110 | + |
| 111 | + - name: Run the test suite |
| 112 | + run: pdm run duty test |
0 commit comments