forked from PyAr/pyafipws
-
Notifications
You must be signed in to change notification settings - Fork 0
239 lines (224 loc) · 8.33 KB
/
windows-installer.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# This workflow will install Python dependencies, build EXE and run some tests in Windows
# For more information see: https://github.com/py2exe/py2exe/blob/master/.github/workflows/CI.yml
name: Windows Installer
on: [push]
jobs:
compile:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
targetplatform: [x86, x64]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture : ${{ matrix.targetplatform }}
- name: Upgrade the package manager and related libraries
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools wheel
python -m pip install --upgrade cachetools pefile
- name: Install production dependencies
run: |
pip install -r requirements.txt
- name: Install development dependencies
run: |
pip install -r requirements-dev.txt
- name: Remove python2 library conflicts with py2exe
run: |
python -c "import aenum, os; os.unlink(os.path.join(os.path.dirname(aenum.__file__), '_py2.py'))"
- name: Install package
run: |
python setup.py install
- name: Build executables
run: |
python setup_win.py py2exe
- name: Download Visual Studio Redistributable (32bits)
if: matrix.targetplatform == 'x86'
run: |
curl -L https://aka.ms/vs/17/release/vc_redist.x86.exe -o vcredist.exe
- name: Download Visual Studio 22 Redistributable (64bits)
if: matrix.targetplatform != 'x86'
run: |
curl -L https://aka.ms/vs/17/release/vc_redist.x64.exe -o vcredist.exe
- name: Copy Visual Studio Redistributable
run: |
copy vcredist.exe .\dist\
- name: Install NSIS for building Installers
run: |
curl -L https://sourceforge.net/projects/nsis/files/latest/download -o NSISInstaller.exe
Start-Process -FilePath "NSISInstaller.exe" -ArgumentList "/S" -Wait
del "NSISInstaller.exe"
- name: Build PyAfipWs Installer
run: |
makensis.exe base.nsi
- name: Remove uneeded libs (TK)
run: |
Remove-Item .\dist\lib\tcl -recurse
Remove-Item .\dist\lib\tk -recurse
- name: Copy PowerShell tests into the release artifact
run: |
mkdir .\dist\tests
copy .\tests\powershell\*.* .\dist\tests
- name: Save repository metadata for release env-vars
run: |
echo release_version="${{ matrix.python-version }}".$(git rev-list --count --all) > dist/.env
echo git_short_hash=$(git rev-parse --short head) >> dist/.env
echo git_branch=$(git branch --show-current) >> dist/.env
echo workflow trigger: "${{ github.ref }}" - "${{ github.ref_name }}"
type dist/.env
- name: Deploy distribution binaries
uses: actions/upload-artifact@v3
with:
name: dist-${{ matrix.targetplatform }}
path: |
dist/
- name: Deploy PyAfipWs Installer
uses: actions/upload-artifact@v3
with:
name: PyAfipWs-Installer-${{ matrix.targetplatform }}
path: |
**/PyAfipWs-*-full.exe
test:
name: "Full End-2-End test"
needs: compile
runs-on: windows-latest
strategy:
matrix:
targetplatform: [x86, x64]
steps:
- name: Download distribution binaries
uses: actions/download-artifact@v3
with:
name: dist-${{ matrix.targetplatform }}
- name: Download certificate and private key
run: |
Invoke-WebRequest -Uri "https://www.sistemasagiles.com.ar/soft/pyafipws/reingart2021.zip" -OutFile reingart2019.zip
Expand-Archive reingart2019.zip -DestinationPath .
- name: Replace certificate and private key from secrets
shell: pwsh
env:
AFIP_TEST_PRIV_KEY: ${{ secrets.AFIP_TEST_PRIV_KEY }}
AFIP_TEST_CERT2: ${{ secrets.AFIP_TEST_CERT2 }}
AFIP_TEST_CERT3: ${{ secrets.AFIP_TEST_CERT3 }}
TARGET_PLATFORM: ${{ matrix.targetplatform }}
if: "${{ env.AFIP_TEST_PRIV_KEY != '' }}"
run: |
"$env:AFIP_TEST_PRIV_KEY" | Out-File -FilePath reingart.key
$( if ( "$env:TARGET_PLATFORM" -eq "x64" ) { "$env:AFIP_TEST_CERT2" } else { "$env:AFIP_TEST_CERT3" } ) | Out-File -FilePath reingart.crt
Get-Content -Path reingart.crt
Write-Host "TARGET_PLATFORM: $env:TARGET_PLATFORM"
- name: Copy rece.ini file
run: |
copy conf\rece.ini .
# - name: Test WSAA command line interface
# run: |
# .\wsaa.exe --analizar reingart.crt reingart.key wsmtxca 300
- name: Register WSAA component
run: |
.\wsaa.exe --register
Get-Content -Path $Env:APPDATA\wsaa.log -ErrorAction SilentlyContinue
- name: Register WSAA component (debug)
continue-on-error: true
run: |
reg export "HKEY_CLASSES_ROOT\CLSID\{51342E57-9681-4610-AF2B-686267470930}" wsaa.reg
type wsaa.reg
- name: Register WSFEv1 component
run: |
.\wsfev1.exe --register
Get-Content -Path $Env:APPDATA\wsfev1.log -ErrorAction SilentlyContinue
- name: Register WSFEv1 component (debug)
continue-on-error: true
run: |
reg export "HKEY_CLASSES_ROOT\CLSID\{FA1BB90B-53D1-4FDA-8D1F-DEED2700E739}" wsfev1.reg
type wsfev1.reg
# - name: Test WSAA COM server automation
# run: |
# .\tests\test_wsaa.ps1
# - name: Test WSFEv1 COM server automation
# run: |
# .\tests\test_wsfev1.ps1
# - name: Test RECE1 command line interface tool
# run: |
# $env:Path += ";$pwd"
# . .\tests\test_rece1.ps1
- name: List ejemplos directory
run: |
Get-ChildItem -Recurse .\ejemplos
- name: Create dist folder if not exists
run: |
New-Item -ItemType Directory -Force -Path .\dist
- name: Copy VBS files to dist folder
run: |
Copy-Item .\ejemplos\pyi25\pyi25.vbs .\dist\ -ErrorAction Continue -ErrorVariable copyErrors
if ($copyErrors) {
Write-Host "Error copying pyi25.vbs: $copyErrors"
}
Copy-Item .\ejemplos\pyqr\pyqr.vbs .\dist\ -ErrorAction Continue
Copy-Item .\ejemplos\factura_electronica.vbs .\dist\ -ErrorAction Continue
Copy-Item .\ejemplos\remito_electronico_carnico.vbs .\dist\ -ErrorAction Continue
Get-ChildItem .\dist
- name: Test pyi25.vbs
run: |
.\tests\test_pyi25.ps1
- name: Test pyqr.vbs
run: |
.\tests\test_pyqr.ps1
- name: Test factura_electronica.vbs
run: |
.\tests\test_factura_electronica.ps1
- name: Test remito_electronico_carnico.vbs
run: |
.\tests\test_remito_electronico_carnico.ps1
pre-release:
name: "Pre Release"
needs: compile
runs-on: "ubuntu-latest"
steps:
- name: Download 64Bit Installer
uses: actions/download-artifact@v3
with:
name: PyAfipWs-Installer-x64
path: PyAfipWs-Installer-x64.exe
- name: Download 32bit Installer
uses: actions/download-artifact@v3
with:
name: PyAfipWs-Installer-x86
path: PyAfipWs-Installer-x86.exe
- name: Download distribution binaries
uses: actions/download-artifact@v3
with:
name: dist-x86
path: dist-32
- name: Create ZIP archive
run: |
zip dist-32.zip -r dist-32
- name: Download distribution binaries
uses: actions/download-artifact@v3
with:
name: dist-x64
path: dist-64
- name: Create ZIP archive
run: |
zip dist-64.zip -r dist-64
- name: Set release env-vars
run: |
cat dist-64/.env >> $GITHUB_ENV
- uses: "marvinpinto/action-automatic-releases@latest"
if: github.actor != 'dependabot[bot]'
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: ${{ (github.ref_name != 'main') && 'beta' || 'latest' }}
prerelease: ${{ (github.ref != 'main') }}
title: "Dev Build ${{ env.release_version }} ${{ env.git_branch }} @ ${{ env.git_short_hash }}"
files: |
PyAfipWs-Installer-x64.exe
PyAfipWs-Installer-x86.exe
dist-32.zip
dist-64.zip