|
| 1 | +name: test |
| 2 | +on: [pull_request, push] |
| 3 | + |
| 4 | +env: |
| 5 | + MIN_LINE_RATE: 0.2 |
| 6 | + |
| 7 | +jobs: |
| 8 | + run_tests: |
| 9 | + runs-on: self-hosted |
| 10 | + container: |
| 11 | + image: python:3.8 |
| 12 | + steps: |
| 13 | + - name: Update base image |
| 14 | + run: | |
| 15 | + apt update |
| 16 | + apt install -qy libkrb5-dev libsasl2-dev |
| 17 | + pip install poetry==1.2.2 |
| 18 | + - uses: actions/checkout@v2 |
| 19 | + - name: Install package |
| 20 | + run: poetry install -vvv |
| 21 | + - name: Test base imports |
| 22 | + run: poetry run python -c 'from muttlib import dbconn, utils' |
| 23 | + - name: Test forecast extra |
| 24 | + run: | |
| 25 | + poetry install -E forecast -vvv |
| 26 | + poetry run python -c 'from muttlib import forecast' |
| 27 | + - name: Test gsheetsconn |
| 28 | + run: | |
| 29 | + poetry install -E gsheets -vvv |
| 30 | + poetry run python -c 'from muttlib import gsheetsconn' |
| 31 | + - name: Test gdrive |
| 32 | + run: | |
| 33 | + poetry install -E gdrive -vvv |
| 34 | + poetry run python -c 'from muttlib import gdrive' |
| 35 | + - name: Run nox |
| 36 | + run: | |
| 37 | + poetry run nox --envdir $GITHUB_WORKSPACE/.nox --sessions tests |
| 38 | +
|
| 39 | + lint: |
| 40 | + runs-on: [self-hosted] |
| 41 | + container: |
| 42 | + image: python:3.8 |
| 43 | + steps: |
| 44 | + - name: Update base image |
| 45 | + run: | |
| 46 | + apt update |
| 47 | + apt install -y libkrb5-dev libsasl2-dev |
| 48 | + pip install poetry==1.2.2 |
| 49 | + - uses: actions/checkout@v2 |
| 50 | + - name: Install package |
| 51 | + run: poetry install -vvv |
| 52 | + - name: Run nox |
| 53 | + run: poetry run nox --envdir $GITHUB_WORKSPACE/.nox --sessions precommit_hooks |
| 54 | + |
| 55 | + docstr-cov: |
| 56 | + runs-on: [self-hosted] |
| 57 | + container: |
| 58 | + image: python:3.8 |
| 59 | + steps: |
| 60 | + - name: Update base image |
| 61 | + run: | |
| 62 | + apt update |
| 63 | + apt install -y libkrb5-dev libsasl2-dev |
| 64 | + pip install poetry==1.2.2 |
| 65 | + - uses: actions/checkout@v2 |
| 66 | + - name: Install package |
| 67 | + run: poetry install -vvv |
| 68 | + - name: Run interrogate |
| 69 | + run: poetry run interrogate muttlib -c pyproject.toml -vv --generate-badge docs_coverage.svg --badge-style flat |
| 70 | + |
| 71 | + bandit: |
| 72 | + runs-on: [self-hosted] |
| 73 | + container: |
| 74 | + image: python:3.8 |
| 75 | + steps: |
| 76 | + - name: Update base image |
| 77 | + run: | |
| 78 | + apt update |
| 79 | + apt install -y libkrb5-dev libsasl2-dev |
| 80 | + pip install poetry==1.2.2 |
| 81 | + - uses: actions/checkout@v2 |
| 82 | + - name: Install package |
| 83 | + run: poetry install -vvv |
| 84 | + - name: Run nox |
| 85 | + run: poetry run nox --envdir $GITHUB_WORKSPACE/.nox --sessions bandit |
| 86 | + |
| 87 | + typing: |
| 88 | + runs-on: [self-hosted] |
| 89 | + container: |
| 90 | + image: python:3.8 |
| 91 | + steps: |
| 92 | + - name: Update base image |
| 93 | + run: | |
| 94 | + apt update |
| 95 | + apt install -y libkrb5-dev libsasl2-dev |
| 96 | + pip install poetry==1.2.2 |
| 97 | + - uses: actions/checkout@v2 |
| 98 | + - name: Install package |
| 99 | + run: poetry install -vvv |
| 100 | + - name: Run mypy and check lines |
| 101 | + run: | |
| 102 | + poetry run mypy ./muttlib --cobertura-xml-report ./ |
| 103 | + line_rate=$(cat cobertura.xml | grep -oP '(?<=line-rate\W{2})(\d.\d+)(?=\W\s\w+)') |
| 104 | + python -c "import sys; exit(float(sys.argv[1]) <= float(sys.argv[2]))" $line_rate $MIN_LINE_RATE |
| 105 | + exit_status=$? |
| 106 | + exit $exit_status |
0 commit comments