File: lint.yml

package info (click to toggle)
python-id 1.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 220 kB
  • sloc: python: 905; makefile: 80; sh: 5
file content (83 lines) | stat: -rw-r--r-- 2,056 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Lint

on:
  push:
    branches:
      - main
  pull_request:

permissions: {}

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          persist-credentials: false

      # NOTE: We intentionally lint against our minimum supported Python.
      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
        with:
          python-version: "3.9"
          cache: "pip"
          cache-dependency-path: pyproject.toml

      - name: deps
        run: make dev ID_EXTRA=lint

      - name: lint
        run: make lint

  check-readme:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          persist-credentials: false

      # NOTE: We intentionally check `--help` rendering against our minimum Python,
      # since it changes slightly between Python versions.
      - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
        with:
          python-version: "3.9"
          cache: "pip"
          cache-dependency-path: pyproject.toml

      - name: deps
        run: make dev

      - name: check-readme
        run: make check-readme

  licenses:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          persist-credentials: false

      # adapted from Warehouse's bin/licenses
      - run: |
          for fn in $(find . -type f -name "*.py"); do
            if [[ ! "$(head -5 $fn | grep "^ *\(#\|\*\|\/\/\) .* License\(d*\)")" ]]; then
              echo "${fn} is missing a license"
              exit 1
            fi
          done

  all-lints-pass:
    if: always()

    needs:
      - lint
      - check-readme
      - licenses

    runs-on: ubuntu-latest

    steps:
      - name: check lint jobs
        uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
        with:
          jobs: ${{ toJSON(needs) }}