2021-02-17 21:34:56 +00:00
|
|
|
name: CI
|
|
|
|
|
2023-10-11 17:35:07 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
paths-ignore:
|
|
|
|
- 'doc/**'
|
|
|
|
pull_request:
|
|
|
|
paths-ignore:
|
|
|
|
- 'doc/**'
|
2021-02-17 21:34:56 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
2021-02-18 20:24:20 +00:00
|
|
|
runs-on: ubuntu-20.04
|
2021-02-17 21:34:56 +00:00
|
|
|
strategy:
|
2021-10-05 16:01:11 +00:00
|
|
|
fail-fast: false
|
2021-02-17 21:34:56 +00:00
|
|
|
matrix:
|
|
|
|
image:
|
|
|
|
- ubuntu-daily:focal
|
2021-10-29 00:21:09 +00:00
|
|
|
- ubuntu-daily:jammy
|
2022-11-17 00:51:03 +00:00
|
|
|
- ubuntu-daily:lunar
|
2023-05-12 02:40:49 +00:00
|
|
|
- ubuntu-daily:mantic
|
2021-02-17 21:34:56 +00:00
|
|
|
steps:
|
2023-09-08 21:42:44 +00:00
|
|
|
- uses: actions/checkout@v4
|
2021-02-17 21:34:56 +00:00
|
|
|
- name: run
|
2021-05-17 13:31:29 +00:00
|
|
|
run: sudo ./scripts/test-in-lxd.sh ${{ matrix.image }} "make check"
|
2023-07-24 19:34:16 +00:00
|
|
|
|
2021-02-17 21:34:56 +00:00
|
|
|
lint:
|
2021-02-18 20:37:05 +00:00
|
|
|
runs-on: ubuntu-20.04
|
2022-07-08 14:30:29 +00:00
|
|
|
strategy:
|
2023-03-22 00:44:51 +00:00
|
|
|
fail-fast: false
|
2022-07-08 14:30:29 +00:00
|
|
|
matrix:
|
|
|
|
image:
|
2023-03-03 13:34:38 +00:00
|
|
|
- ubuntu-daily:jammy # match the core snap we're running against
|
2023-05-12 02:40:49 +00:00
|
|
|
- ubuntu-daily:mantic # latest
|
2021-02-17 21:34:56 +00:00
|
|
|
steps:
|
2023-09-08 21:42:44 +00:00
|
|
|
- uses: actions/checkout@v4
|
2021-02-17 21:34:56 +00:00
|
|
|
- name: lint
|
2022-07-08 14:30:29 +00:00
|
|
|
run: sudo ./scripts/test-in-lxd.sh ${{ matrix.image }} "make lint"
|
2023-05-16 08:57:20 +00:00
|
|
|
|
2023-07-24 19:34:16 +00:00
|
|
|
format-black:
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
steps:
|
2023-09-08 21:42:44 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-07-24 19:34:16 +00:00
|
|
|
- uses: psf/black@stable
|
|
|
|
with:
|
|
|
|
version: "~= 23.0"
|
|
|
|
src: "console_conf subiquity subiquitycore system_setup"
|
|
|
|
|
|
|
|
format-isort:
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
steps:
|
2023-09-08 21:42:44 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-07-24 19:34:16 +00:00
|
|
|
- uses: isort/isort-action@v1
|
|
|
|
with:
|
|
|
|
isort-version: "5.12.0"
|
|
|
|
sort-paths: "console_conf subiquity subiquitycore system_setup"
|
|
|
|
|
2023-05-16 08:57:20 +00:00
|
|
|
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
|
2023-09-08 21:42:44 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-05-16 08:57:20 +00:00
|
|
|
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)
|
2023-09-08 21:42:44 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-05-16 08:57:20 +00:00
|
|
|
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
|