|
| 1 | +# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions |
| 2 | +name: Lint and build |
| 3 | +on: |
| 4 | + workflow_dispatch: # Allows manual builds |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + - master |
| 9 | + paths: |
| 10 | + - "**.py" |
| 11 | + - "**.pyi" |
| 12 | + - "**.ui" |
| 13 | + pull_request: |
| 14 | + branches: |
| 15 | + - main |
| 16 | + - master |
| 17 | + - dev* |
| 18 | + - 2.0.0 |
| 19 | + paths: |
| 20 | + - "**.py" |
| 21 | + - "**.pyi" |
| 22 | + - "**.ui" |
| 23 | + |
| 24 | +env: |
| 25 | + GITHUB_HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }} |
| 26 | + |
| 27 | +jobs: |
| 28 | + Pyright: |
| 29 | + runs-on: windows-latest |
| 30 | + strategy: |
| 31 | + fail-fast: false |
| 32 | + matrix: |
| 33 | + python-version: ["3.9", "3.10"] |
| 34 | + steps: |
| 35 | + - name: Checkout ${{ github.repository }}/${{ github.ref }} |
| 36 | + uses: actions/checkout@v3 |
| 37 | + - name: Set up Node |
| 38 | + uses: actions/setup-node@v3 |
| 39 | + - name: Set up Python ${{ matrix.python-version }} |
| 40 | + uses: actions/setup-python@v4 |
| 41 | + with: |
| 42 | + python-version: ${{ matrix.python-version }} |
| 43 | + cache: "pip" |
| 44 | + cache-dependency-path: "scripts/requirements*.txt" |
| 45 | + - run: scripts/install.ps1 |
| 46 | + shell: pwsh |
| 47 | + - name: Analysing the code with Pyright |
| 48 | + run: pyright --warnings |
| 49 | + Pylint: |
| 50 | + runs-on: windows-latest |
| 51 | + strategy: |
| 52 | + fail-fast: false |
| 53 | + matrix: |
| 54 | + python-version: ["3.9", "3.10"] |
| 55 | + steps: |
| 56 | + - name: Checkout ${{ github.repository }}/${{ github.ref }} |
| 57 | + uses: actions/checkout@v3 |
| 58 | + - name: Set up Python ${{ matrix.python-version }} |
| 59 | + uses: actions/setup-python@v4 |
| 60 | + with: |
| 61 | + python-version: ${{ matrix.python-version }} |
| 62 | + cache: "pip" |
| 63 | + cache-dependency-path: "scripts/requirements*.txt" |
| 64 | + - run: scripts/install.ps1 |
| 65 | + shell: pwsh |
| 66 | + - name: Analysing the code with Pylint |
| 67 | + run: pylint --reports=y --output-format=colorized src/ |
| 68 | + Flake8: |
| 69 | + runs-on: windows-latest |
| 70 | + strategy: |
| 71 | + fail-fast: false |
| 72 | + matrix: |
| 73 | + python-version: ["3.9", "3.10"] |
| 74 | + steps: |
| 75 | + - name: Checkout ${{ github.repository }}/${{ github.ref }} |
| 76 | + uses: actions/checkout@v3 |
| 77 | + - name: Set up Python ${{ matrix.python-version }} |
| 78 | + uses: actions/setup-python@v4 |
| 79 | + with: |
| 80 | + python-version: ${{ matrix.python-version }} |
| 81 | + cache: "pip" |
| 82 | + cache-dependency-path: "scripts/requirements*.txt" |
| 83 | + - run: scripts/install.ps1 |
| 84 | + shell: pwsh |
| 85 | + - name: Analysing the code with Flake8 |
| 86 | + run: flake8 |
| 87 | + Bandit: |
| 88 | + runs-on: windows-latest |
| 89 | + steps: |
| 90 | + - name: Checkout ${{ github.repository }}/${{ github.ref }} |
| 91 | + uses: actions/checkout@v3 |
| 92 | + - name: Set up Python 3.10 |
| 93 | + uses: actions/setup-python@v4 |
| 94 | + with: |
| 95 | + python-version: "3.10" |
| 96 | + cache: "pip" |
| 97 | + cache-dependency-path: "scripts/requirements*.txt" |
| 98 | + - run: scripts/install.ps1 |
| 99 | + shell: pwsh |
| 100 | + - name: Analysing the code with Bandit |
| 101 | + run: bandit -n 1 --severity-level medium --recursive src |
| 102 | + Build: |
| 103 | + runs-on: windows-latest |
| 104 | + strategy: |
| 105 | + fail-fast: false |
| 106 | + matrix: |
| 107 | + python-version: ["3.10"] |
| 108 | + steps: |
| 109 | + - name: Checkout ${{ github.repository }}/${{ github.ref }} |
| 110 | + uses: actions/checkout@v3 |
| 111 | + - name: Set up Python ${{ matrix.python-version }} |
| 112 | + uses: actions/setup-python@v4 |
| 113 | + with: |
| 114 | + python-version: ${{ matrix.python-version }} |
| 115 | + cache: "pip" |
| 116 | + - run: scripts/install.ps1 |
| 117 | + shell: pwsh |
| 118 | + - run: scripts/build.ps1 |
| 119 | + shell: pwsh |
| 120 | + - name: Upload Build Artifact |
| 121 | + uses: actions/upload-artifact@v3 |
| 122 | + with: |
| 123 | + name: AutoSplit (Python ${{ matrix.python-version }}) |
| 124 | + path: dist/AutoSplit* |
| 125 | + if-no-files-found: error |
| 126 | + - name: Upload Build logs |
| 127 | + uses: actions/upload-artifact@v3 |
| 128 | + with: |
| 129 | + name: Build logs (Python ${{ matrix.python-version }}) |
| 130 | + path: | |
| 131 | + build/AutoSplit/*.toc |
| 132 | + build/AutoSplit/*.txt |
| 133 | + build/AutoSplit/*.html |
| 134 | + if-no-files-found: error |
0 commit comments