-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (130 loc) · 4.09 KB
/
python-package.yml
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# 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:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: macos-latest
strategy:
matrix:
python-version:
- "3.8" # EOL: 2024-10
- "3.9" # EOL: 2025-10
- "3.10" # EOL: 2026-10
- "3.11" # EOL: 2027-10
- "3.12" # EOL: 2028-10
#- "3.13" # REL: 2024-10-01
- "system"
# see supported python release schedule at https://devguide.python.org/versions/
steps:
- uses: actions/checkout@v4
with:
repository: getargv/getargv
path: getargv
token: ${{ secrets.GH_PAT }}
- name: Build libgetargv
run: make dylib
working-directory: getargv
- name: Install libgetargv
run: sudo make install_dylib
working-directory: getargv
- uses: actions/checkout@v4
with:
path: getargv.py
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
if: ${{ matrix.python-version != 'system' }}
with:
python-version: ${{ matrix.python-version }}
check-latest: true
- name: Set up Python ${{ matrix.python-version }}
run: echo "PATH=/usr/bin:`/usr/bin/python3 -m site --user-base`/bin:$PATH" >> $GITHUB_ENV
if: ${{ matrix.python-version == 'system' }}
- name: Upgrade pip & Install deps
run: |
python3 -m pip install --upgrade pip
python3 -m pip install build pyright
- name: Build
run: |
python3 -m build
python3 -m pip install dist/getargv-*.tar.gz
working-directory: getargv.py
- name: Test
run: python3 tests/testgetargv.py
working-directory: getargv.py
- name: Types Test
run: pyright --verifytypes getargv
working-directory: getargv.py
release:
needs: [ build ]
runs-on: macos-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
repository: getargv/getargv
path: getargv
token: ${{ secrets.GH_PAT }}
- name: Build libgetargv
run: make dylib
working-directory: getargv
- name: Install libgetargv
run: sudo make install_dylib
working-directory: getargv
- uses: actions/checkout@v4
with:
path: getargv.py
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: 3.x
check-latest: true
- name: Upgrade pip & Install deps
run: |
python3 -m pip install --upgrade pip
python3 -m pip install build pyright
- name: Bump version
id: bump_version
run: |
make bump_version
echo "new_version=$(make version)" >> $GITHUB_OUTPUT
working-directory: getargv.py
- name: Build & install
run: |
python3 -m build
python3 -m pip install dist/getargv-*.tar.gz
working-directory: getargv.py
- uses: actions/upload-artifact@v4
with:
name: dist
path: getargv.py/dist
- name: create && push tag
run: |
git commit -am 'release ${{ steps.bump_version.outputs.new_version }}'
git tag '${{ steps.bump_version.outputs.new_version }}'
git push origin tag '${{ steps.bump_version.outputs.new_version }}'
git push origin HEAD:main
working-directory: getargv.py
- name: Release
uses: softprops/action-gh-release@v2
with:
files: getargv.py/dist/*
name: ${{ steps.bump_version.outputs.new_version }}
tag_name: ${{ steps.bump_version.outputs.new_version }}
pypi-publish:
needs: [ release ]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/getargv/
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/download-artifact@v4
- uses: pypa/gh-action-pypi-publish@release/v1