1+ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+ # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+ name : Python package
5+
6+ on :
7+ workflow_dispatch : {}
8+ push : {}
9+ pull_request :
10+ branches : [ master ]
11+
12+ jobs :
13+ build_deps :
14+ permissions :
15+ contents : write
16+ runs-on : ${{ matrix.os }}
17+ strategy :
18+ matrix :
19+ # os: [ubuntu-latest, windows-latest, macOS-latest]
20+ os : [windows-latest]
21+ platform : [x86, x64]
22+ python-version : ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
23+ python-platform : [x86, x64]
24+ # exclude:
25+ # - platform: x86
26+ # python-platform: x64
27+ # - os: ubuntu-latest
28+ # python-platform: x86
29+ # - os: ubuntu-latest
30+ # platform: x86
31+ # - os: macOS-latest
32+ # python-platform: x86
33+ # - os: macOS-latest
34+ # platform: x86
35+ # - platform: x64
36+ # python-platform: x86
37+ steps :
38+ - uses : actions/checkout@v4
39+ - name : Set up Python ${{ matrix.python-version }}
40+ uses : actions/setup-python@v5
41+ with :
42+ python-version : ${{ matrix.python-version }}
43+ architecture : ${{ matrix.python-platform }}
44+ - name : Enable Developer Command Prompt
45+ 46+ with :
47+ arch : ${{ matrix.python-platform }}
48+ if : matrix.os == 'windows-latest'
49+ - name : Install dependencies
50+ shell : bash
51+ run : |
52+ python -m pip install --upgrade pip
53+ python -m pip install --upgrade wheel setuptools Cython
54+ pip install flake8 pytest
55+ pip install -r requirements.txt
56+ - name : Lint with flake8
57+ shell : bash
58+ run : |
59+ # stop the build if there are Python syntax errors or undefined names
60+ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude examples
61+ # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
62+ flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude examples
63+
64+ - name : Run tests
65+ shell : bash
66+ run : |
67+ python -m pip install pytest
68+ python -m pytest
69+
70+ - name : Build wheel dependencies
71+ shell : bash
72+ run : |
73+ python -m pip wheel . -w dist
74+
75+ - name : Archive packages
76+ uses : actions/upload-artifact@v4
77+ with :
78+ name : dclimplode-py${{ matrix.python-version }}-${{ matrix.python-platform }}-${{ matrix.os }}-${{ matrix.platform }}
79+ path : |
80+ dist/dclimplode-*
81+
82+ - name : Ensure release exists
83+ if : github.ref_type == 'tag'
84+ shell : bash
85+ env :
86+ GH_TOKEN : ${{ github.token }}
87+ run : |
88+ # Set continue on error to true
89+ set +e
90+ if [[ "$(gh --repo sourcehold/sourcehold-maps release view $RELEASE_TAG 2>&1)" == "release not found" ]]; then
91+ set -e
92+ gh --repo sourcehold/sourcehold-maps release create ${{ github.ref_name }} --latest
93+ fi
94+ - name : Upload dclimplode wheel to release
95+ if : github.ref_type == 'tag'
96+ shell : bash
97+ env :
98+ GH_TOKEN : ${{ github.token }}
99+ run : |
100+ gh --repo sourcehold/sourcehold-maps release upload ${{ github.ref_name }} dist/dclimplode-*
0 commit comments