Skip to content

Bugfix: GitHub output #33

Bugfix: GitHub output

Bugfix: GitHub output #33

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'
outputs:
isPR: ${{ steps.check_build.outputs.is_pr }}
VERSION: ${{ steps.get_version.outputs.version }}
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: ${{ outputs.isPR }} == 'true'

Check failure on line 101 in .github/workflows/build.yaml

View workflow run for this annotation

GitHub Actions / YoYoCICD

Invalid workflow file

The workflow is not valid. .github/workflows/build.yaml (Line: 101, Col: 11): Unrecognized named-value: 'outputs'. Located at position 1 within expression: outputs.isPR .github/workflows/build.yaml (Line: 115, Col: 12): Unrecognized named-value: 'outputs'. Located at position 1 within expression: outputs.VERSION
run: |
echo "Getting version from __init__.py..."
VERSION=$(python <<EOF
import re
with open('yoyo/__init__.py', 'r') as file:
data = file.read()
match = re.search(r"__version__ = '\"['\"]", data)
print(match.group(1) if match else '')
EOF
)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: test
run: |
echo ${{ outputs.VERSION }}
echo ${{ outputs.isPR }}
- name: Create release
uses: ncipollo/[email protected]
if: ${{ outputs.isPR }} == 'true'
with:
tag: ${{ 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/*