Skip to content

Bugfix: GitHub output #35

Bugfix: GitHub output

Bugfix: GitHub output #35

Workflow file for this run

# GitHub Actions Pipeline
name: 'YoYoCICD'
on:
pull_request:
branches:
- main
paths:
- yoyo/**
- tests/**
- .github/workflows/**
push:
branches:
- main
paths:
- yoyo/**
- tests/**
- .github/workflows/**
# Repo Permissions
permissions:
contents: write
issues: read
checks: write
pull-requests: write
jobs:
Test:
runs-on: 'ubuntu-latest'
steps:
- name: checkout repo content
uses: actions/checkout@v2
- name: setup python
uses: actions/setup-python@v2
with:
python-version: '3.12'
- name: Upgrade package manager
run: python -m pip install -U pip
# Install dependencies
- name: install testing libraries
run: pip install pytest mock codecov pydocstyle pytest-cov pylint pylint_junit
- name: install project dependencies
run: python -m packages.sync
# Run tests
- name: Run tests
run: pytest -v tests/ --doctest-modules --junitxml=unit-testresults.xml --cov=yoyo/ --cov-append --cov-report=xml:xmlcov --cov-report=html:htmlcov
- name: Publish test reuslts
uses: EnricoMi/[email protected]
Build:
needs: Test
runs-on: 'ubuntu-latest'
steps:
- name: Checkout repo content
uses: actions/checkout@v2
- name: Install python
uses: actions/setup-python@v2
with:
python-version: '3.12'
# Install dependencies
- name: Upgrade pip
run: python -m pip install -U pip
- name: Install build dependencies
run: pip install build setuptools
- name: install project dependencies
run: python -m packages.sync
# Build
- name: Build distribution
run: python -m build --wheel
# Artifacts
- name: Check build reason
id: check_build
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "is_pr=true" >> "$GITHUB_OUTPUT"
else
echo "is_pr=false" >> "$GITHUB_OUTPUT"
fi
- name: Extract version
id: get_version
if: ${{ steps.check_build.outputs.isPR }} == 'true'
run: |
echo "Getting version from __init__.py..."
VERSION=$(python <<EOF
__version__
print(__version__)
EOF
)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo"current build : $VERSION"
- name: Create release
uses: ncipollo/[email protected]
if: ${{ steps.check_build.outputs.is_pr }} == 'true'
with:
tag: "${{ steps.get_version.outputs.version }}"
allowUpdates: true
replacesArtifacts: true
# # PYPI API Key not yet configured
# Release:
# needs: Build
# runs-on: ubuntu-latest
# steps:
# - name: Check out code
# uses: actions/checkout@v2
# - name: Set up Python
# uses: actions/setup-python@v2
# with:
# python-version: 3.12
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install setuptools wheel twine
# - name: Build and publish
# env:
# TWINE_USERNAME: __token__
# TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
# run: |
# python setup.py sdist bdist_wheel
# twine upload dist/*