Publish Python Package - TestPyPI #26
Workflow file for this run
This file contains hidden or 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: Publish Python Package - TestPyPI | |
# This workflow will upload a TestPyPI Python Package using Twine on demand (dispatch) | |
on: [ workflow_dispatch ] | |
permissions: | |
contents: read | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10.x' | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements-dev.txt | |
- name: Build Package | |
run: make dist | |
- name: Install Test Package | |
run: | | |
pip install -r requirements.txt | |
scanoss_version=$(python ./version.py) | |
echo "Local test install of scanoss ${scanoss_version}..." | |
pip install dist/scanoss-*-py3-none-any.whl | |
which scanoss-py | |
- name: Run Local Tests | |
run: | | |
which scanoss-py | |
scanoss-py version | |
scanoss-py scan tests > results.json | |
id_count=$(cat results.json | grep '"id":' | wc -l) | |
echo "ID Count: $id_count" | |
if [[ $id_count -lt 1 ]]; then | |
echo "Error: Scan test did not produce any results. Failing" | |
exit 1 | |
fi | |
pip uninstall -y scanoss | |
- name: Publish Test Package | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
skip-existing: true | |
user: __token__ | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository-url: https://test.pypi.org/legacy/ | |
test: | |
if: success() | |
needs: [ deploy ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10.x' | |
- name: Install Remote Package | |
run: | | |
scanoss_version=$(python ./version.py) | |
pip install -r requirements.txt | |
echo "Install TestPyPI scanoss ${scanoss_version}..." | |
pip install -i https://test.pypi.org/simple/ --upgrade scanoss==${scanoss_version} | |
which scanoss-py | |
- name: Run Tests | |
run: | | |
which scanoss-py | |
scanoss-py version | |
scanoss-py utils fast | |
scanoss-py scan tests > results.json | |
id_count=$(cat results.json | grep '"id":' | wc -l) | |
echo "ID Count: $id_count" | |
if [[ $id_count -lt 1 ]]; then | |
echo "Error: Scan test did not produce any results. Failing" | |
exit 1 | |
fi | |
- name: Run Tests (fast winnowing) | |
run: | | |
pip install scanoss_winnowing | |
which scanoss-py | |
scanoss-py version | |
scanoss-py utils fast | |
scanoss-py scan tests > results.json | |
id_count=$(cat results.json | grep '"id":' | wc -l) | |
echo "ID Count: $id_count" | |
if [[ $id_count -lt 1 ]]; then | |
echo "Error: Scan test did not produce any results. Failing" | |
exit 1 | |
fi |