-
Notifications
You must be signed in to change notification settings - Fork 158
95 lines (89 loc) · 3.36 KB
/
ci.yaml
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
name: CI
on:
push:
paths-ignore:
- 'doc/**'
pull_request:
paths-ignore:
- 'doc/**'
jobs:
test:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
image:
- ubuntu-daily:focal
- ubuntu-daily:jammy
- ubuntu-daily:lunar
- ubuntu-daily:mantic
steps:
- uses: actions/checkout@v4
- name: run
run: sudo ./scripts/test-in-lxd.sh ${{ matrix.image }} "make check"
lint:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
image:
- ubuntu-daily:jammy # match the core snap we're running against
- ubuntu-daily:mantic # latest
steps:
- uses: actions/checkout@v4
- name: lint
run: sudo ./scripts/test-in-lxd.sh ${{ matrix.image }} "make lint"
format-black:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: psf/black@stable
with:
version: "~= 23.0"
src: "console_conf subiquity subiquitycore system_setup"
format-isort:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: isort/isort-action@v1
with:
isort-version: "5.12.0"
sort-paths: "console_conf subiquity subiquitycore system_setup"
static-typing:
# In this job, we compare the output of mypy before and after the PR.
if: github.event_name == 'pull_request'
runs-on: ubuntu-22.04
steps:
- name: Install mypy and typeshed
run: sudo apt-get install -y python3-mypy python3-typeshed
- name: Checkout the pull request branch
uses: actions/checkout@v4
with:
# When no ref is specified, a merge commit (from PR branch to target
# branch) will be checked out. Use the last commit of the PR branch
# instead.
ref: ${{ github.event.pull_request.head.sha }}
# By default, no ancestors of the specified revision will be checked
# out (see shallow repositories). Let's fetch just enough revisions
# so that, later, we can access the most recent common ancestor.
# If it does not work, we can set fetch-depth: 0
fetch-depth: $(( ${{ github.event.pull_request.commits }} + 1 ))
- name: Run mypy on pull request branch
run: python3 -m mypy --ignore-missing-imports --check-untyped-defs subiquity subiquitycore system_setup console_conf scripts/replay-curtin-log.py | tee /tmp/mypy-head.out
- name: Determine base commit (most recent common ancestor)
id: determine_base_commit
run: |
ancestor=$(git merge-base -- \
"${{ github.event.pull_request.base.sha }}" \
"${{ github.event.pull_request.head.sha }}")
echo "base_commit=$ancestor" >> "$GITHUB_OUTPUT"
- name: Checkout the base commit (most recent common ancestor)
uses: actions/checkout@v4
with:
ref: ${{ steps.determine_base_commit.outputs.base_commit }}
- run: git show
- name: Run mypy on base commit
run: python3 -m mypy --ignore-missing-imports --check-untyped-defs subiquity subiquitycore system_setup console_conf scripts/replay-curtin-log.py | tee /tmp/mypy-base.out
- name: Produce the diff between the two mypy runs
run: diff --color=always --unified=0 /tmp/mypy-base.out /tmp/mypy-head.out
continue-on-error: true