-
Notifications
You must be signed in to change notification settings - Fork 9
64 lines (51 loc) · 1.73 KB
/
Copy pathcheck-python.yaml
File metadata and controls
64 lines (51 loc) · 1.73 KB
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
name: Check Template
on:
workflow_call:
jobs:
check-python:
runs-on: 'ubuntu-latest'
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Install algokit
run: pipx install algokit
- name: Run algokit localnet
run: algokit localnet start
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'poetry'
- name: Install dependencies
run: poetry install --no-interaction --no-root
- name: Check formatting with Black
run: |
# stop the build if there are files that don't meet formatting requirements
poetry run black --check .
- name: Check linting with Ruff
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run ruff .
- name: Configure git
shell: bash
run: |
# set git user and email as test invoke git
git config --global user.email "actions@github.com" && git config --global user.name "github-actions"
- name: Setup Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: '22.x'
- name: Run tests
shell: bash
run: |
set -o pipefail
poetry run pytest --junitxml=pytest-junit.xml -n 1
- name: Check generated templates have been reviewed
shell: bash
run: |
# Add untracked files as empty so they come up in diff
git add -N ./examples
# Look for changes in generated templates and error if there are any
git diff --exit-code --minimal ./examples