-
Notifications
You must be signed in to change notification settings - Fork 228
167 lines (159 loc) · 5.79 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
# 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: 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/
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
pre-release:
name: "Pre Release"
needs: compile
runs-on: "ubuntu-latest"
steps:
- 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: |
dist-32.zip
dist-64.zip