This repository was archived by the owner on Dec 26, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (48 loc) · 1.93 KB
/
python-package.yml
File metadata and controls
53 lines (48 loc) · 1.93 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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python package
on: workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v4
- name: Get git version
id: version
uses: proudust/gh-describe@v2
- name: Build version module
run: |
echo "__version__ = '${{ steps.version.outputs.describe }}'" > src/adif_file/__version__.py
echo "__version_str__ = '${{ steps.version.outputs.describe }}'" >> src/adif_file/__version__.py
echo "__branch__ = ''" >> src/adif_file/__version__.py
echo "__unclean__ = False"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest build
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 ./src --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 ./src --count --exit-zero --max-complexity=15 --max-line-length=120 --statistics
- name: Test with pytest
run: |
PYTHONPATH=./src pytest
- name: Build package
run: |
python -m build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist_files-${{ steps.version.outputs.describe }}-Py${{ matrix.python-version }}
path: ${{ github.workspace }}/dist/*