1+ name : Build-and-Push-TEST
2+
3+ on : [push,pull_request]
4+
5+ jobs :
6+ generate :
7+ name : Generate etptypes code
8+ runs-on : ubuntu-latest
9+
10+ steps :
11+ - uses : actions/checkout@v3
12+
13+ - name : Set up Python ${{ matrix.python-version }}
14+ uses : actions/setup-python@v4
15+ with :
16+ python-version : 3.9
17+
18+ - name : Download ETP file
19+ run : wget http://geosiris.com/wp-content/uploads/2022/09/etp/${{ secrets.ETP_FILE_NAME}} -P ${{ github.workspace }}
20+
21+ - name : Install dependencies
22+ run : |
23+ python -m pip install --upgrade pip
24+ pip install pydantic typingx avro-to-python-etp
25+
26+ - name : Translate avpr to avsc
27+ run : |
28+ avpr-to-avsc ${{ secrets.ETP_FILE_NAME}}
29+
30+ - name : Generate classes
31+ run : |
32+ avro-to-python-etp output/Energistics tmp --pip etptypes --package_version ${{ secrets.PACKAGE_VERSION }}
33+
34+ - name : Archive production artifacts
35+ uses : actions/upload-artifact@v3
36+ with :
37+ name : etptypes-generated-artifact
38+ retention-days : 1
39+ path : |
40+ ${{ github.workspace }}/tmp/etptypes/*
41+
42+ build :
43+ needs : generate
44+
45+ name : Building generated code
46+ runs-on : ubuntu-latest
47+
48+ steps :
49+ - uses : actions/checkout@v3
50+
51+ - name : Set up Python ${{ matrix.python-version }}
52+ uses : actions/setup-python@v4
53+ with :
54+ python-version : 3.9
55+
56+ - name : Get build artifacts
57+ uses : actions/download-artifact@v3
58+ with :
59+ name : etptypes-generated-artifact
60+ path : etptypes/
61+
62+ - name : Installation
63+ run : |
64+ python -m pip install --upgrade pip
65+ pip install poetry
66+ pip install poetry-dynamic-versioning
67+ pip install black
68+
69+ - name : Python Black
70+ run : |
71+ cd ${{ github.workspace }}/etptypes
72+ black -t py39 etptypes
73+
74+ - name : Build Etptypes-python
75+ run : |
76+ cd etptypes
77+ rm pyproject.toml
78+ cp ${{ github.workspace }}/pyproject.toml .
79+ cp ${{ github.workspace }}/LICENSE .
80+ cp ${{ github.workspace }}/README.md .
81+ poetry build
82+
83+ - name : Archive production artifacts
84+ uses : actions/upload-artifact@v3
85+ with :
86+ name : dist-artifact
87+ retention-days : 1
88+ path : |
89+ ${{ github.workspace }}/etptypes/dist
90+ ${{ github.workspace }}/etptypes/pyproject.toml
91+ ${{ github.workspace }}/etptypes/LICENSE
92+ ${{ github.workspace }}/etptypes/README.md
93+
94+ publish :
95+ needs : build
96+
97+ name : Publish to PyPI-test
98+ runs-on : ubuntu-latest
99+
100+ steps :
101+ - uses : actions/checkout@v3
102+
103+ - name : Set up Python ${{ matrix.python-version }}
104+ uses : actions/setup-python@v4
105+ with :
106+ python-version : 3.9
107+
108+ - name : Get build artifacts
109+ uses : actions/download-artifact@v3
110+ with :
111+ name : dist-artifact
112+ path : etptypes/
113+
114+ - name : Install Poetry
115+ run : |
116+ ls etptypes
117+ python -m pip install --upgrade pip
118+ pip install poetry
119+ pip install poetry-dynamic-versioning
120+
121+ - name : Upload to PyPI TEST
122+ run : |
123+ cd etptypes
124+ poetry config repositories.test https://test.pypi.org/legacy/
125+ poetry config http-basic.test ${{ secrets.POETRY_PYPI_TOKEN_USERNAME}} ${{ secrets.POETRY_TEST_PYPI_TOKEN_PASSWORD}}
126+ poetry publish --repository test
0 commit comments