-
Notifications
You must be signed in to change notification settings - Fork 36
110 lines (108 loc) · 4.1 KB
/
build-binary.yml
File metadata and controls
110 lines (108 loc) · 4.1 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
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
name: Build Binary
on:
workflow_call:
inputs:
os:
required: true
type: string
name:
required: true
type: string
jobs:
build:
runs-on: ${{ inputs.os }}
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
id: pysetup
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install --no-deps -r requirements.txt
pip install -r requirements.txt --no-cache-dir
- name: Build Binary (Linux)
if: runner.os == 'Linux'
run: >-
pyinstaller --onedir --contents-directory "." core.py
--icon=resources/assets/CORE_logo_sm.ico
--dist ./dist/output/${{ inputs.name }}
--collect-submodules pyreadstat
--add-data=$pythonLocation/lib/python3.12/site-packages/xmlschema/schemas:xmlschema/schemas
--add-data=resources/cache:resources/cache
--add-data=resources/templates:resources/templates
--add-data=resources/schema:resources/schema
--add-data=resources/datasets:resources/datasets
--add-data=resources/jsonata:resources/jsonata
- name: Build Binary (Mac)
if: runner.os == 'macOS'
run: >-
pyinstaller --onedir --contents-directory "." core.py
--icon=resources/assets/CORE_logo_sm.icns
--dist ./dist/output/${{ inputs.name }}
--collect-submodules pyreadstat
--add-data=$pythonLocation/lib/python3.12/site-packages/xmlschema/schemas:xmlschema/schemas
--add-data=resources/cache:resources/cache
--add-data=resources/templates:resources/templates
--add-data=resources/schema:resources/schema
--add-data=resources/datasets:resources/datasets
--add-data=resources/jsonata:resources/jsonata
- name: Build Binary (Windows)
if: runner.os == 'Windows'
run: >-
pyinstaller --onedir --contents-directory "." core.py
--icon=resources/assets/CORE_logo_sm.ico
--dist ./dist/output/${{ inputs.name }}
--collect-submodules pyreadstat
--add-data="$env:pythonLocation\Lib\site-packages\xmlschema\schemas;xmlschema/schemas"
--hidden-import numpy
--hidden-import numpy.core._methods
--hidden-import numpy.lib.format
--add-data="resources/cache;resources/cache"
--add-data="resources/templates;resources/templates"
--add-data="resources/schema;resources/schema"
--add-data="resources/datasets;resources/datasets"
--add-data="resources/jsonata;resources/jsonata"
- name: Archive Binary
uses: actions/upload-artifact@v6
with:
name: ${{ inputs.name }}
path: dist/output/${{ inputs.name }}/
- name: Test Binary help command
run: |
cd dist/output/${{ inputs.name }}/core
if [ "${{ runner.os }}" = "Windows" ]; then
if ./core.exe --help; then echo "test passed"; else echo "test failed"; exit 1; fi
else
chmod +x core
if ./core --help; then echo "test passed"; else echo "test failed"; exit 1; fi
fi
shell: bash
- name: Test Binary test-validate commands
run: |
cd dist/output/${{ inputs.name }}/core
if [ "${{ runner.os }}" = "Windows" ]; then
./core.exe test-validate json
json_exit=$?
./core.exe test-validate xpt
xpt_exit=$?
else
chmod +x core
chmod -R 755 .
chmod -R +r resources/
./core test-validate json
json_exit=$?
./core test-validate xpt
xpt_exit=$?
fi
if [ $json_exit -eq 0 ] && [ $xpt_exit -eq 0 ]; then
echo "All validation tests succeeded"
exit 0
else
echo "Validation tests failed (JSON: $json_exit, XPT: $xpt_exit)"
exit 1
fi
shell: bash