-
Notifications
You must be signed in to change notification settings - Fork 27
80 lines (67 loc) · 3.48 KB
/
Copy pathmacos-scripts-python.yml
File metadata and controls
80 lines (67 loc) · 3.48 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Lints and tests everything under python/: the desktop exporter and the shared export package.
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
# **"MacOS Scripts" was the old name and described none of this.** There are no scripts here, and
# macOS is only where the runner happens to be - the local export route needs a Mac of 14 or older
# to test, and everything else under python/ is platform-agnostic. The name is what shows on the
# README badge, so it was telling every visitor that the exporter's tests were something else.
#
# The filename stays as it is: the badge URL is built from it, and renaming would break the badge
# on every page that already links it, for a cosmetic gain.
name: Exporter Tests
on:
push:
branches: [ "main" ]
paths:
- "python/**"
pull_request:
branches: [ "main" ]
paths:
- "python/**"
env:
PYTHONPATH: "${{ github.workspace }}/python:$PYTHONPATH"
jobs:
test:
runs-on: macos-14 # We *need* 14, this whole setup is only supported up to <= 14 (without weird security disabling hacks)
strategy:
fail-fast: true
matrix:
# 3.9 used to be here, because it is what the Xcode Command Line Tools install and so what
# anyone running the wizard from source on a stock Mac gets. It is gone because FindMy.py
# requires 3.10, and the iCloud export route is the whole point of this exporter now.
#
# The consequence is real and belongs in the wiki rather than only here: running from
# source - the VM bootstrap - now needs a Python installed first. The built .app is
# unaffected; it bundles its own interpreter.
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v5
# --frozen: install exactly what uv.lock records and fail if it disagrees with pyproject.toml,
# rather than quietly resolving something else. That is what makes the lock mean anything -
# FindMy.py is pinned there by commit, since it is a branch rather than a release.
- name: Install dependencies
working-directory: ./python
run: uv sync --frozen --python ${{ matrix.python-version }}
- name: Lint with flake8
working-directory: . # run flake8 from repository root, so it picks up .flake8
run: |
# stop the build if there are Python syntax errors or undefined names
uv run --project python flake8 ./python --count --select=E9,F63,F7,F82 --show-source --statistics
uv run --project python flake8 ./python --count --exit-zero --statistics
# Both suites: the wizard's own, and the shared export package's, which live with the package.
- name: Test with pytest
working-directory: ./python
run: uv run --frozen pytest ./test ./opentagviewer_export
# The release check reads VERSION out of main/version.py by parsing the module, so a refactor
# that makes it unreadable - moving it into a class, computing it from parts - would otherwise
# only surface when a release failed. This is that same read, run whenever python/ changes.
- name: Check the exporter version is still readable
working-directory: .
run: |
python scripts/release_version.py --kind exporter --print