summaryrefslogtreecommitdiff
path: root/.github/workflows/check_format.yml
blob: e6d3c705ffcaf3589327a9c3d96cf1ea006d192b (plain)
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Lint Tests
on:
  pull_request:

concurrency:
  group: 'ci-${{ github.workflow }}-${{ github.ref }}'
  cancel-in-progress: true
defaults:
  run:
    shell: sh -ex {0}

jobs:
  check_format:
    strategy:
      fail-fast: false
      matrix:
        env: [flake8, mypy, pylint, black, isort]
        lint-with:
          - {tip-versions: false, os: ubuntu-20.04}
          - {tip-versions: true, os: ubuntu-latest}
    name: Check ${{ matrix.lint-with.tip-versions && 'tip-' || '' }}${{ matrix.env }}
    runs-on: ${{ matrix.lint-with.os }}
    steps:
      - name: "Checkout #1"
        uses: actions/checkout@v3.0.0

      - name: "Checkout #2 (for tools/read-version)"
        run: |
          git fetch --unshallow
          git remote add upstream https://git.launchpad.net/cloud-init

      - name: Dependencies
        run: |
          sudo DEBIAN_FRONTEND=noninteractive apt-get -qy update
          sudo DEBIAN_FRONTEND=noninteractive apt-get -qy install tox

      - name: Print version
        run: python3 --version

      - name: Test
        if: ${{ !matrix.lint-with.tip-versions }}
        env:
          # matrix env: not to be confused w/environment variables or testenv
          TOXENV: ${{ matrix.env }}
        run: tox
      - name: Test (tip versions)
        if: matrix.lint-with.tip-versions
        continue-on-error: true
        env:
          TOXENV: tip-${{ matrix.env }}
        run: tox
  schema-format:
    strategy:
      fail-fast: false
    name: Check json format
    runs-on: ubuntu-22.04
    steps:
      - name: "Checkout #1"
        uses: actions/checkout@v3.0.0

      - name: "Test format"
        run: |
          tools/check_json_format.sh cloudinit/config/schemas/schema-cloud-config-v1.json
          tools/check_json_format.sh cloudinit/config/schemas/versions.schema.cloud-config.json

  doc:
    strategy:
      fail-fast: false
    name: Check docs
    runs-on: ubuntu-22.04
    steps:
      - name: "Checkout #1"
        uses: actions/checkout@v3.0.0

      - name: "Checkout #2 (for tools/read-version)"
        run: |
          git fetch --unshallow
          git remote add upstream https://git.launchpad.net/cloud-init
      - name: "Install Python 3.10"
        uses: actions/setup-python@v4
        with:
          python-version: '3.10.8'
      - name: "Install dependencies"
        run: |
          sudo DEBIAN_FRONTEND=noninteractive apt-get -qy update
          sudo DEBIAN_FRONTEND=noninteractive apt-get -qy install tox lintian
      - name: "Spellcheck"
        run: |
          make check_spelling
      - name: "Build docs"
        env:
          TOXENV: doc
        run: |
          tox

  check-cla-signers:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v3.0.0

      - name: Check CLA signers file
        run: tools/check-cla-signers