-
Notifications
You must be signed in to change notification settings - Fork 30
121 lines (118 loc) · 3.66 KB
/
lint-and-build.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
114
115
116
117
118
119
120
121
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
name: Lint and build
on:
workflow_dispatch: # Allows manual builds
inputs:
excludeBuildNumber:
description: "Exclude build number"
required: true
default: false
type: boolean
push:
branches:
- main
- master
- dev*
paths:
- "**.py"
- "**.ui"
- ".github/workflows/lint-and-build.yml"
- "**/requirements.txt"
pull_request:
branches:
- main
- master
- dev*
paths:
- "**.py"
- "**.pyi"
- "**.ui"
- ".github/workflows/lint-and-build.yml"
- "**/requirements*.txt"
env:
GITHUB_HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }}
GITHUB_EXCLUDE_BUILD_NUMBER: ${{ inputs.excludeBuildNumber }}
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
ruff:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
# Ruff is version and platform sensible
matrix:
os: [windows-latest, ubuntu-22.04]
python-version: ["3.10", "3.11", "3.12"]
steps:
- name: Checkout ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "scripts/requirements*.txt"
- run: scripts/install.ps1
shell: pwsh
- run: ruff check .
Pyright:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
# Pyright is version and platform sensible
matrix:
os: [windows-latest, ubuntu-22.04]
python-version: ["3.10", "3.11", "3.12"]
steps:
- name: Checkout ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "scripts/requirements*.txt"
- run: scripts/install.ps1
shell: pwsh
- name: Analysing the code with Pyright
uses: jakebailey/pyright-action@v1
with:
working-directory: src/
python-version: ${{ matrix.python-version }}
Build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
# Only the Python version we plan on shipping matters.
matrix:
os: [windows-latest, ubuntu-22.04]
python-version: ["3.11", "3.12"]
steps:
- name: Checkout ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "scripts/requirements.txt"
- run: scripts/install.ps1
shell: pwsh
- run: scripts/build.ps1
shell: pwsh
- name: Upload Build Artifact
uses: actions/upload-artifact@v3
with:
name: AutoSplit for ${{ matrix.os }} (Python ${{ matrix.python-version }})
path: dist/AutoSplit*
if-no-files-found: error
- name: Upload Build logs
uses: actions/upload-artifact@v3
with:
name: Build logs for ${{ matrix.os }} (Python ${{ matrix.python-version }})
path: |
build/AutoSplit/*.toc
build/AutoSplit/*.txt
build/AutoSplit/*.html
if-no-files-found: error