|
| 1 | +name: Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main, main/coll, develop ] |
| 6 | + pull_request: |
| 7 | + branches: [ main, main/coll ] |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +jobs: |
| 13 | + test: |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 19 | + python-version: ['3.8', '3.9', '3.10', '3.11'] |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Checkout repository |
| 23 | + uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Set up Python ${{ matrix.python-version }} |
| 26 | + uses: actions/setup-python@v4 |
| 27 | + with: |
| 28 | + python-version: ${{ matrix.python-version }} |
| 29 | + |
| 30 | + - name: Install dependencies |
| 31 | + run: | |
| 32 | + python -m pip install --upgrade pip |
| 33 | + pip install -r requirements.txt |
| 34 | + pip install -e . |
| 35 | + |
| 36 | + - name: Run tests |
| 37 | + run: | |
| 38 | + pytest -v --tb=short |
| 39 | + |
| 40 | + - name: Test CLI demo (Unix) |
| 41 | + if: runner.os != 'Windows' |
| 42 | + run: | |
| 43 | + timeout 10 python main.py || true |
| 44 | + |
| 45 | + - name: Test CLI demo (Windows) |
| 46 | + if: runner.os == 'Windows' |
| 47 | + shell: pwsh |
| 48 | + run: | |
| 49 | + $job = Start-Job -ScriptBlock { python main.py } |
| 50 | + Wait-Job $job -Timeout 10 | Out-Null |
| 51 | + Stop-Job $job |
| 52 | + Remove-Job $job |
| 53 | +
|
| 54 | + lint: |
| 55 | + runs-on: ubuntu-latest |
| 56 | + |
| 57 | + steps: |
| 58 | + - name: Checkout repository |
| 59 | + uses: actions/checkout@v4 |
| 60 | + |
| 61 | + - name: Set up Python |
| 62 | + uses: actions/setup-python@v4 |
| 63 | + with: |
| 64 | + python-version: '3.11' |
| 65 | + |
| 66 | + - name: Install dependencies |
| 67 | + run: | |
| 68 | + python -m pip install --upgrade pip |
| 69 | + pip install flake8 pylint |
| 70 | + pip install -r requirements.txt |
| 71 | + pip install -e . |
| 72 | + |
| 73 | + - name: Lint with flake8 |
| 74 | + run: | |
| 75 | + # Stop the build if there are Python syntax errors or undefined names |
| 76 | + flake8 megabot --count --select=E9,F63,F7,F82 --show-source --statistics |
| 77 | + # Exit-zero treats all errors as warnings |
| 78 | + flake8 megabot --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 79 | + continue-on-error: true |
0 commit comments