Generate 'betterproto' classes for better experience in Python. #202
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build, test and publish | |
on: | |
push: | |
branches: [ master, develop ] | |
tags: | |
- 'v*' | |
paths-ignore: | |
- python/docs/** | |
- cpp/docs/** | |
- README.md | |
- CHANGELOG.md | |
pull_request: | |
branches: [ master, develop ] | |
paths-ignore: | |
- python/docs/** | |
- cpp/docs/** | |
- README.md | |
- CHANGELOG.md | |
env: | |
CONAN_USER_HOME: /home/runner/ | |
PROTOC: ./bin/protoc | |
CONAN_VERSION: 1.59.0 | |
jobs: | |
cpp-build: | |
name: "Test C++ generation" | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./cpp | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Install conan | |
run: pip3 install conan~=${CONAN_VERSION} | |
- name: Build package | |
run: | | |
mkdir build | |
cd build | |
cmake -DCMAKE_BUILD_TYPE=Release .. | |
cmake --build . | |
cpp-conan-test: | |
needs: [ cpp-build ] | |
name: "Test package with examples" | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./cpp | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Install conan | |
run: pip3 install conan~=${CONAN_VERSION} | |
- name: Create profile | |
run: | | |
conan profile new default --detect | |
conan profile update settings.compiler.libcxx=libstdc++11 default | |
- name: Build test package | |
run: | | |
conan remote add panda https://conan.panda.technology/artifactory/api/conan/drift | |
CONAN_DP_SOURCE_DIR=`pwd`/.. conan create . drift/develop --build=missing | |
- name: Build examples | |
run: | | |
mkdir examples/build | |
cd examples/build | |
cmake -DCMAKE_BUILD_TYPE=Release .. | |
cmake --build . --target all | |
- name: Run examples | |
run: find examples/build/bin/ -type f -executable -print0 | xargs -n 1 -0 nice | |
cpp-conan-upload: | |
needs: [ cpp-conan-test ] | |
name: "Build and upload conan package" | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./cpp | |
strategy: | |
matrix: | |
arch: [x86_64, armv8] | |
include: | |
- arch: x86_64 | |
dep_install_cmd: "" | |
conan_tail: "" | |
- arch: armv8 | |
dep_install_cmd: "sudo apt-get update && sudo apt-get install g++-aarch64-linux-gnu" | |
conan_tail: "-pr:b=default -pr:h=./linux_armv8 -tf=None" | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Install conan | |
run: pip3 install conan~=${CONAN_VERSION} | |
- name: Setup panda remote | |
run: | | |
conan remote add panda https://conan.panda.technology/artifactory/api/conan/drift | |
conan user -p ${{secrets.CONAN_PASSWORD}} -r panda --skip-auth ${{secrets.CONAN_LOGIN_USERNAME}} | |
- name: Install compiler toolkit | |
run: ${{ matrix.dep_install_cmd }} | |
- name: Prefix version for development version | |
if: ${{ (github.ref == 'refs/heads/develop') }} | |
run: echo "VERSION_SUFFIX=$(echo ${GITHUB_RUN_ID})" >> $GITHUB_ENV | |
- name: Create profile | |
run: | | |
conan profile new default --detect | |
conan profile update settings.compiler.libcxx=libstdc++11 default | |
- name: Build package for stable channel | |
if: github.ref_type == 'tag' | |
run: | | |
CONAN_DP_SOURCE_DIR=`pwd`/.. conan create . drift/stable --build=missing ${{ matrix.conan_tail }} | |
- name: Build package for develop channel | |
if: github.ref_type == 'branch' | |
run: | | |
CONAN_DP_SOURCE_DIR=`pwd`/.. conan create . drift/develop --build=missing ${{ matrix.conan_tail }} | |
- name: Upload package | |
run: conan upload drift_protocol --all --confirm --remote=panda | |
py-format: | |
runs-on: ubuntu-latest | |
name: "Check PEP-8" | |
defaults: | |
run: | |
working-directory: ./python | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Update pip | |
run: python3 -m pip install --no-cache --upgrade pip | |
- name: Install dependencies | |
run: pip3 install -r extra_requirements.txt | |
- name: Check PEP8 with black | |
run: black . --check | |
py-pip: | |
name: "Build PIP package" | |
needs: [ py-format ] | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./python | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/download-protoc | |
- name: Prefix version for development version | |
if: ${{ (github.ref == 'refs/heads/develop') }} | |
run: echo "VERSION_SUFFIX=$(echo ${GITHUB_RUN_ID})" >> $GITHUB_ENV | |
- name: Build package | |
run: | | |
python3 setup.py egg_info | |
python3 setup.py bdist_wheel | |
- name: Build package | |
run: python3 setup.py bdist_wheel | |
- uses: actions/upload-artifact@master | |
with: | |
name: package | |
path: ./python/dist | |
py-lint: | |
name: "Lint PIP package" | |
needs: [ py-pip ] | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./python | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/install-pkg | |
- name: Run Pylint for tests | |
run: pylint tests/ | |
py-test: | |
name: "Test PIP package" | |
needs: [ py-pip ] | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./python | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/download-protoc | |
- uses: ./.github/actions/install-pkg | |
- name: Run Pytest | |
run: pytest tests/ | |
py-test-examples: | |
name: "Test Examples" | |
needs: [ py-pip ] | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./python | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/install-pkg | |
- name: Install example dependencies | |
run: pip3 install -r examples/requirements.txt | |
- name: Run Examples | |
run: find examples/ -name "*.py" -print0 | xargs -n 1 -0 python3 | |
py-pip-upload: | |
name: Upload if release | |
needs: [ py-test, py-lint, py-pip, py-test-examples ] | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./python | |
if: ${{ startsWith(github.event.ref, 'refs/tags/v') }} | |
steps: | |
- uses: actions/setup-python@v2 | |
- uses: actions/download-artifact@v2 | |
with: | |
name: package | |
path: ./dist | |
- uses: pypa/[email protected] | |
with: | |
user: ${{ secrets.PYPI_USERNAME }} | |
password: ${{ secrets.PYPI_PASSWORD }} |