Skip to content

Add dynamic field schema inference to k2a and create k2s command #757

Add dynamic field schema inference to k2a and create k2s command

Add dynamic field schema inference to k2a and create k2s command #757

Workflow file for this run

name: Upload Python Package and VS Code Extension
on:
push:
branches: [ master ]
tags:
- 'v*'
pull_request:
branches: [ master ]
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test-group:
- name: "Avro to C++/C#"
pattern: "test/test_avrotocpp.py test/test_avrotocsharp.py"
- name: "Avro to Go/Java/JS"
pattern: "test/test_avrotogo.py test/test_avrotojava.py test/test_avrotojs.py"
- name: "Avro to Python/Rust/TS"
pattern: "test/test_avrotopython.py test/test_avrotorust.py test/test_avrotots.py"
- name: "Avro to Other Formats"
pattern: "test/test_avrotodatapackage.py test/test_avrotodb.py test/test_avrotographql.py test/test_avrotoiceberg.py test/test_avrotojsons.py test/test_avrotojstruct.py test/test_avrotokusto.py test/test_avrotomd.py test/test_avrotoparquet.py test/test_avrotoproto.py test/test_avrotoxsd.py"
- name: "Structure to C++/C#"
pattern: "test/test_structuretocpp.py test/test_structuretocsharp.py"
- name: "Structure to Go/Python"
pattern: "test/test_structuretogo.py test/test_structuretopython.py"
- name: "Structure to Rust/TS"
pattern: "test/test_structuretorust.py test/test_structuretots.py"
- name: "Structure to Other Formats"
pattern: "test/test_structuretocsv.py test/test_structuretodatapackage.py test/test_structuretoiceberg.py test/test_structuretojsons.py test/test_structuretomd.py test/test_structuretoproto.py test/test_structuretoxsd.py"
- name: "Format to Avro"
pattern: "test/test_asn1toavro.py test/test_jsontoavro.py test/test_jstructtoavro.py test/test_kstructtoavro.py test/test_parquettoavro.py test/test_prototoavro.py test/test_xsdtoavro.py"
- name: "JSON Structure & Main"
pattern: "test/test_jsonstostructure.py test/test_main.py test/test_struct_to_schema_references.py"
name: "Tests: ${{ matrix.test-group.name }}"
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up .NET SDK 9.0
uses: actions/setup-dotnet@v5
with:
dotnet-version: 9.0
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
distribution: 'microsoft'
java-version: '21'
- name: Setup Maven Action
uses: s4u/[email protected]
with:
java-version: 21
maven-version: '3.9.6'
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: 3.10.12
# we need to build the package for generating the _version.py file that isn't checked in
- name: Install dependencies and build package
run: |
python -m pip install --upgrade pip build wheel
python -m pip install pylint
python -m pip install -r requirements.txt
python -m build --sdist --wheel --outdir dist
- name: Install dependencies
run: pip install pytest pytest-md pytest-emoji
- name: Run pytest for ${{ matrix.test-group.name }}
uses: pavelzw/pytest-action@v2
with:
verbose: true
emoji: true
job-summary: false
click-to-expand: true
report-title: 'Test Report: ${{ matrix.test-group.name }}'
custom-pytest: 'pytest ${{ matrix.test-group.pattern }}'
deploy:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build avrotize package
run: python -m build
- name: Build structurize package
run: |
export SETUPTOOLS_SCM_PRETEND_VERSION="${GITHUB_REF#refs/tags/v}"
cd structurize
bash build.sh
env:
GITHUB_REF: ${{ github.ref }}
- name: Update VS Code Extension Code with commands.json
run: |
python tools/editvscodeext.py --extension-root ${{ github.workspace }}/vscode/avrotize --commands ${{ github.workspace }}/avrotize/commands.json
- name: Install Node and NPM
uses: actions/setup-node@v6
with:
node-version: '20'
- name: Set up dependencies for VS Code Extension
run: |
cd ${{ github.workspace }}/vscode/avrotize
npm install
- name: Publish VS Code Extension
run: |
cd ${{ github.workspace }}/vscode/avrotize
npm run deploy
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
- name: Publish avrotize to PyPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e
with:
user: __token__
password: ${{ secrets.PYPI_API_KEY }}
- name: Publish structurize to PyPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e
with:
user: __token__
password: ${{ secrets.PYPI_API_KEY }}
packages_dir: structurize/dist/