-
Notifications
You must be signed in to change notification settings - Fork 66
169 lines (138 loc) · 4.48 KB
/
build_and_release.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
name: Test, Build and Deploy
on: [push]
permissions:
contents: read
jobs:
# Create a Debug build and test it.
build_and_test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-python@v5
with:
python-version: "3.10"
# Don't need to install Python / Create venv, as you are running in a container.
# You don't even need to install g++/cmake as it comes with the docker image.
- name: Install Dependencies
run: |
sudo apt update -y
sudo apt install build-essential uuid-dev cmake default-jre \
libantlr4-runtime-dev antlr4 libssl-dev -yq
pip install setuptools wheel cmake ninja patchelf auditwheel
pip install -r requirements.txt
- name: Check Your Environment
run: |
gcc -v
python --version
cmake --version
free
- name: Build
run: |
echo Your Build Script here
echo Make sure the Debug and Coverage Switch is on, only in this job.
- name: Test
run: |
echo Your Test Script here
- name: Extract Coverage Report
run: |
echo Your Coverage Report
# Build on Different Platform.
build_linux_amd64:
# This can be expensive so you might skip this if it is not tagged
# by uncommenting the following
# if: ${{ startsWith(github.ref, 'refs/tags/v') && success() }}
# Run only when the test is good.
if: ${{ success() }}
needs:
- build_and_test
strategy:
matrix:
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11", "3.12" ]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
sudo apt update -y
sudo apt install build-essential uuid-dev cmake default-jre \
libantlr4-runtime-dev antlr4 libssl-dev -yq
pip install setuptools wheel cmake ninja patchelf auditwheel
pip install -r requirements.txt
# Include ANTLR4's License file as we are redistributing their binary
- name: Adding ANTLR4 License
run: |
curl -s https://raw.githubusercontent.com/antlr/antlr4/master/LICENSE.txt >> LICENSE
# Build the library.
# Don't include debug and coverage stuff here.
# GitHub runner on Open source project is equipped with 4 cores.
# Use them with `-j 4` flag
- name: Build Library
run: |
python setup.py bdist_wheel -j 4
auditwheel repair --plat manylinux_2_31_x86_64 dist/*.whl
- name: Archive Artifacts
uses: actions/upload-artifact@v3
with:
name: PythonPackage
path: |
wheelhouse
# Build the Source Bundle
# Developer can still build on their machine with the source bundle
# (i.e. the original `pip install` flow if the platform is not included by above steps)
build_sdist:
runs-on: ubuntu-20.04
if: ${{ success() }}
needs:
- build_and_test
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install Dependencies
run: |
sudo apt update -y
sudo apt install build-essential uuid-dev cmake default-jre \
libantlr4-runtime-dev antlr4 libssl-dev -yq
pip install setuptools wheel cmake ninja patchelf auditwheel
pip install -r requirements.txt
# Not including ANTLR4 license here as we don't redistribute ANTLR4 Binary in this package.
- name: Build Source Library
run: |
python setup.py sdist
- name: Archive Artifacts
uses: actions/upload-artifact@v3
with:
name: PythonPackage
path: |
dist
# Add your testing steps here
publish:
runs-on: ubuntu-latest
# Publish only when a tag "v*" is pushed. (which is a release)
if: ${{ startsWith(github.ref, 'refs/tags/v') && success() }}
needs:
- build_linux_amd64
- build_sdist
environment:
name: pypi
url: https://pypi.org/p/hdlConvertor
permissions:
id-token: write
steps:
- name: Download Package Built
uses: actions/download-artifact@v3
with:
name: PythonPackage
path: dist
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1