Skip to content

ci

ci #67

Workflow file for this run

##
## Copyright (c) 2022-2023 Geosiris.
## SPDX-License-Identifier: Apache-2.0
##
name: Build-and-Push-TEST
on:
push:
branches:
- main
pull_request:
env:
GENERATED_CODE_FOLDER: etptypes
PYTHON_VERSION: 3.9
jobs:
build:
name: Building and push generated code
runs-on: ubuntu-latest
steps:
- name: πŸ“₯ Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch the entire history to avoid shallow repository issues
- name: Generate code from avro-to-python-etp
uses: ./.github/actions/generate
with:
python-version: ${{ env.PYTHON_VERSION }}
dest-folder: ${{ env.GENERATED_CODE_FOLDER }}
etp-file-name: ${{ secrets.ETP_FILE_NAME }}
- name: 🐍 Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: πŸ’Ύ Cache Poetry dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
poetry-${{ runner.os }}-
- name: πŸ“¦ Install poetry
uses: abatilo/actions-poetry@v4
with:
poetry-version: '2.1.1'
- name: Python Black
run: |
cd ${{ env.GENERATED_CODE_FOLDER }}
poetry add -D black
poetry run black etptypes
- name: πŸ“¦ Install poetry-dynamic-versioning
run: poetry add -D poetry-dynamic-versioning[plugin]
- name: πŸ“₯ Install dependencies
run: poetry install --no-interaction --no-root
- name: Configure Poetry with PyPI repository and token
run: |
poetry config repositories.test-pypi https://test.pypi.org/legacy/
poetry config pypi-token.test-pypi ${{ secrets.POETRY_PYPI_TEST_TOKEN_VALUE }}
- name: πŸ› οΈ Build the package
run: |
cd ${{ env.GENERATED_CODE_FOLDER }}
rm -rf dist
rm pyproject.toml
cp ${{ github.workspace }}/pyproject.toml .
cp ${{ github.workspace }}/LICENSE .
cp ${{ github.workspace }}/README.md .
if [ ! -f pyproject.toml ]; then echo "pyproject.toml not found"; exit 1; fi
if [ ! -f LICENSE ]; then echo "LICENSE not found"; exit 1; fi
if [ ! -f README.md ]; then echo "README.md not found"; exit 1; fi
poetry version $(poetry version | awk '{print $2}')
# poetry build
# - name: Debug Publish Step
# run: |
# cd ${{ env.GENERATED_CODE_FOLDER }}
# pwd
# ls dist
# poetry version
# poetry config --list
- name: πŸš€ Publish to PyPI
run: |
cd ${{ env.GENERATED_CODE_FOLDER }}
# poetry version
poetry publish --repository test-pypi --build