3333 - name : check complexity and length # the GitHub editor is 127 chars wide
3434 run : flake8 . --count --max-complexity=12 --max-line-length=127 --statistics
3535
36+ python :
37+ strategy :
38+ fail-fast : false
39+ matrix :
40+ python-version : [ "2.7","3" ]
41+ runs-on : ubuntu-22.04
42+ timeout-minutes : 5
43+ steps :
44+ - uses : actions/checkout@v4
45+ - run : sudo apt-get update && sudo apt-get install -y python${{ matrix.python-version }}
46+ - name : test help command
47+ run : python${{ matrix.python-version }} run.py -h
48+ - name : test config generation
49+ run : python${{ matrix.python-version }} run.py || test -e config.json
50+ - name : test version
51+ run : python${{ matrix.python-version }} run.py --version
52+
3653 pypi :
3754 runs-on : ubuntu-latest
3855 timeout-minutes : 5
5572 path : dist/
5673 retention-days : 5
5774
75+
5876 pyinstaller :
5977 strategy :
6078 # fail-fast: false
95113 retention-days : 3
96114
97115 nuitka :
116+ needs : [ python ]
98117 strategy :
99118 fail-fast : false
100119 matrix :
@@ -122,8 +141,9 @@ jobs:
122141 with :
123142 python-version : 3.x
124143 architecture : ${{ matrix.arch }}
125- - name : Install dependencies
126- run : python3 -m pip install -U nuitka
144+
145+ - name : remove python2 code
146+ run : python3 .build/remove_python2.py
127147
128148 # Prepare build version and cert
129149 - name : Replace build version
@@ -133,34 +153,67 @@ jobs:
133153 - name : Set up on Linux
134154 if : runner.os == 'Linux'
135155 run : |
136- sudo apt-get update
137- sudo apt-get install -y patchelf
138- echo " --static-libpython=yes --linux-icon=.build/icon.png" >> .build/nuitka.cmd
156+ sudo apt-get update && sudo apt-get install -y patchelf
139157 cp /etc/ssl/certs/ca-certificates.crt cert.pem && export SSL_CERT_FILE=${PWD}/cert.pem
140158
141159 - name : Set up on macOS
142160 if : runner.os == 'macOS'
143- run : |
144- python3 -m pip install imageio
145- echo " --macos-app-name=DDNS --macos-app-icon=.build/icon.png" >> .build/nuitka.cmd
146-
161+ run : python3 -m pip install imageio
162+
147163 - run : python3 ./run.py -h
148164
149- - name : Package binary
150- run : ./.build/nuitka.cmd
165+ - name : Build Executable
166+ uses : Nuitka/Nuitka-Action@main
167+ with :
168+ nuitka-version : main
169+ script-name : run.py
170+ mode : onefile
171+ output-dir : dist
172+ output-file : ddns
173+ no-deployment-flag : self-execution
174+ include-module : |
175+ dns.dnspod
176+ dns.alidns
177+ dns.dnspod_com
178+ dns.dnscom
179+ dns.cloudflare
180+ dns.he
181+ dns.huaweidns
182+ dns.callback
183+ file-description : " DDNS Client 更新域名解析本机IP"
184+ product-name : DDNS
185+ company-name : " New Future"
186+ copyright : " https://ddns.newfuture.cc"
187+ assume-yes-for-downloads : true
188+ lto : auto
189+ python-flag : no_site,no_asserts,no_docstrings,isolated,static_hashes
190+ nofollow-import-to : tkinter,unittest,pydoc,doctest,distutils,setuptools,lib2to3,test,idlelib,lzma
191+ onefile-tempdir-spec : " {CACHE_DIR}/{PRODUCT}_{VERSION}"
192+ windows-icon-from-ico : ${{ runner.os == 'Windows' && 'favicon.ico' || '' }}
193+ linux-icon : ${{ runner.os == 'Linux' && '.build/icon.png' || '' }}
194+ static-libpython : ${{ runner.os == 'yes' || 'auto' }}
195+ macos-app-name : ${{ runner.os == 'macOS' && 'DDNS' || '' }}
196+ macos-app-icon : ${{ runner.os == 'macOS' && '.build/icon.png' || '' }}
197+
151198
152199 - run : ./dist/ddns || test -e config.json
153200 - run : ./dist/ddns -h
154201
155202 # Upload build result
156- - uses : actions/upload-artifact@v4
203+ - name : Upload Artifacts
204+ uses : actions/upload-artifact@v4
157205 with :
158206 name : ddns-${{ runner.os }}-${{ matrix.arch }}
159- path : dist/
160- retention-days : 7
207+ if-no-files-found : error
208+ path : |
209+ dist/*.exe
210+ dist/*.bin
211+ dist/*.app
212+ dist/ddns
161213
162214 docker :
163215 if : github.event_name == 'pull_request'
216+ needs : [ python ]
164217 strategy :
165218 matrix :
166219 platforms : [ linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/riscv64,linux/s390x ]
@@ -189,7 +242,7 @@ jobs:
189242 preview-pypi :
190243 runs-on : ubuntu-latest
191244 if : github.event_name == 'push'
192- needs : [lint, pypi]
245+ needs : [lint, pypi, python ]
193246 timeout-minutes : 3
194247 environment :
195248 name : preview
@@ -207,8 +260,9 @@ jobs:
207260 print-hash : true
208261
209262 preview-docker :
210- runs-on : ubuntu-latest
211263 if : github.event_name == 'push'
264+ needs : [lint, python]
265+ runs-on : ubuntu-latest
212266 timeout-minutes : 120
213267 environment :
214268 name : preview
0 commit comments