-
Notifications
You must be signed in to change notification settings - Fork 84
114 lines (99 loc) · 3.05 KB
/
pipeline.yml
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
103
104
105
106
107
108
109
110
111
112
113
name: CI
on:
pull_request:
push:
branches: ["main"]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check-newsfile:
name: Check PR has a changelog
if: ${{ (github.base_ref == 'main' || contains(github.base_ref, 'release-')) && github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.sha}}
- uses: actions/setup-python@v2
with:
python-version: "3.11"
- run: python -m pip install towncrier
- run: "scripts-dev/check_newsfragment.sh ${{ github.event.number }}"
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: matrix-org/setup-python-poetry@v1
with:
python-version: 3.11
install-project: false
- name: Import order (isort)
run: poetry run isort --check --diff .
- name: Code style (black)
run: poetry run black --check --diff .
- name: Semantic checks (ruff)
# --quiet suppresses the update check.
run: poetry run ruff --quiet .
- name: Restore/persist mypy's cache
uses: actions/cache@v3
with:
path: |
.mypy_cache
key: mypy-cache-${{ github.context.sha }}
restore-keys: mypy-cache-
- name: Typechecking (mypy)
run: poetry run mypy
packaging:
uses: "matrix-org/backend-meta/.github/workflows/packaging.yml@v1"
docker:
# Sanity check that we can build the x64 image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Build image
uses: docker/build-push-action@v4
with:
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
platforms: "linux/amd64,linux/arm64"
push: false
run-tests:
name: Tests
if: ${{ !cancelled() && !failure() }} # Allow previous steps to be skipped, but not fail
needs: [check-newsfile, checks, packaging]
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.11']
test-dir: ['tests', 'matrix_is_tester']
steps:
- uses: actions/checkout@v2
- uses: matrix-org/setup-python-poetry@v1
with:
python-version: ${{ matrix.python-version }}
- run: poetry run trial ${{ matrix.test-dir }}
# a job which runs once all the other jobs are complete, thus allowing PRs to
# be merged.
tests-done:
if: ${{ always() }}
needs:
- check-newsfile
- checks
- packaging
- run-tests
runs-on: ubuntu-latest
steps:
- uses: matrix-org/done-action@v2
with:
needs: ${{ toJSON(needs) }}
# The newsfile lint may be skipped on non PR builds or on dependabot builds
skippable:
check-newsfile