forked from google/magika
-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (74 loc) · 2.9 KB
/
python-test-suite.yml
File metadata and controls
92 lines (74 loc) · 2.9 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
81
82
83
84
85
86
87
88
89
90
91
92
name: Python - run test suite
on:
workflow_dispatch:
push:
branches:
- "main"
pull_request:
paths:
- "python/**"
- "rust/**"
- "tests_data/**"
- ".github/workflows/python-test-suite.yml"
permissions:
contents: read
env:
UV_VERSION: "0.9.5"
jobs:
unit-testing:
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
os: ["ubuntu-latest", "macos-latest"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v4
- name: Setup Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # pin@v5
with:
python-version: "${{ matrix.python-version }}"
- name: Install uv
run: curl -LsSf https://astral.sh/uv/${{ env.UV_VERSION }}/install.sh | sh
- name: Install all projects dependencies (with the requested python version)
working-directory: python
run: uv sync --python ${{ matrix.python-version }} --all-extras --dev
- name: Print python version
working-directory: python
run: uv run --python ${{ matrix.python-version }} python --version
- name: Run ruff check
working-directory: python
run: uv run --python ${{ matrix.python-version }} ruff check --verbose
- name: Run ruff format --check
working-directory: python
run: uv run --python ${{ matrix.python-version }} ruff format --check --verbose
- name: Run mypy
working-directory: python
run: uv run --python ${{ matrix.python-version }} mypy src/magika tests
- name: Run copyright checks
working-directory: python
run: uv run ./scripts/check_copyright.py
- name: Run the python tests suite
working-directory: python
run: uv run --python ${{ matrix.python-version }} pytest tests -m "not slow"
- name: Run magika --version
working-directory: python
run: uv run --python ${{ matrix.python-version }} magika --version
shell: bash # Allows for cross-platform
- name: Run magika with tests_data
working-directory: python
run: uv run --python ${{ matrix.python-version }} magika -r ../tests_data/basic
- name: Run "magika cli" quick tests
working-directory: python
run: uv run --python ${{ matrix.python-version }} scripts/run_quick_test_magika_cli.py
- name: Run "magika module" quick tests
working-directory: python
run: uv run --python ${{ matrix.python-version }} scripts/run_quick_test_magika_module.py
changelog-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # pin@v4
with:
fetch-depth: 0
- name: Check for undocumented changes
run: ./scripts/check_changelog.sh ${{ github.base_ref }}
working-directory: python