-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (66 loc) · 1.95 KB
/
ci.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
name: zs-yaml CI/CD
on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main
jobs:
test-build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Install zs-yaml in dev mode
run: |
pip install -e .
- name: Generate schema API for team example
run: |
cd examples/team
zserio team.zs -withTypeInfoCode -python zs_gen_api
echo "PYTHONPATH=$PYTHONPATH:$PWD/zs_gen_api" >> $GITHUB_ENV
- name: Test team example transformation
run: |
cd examples/team
zs-yaml team1.yaml team1_test_out.bin
if [ $? -eq 0 ]; then
echo "Transformation successful"
else
echo "Transformation failed"
exit 1
fi
- name: Set version
run: |
if [[ $GITHUB_REF == refs/tags/v* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
elif [[ $GITHUB_REF == refs/heads/main ]]; then
VERSION=$(python setup.py --version)
else
VERSION=$(python setup.py --version).dev0
fi
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "Extracted version: ${VERSION}"
sed -i "s/__version__ = .*/__version__ = '${VERSION}'/" zs_yaml/_version.py
- name: Build package
run: |
python setup.py sdist bdist_wheel
- name: Check distribution
run: |
twine check dist/*
- name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags/v')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.KE_PYPI_TOKEN }}
run: |
twine upload dist/*