Merge pull request #19 from swarmauri/cobycloud-patch-1 #101
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 and Publish | |
on: | |
push: | |
tags: | |
- 'v*' # Trigger on tags that start with "v" | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
pkg-dir: [pkgs/crouton, pkgs/crouton_client] # Specify the directories for each package | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install Poetry | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV | |
- name: Install dependencies | |
run: | | |
cd ${{ matrix.pkg-dir }} | |
poetry install --no-cache -vv | |
- name: Lint with flake8 | |
run: | | |
cd ${{ matrix.pkg-dir }} | |
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Build the package | |
run: | | |
cd ${{ matrix.pkg-dir }} | |
poetry build | |
- name: Install built package | |
run: | | |
LATEST_WHL=$(ls ${{ matrix.pkg-dir }}/dist/*.whl | sort -V | tail -n 1) | |
python -m pip install "$LATEST_WHL" --no-cache-dir | |
- name: Get pip freeze | |
run: | | |
pip freeze | |
- name: Run tests | |
run: | | |
cd ${{ matrix.pkg-dir }} | |
# poetry run pytest -v tests --junitxml=results.xml | |
continue-on-error: true | |
- name: Publish to PyPI | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: pypa/[email protected] | |
with: | |
user: ${{ secrets.POETRY_PYPI_USERNAME }} | |
password: ${{ matrix.pkg-dir == 'pkgs/crouton' && secrets.POETRY_PYPI_CROUTON_API_TOKEN || secrets.POETRY_PYPI_CROUTON_CLIENT_API_TOKEN }} | |
packages_dir: ${{ matrix.pkg-dir }}/dist |