Skip to content

added remove_selfloop_edges #122

added remove_selfloop_edges

added remove_selfloop_edges #122

Workflow file for this run

name: package builds
on:
push:
branches: [master]
pull_request:
branches: [master]
types: [opened, reopened, synchronize]
env:
PYTHON_VERSION: "3.12"
jobs:
# if on pull req. add a timestamp to the version (treat it as a test release)
Determine-Build-Type:
runs-on: ubuntu-latest
env:
BASE_VER: Nil
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Obtain the base version
run: |
_BV=$(sh .github/get_version.sh)
echo "BASE_VER=${_BV}" >> $GITHUB_ENV
- name: Determine the final version
id: make_final_version
run: |
if [ ${{ github.event_name }} == 'pull_request' ]; then
export VER_SUFFIX="rc$(date +'%Y%m%d%H%M%S')"
else
export VER_SUFFIX=""
fi
echo "val=${{ env.BASE_VER }}${VER_SUFFIX}" >> $GITHUB_OUTPUT
outputs:
package_ver: ${{ steps.make_final_version.outputs.val }}
# build wheel and prepare tarball with sources. since sources are OS-agnostic
# it's ok to owerwrite sdists prepared by each of OS
Build-Multiplatform-Package:
runs-on: ${{ matrix.os }}
needs: [Determine-Build-Type]
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r env/pip_prod.txt
pip install -r env/pip_dev.txt
- name: Update the codebase by a build version
run: |
sh .github/update_version.sh "${{ needs.Determine-Build-Type.outputs.package_ver }}"
echo $(sh .github/get_version.sh)
- name: Build a Wheel Package
run: python -m build --wheel --sdist .
- name: Check if the package can be uploaded to PyPI
run: python -m twine check dist/*
- name: Save the artifacts
uses: actions/[email protected]
with:
name: dist_temp
path: ./dist
# previous job used Ubuntu OS, but PyPI requires ManyLinux distro, hence we
# need to convert it properly
Convert-Ubuntu-To-Manylinux:
runs-on: ubuntu-latest
needs: [Build-Multiplatform-Package]
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip auditwheel
- name: Download artifacts
uses: actions/[email protected]
with:
name: dist_temp
path: ./dist
- name: Convert Ubuntu to ManyLinux
run: |
auditwheel show dist/network_diffusion-*-linux_x86_64.whl
auditwheel repair --wheel-dir dist dist/network_diffusion-*-linux_x86_64.whl
- name: Remove Ubuntu based build
run: rm dist/network_diffusion-*-linux_x86_64.whl
- name: Save artifacts
uses: actions/[email protected]
with:
name: dist_final
path: ./dist
# download builds and send them to Python Package Index
Publish-Package:
runs-on: ubuntu-latest
needs: [Convert-Ubuntu-To-Manylinux]
steps:
- name: Download artifacts
uses: actions/[email protected]
with:
name: dist_final
path: ./dist
- name: Publishing to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
# create a GitHub release and tag current commit
Create-Tag-Release:
runs-on: ubuntu-latest
needs: [Determine-Build-Type, Convert-Ubuntu-To-Manylinux]
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Add tag
uses: rickstaa/action-create-tag@v1
with:
tag: ${{ needs.Determine-Build-Type.outputs.package_ver }}
message: "Added tag"
- name: Download artifacts
uses: actions/[email protected]
with:
name: dist_final
path: ./dist
- name: Add GitHub release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.Determine-Build-Type.outputs.package_ver }}
files: |
dist/*.whl
dist/*.tar.gz