some broken shit #440
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
# THIS FILE CONTAINS THE PIP PACKAGING PROCESS FOR PUBLISHING | |
# TO PyPI AND BUILDING FOR A PLETHORA OF PLATFORMS. THIS FILE | |
# SERVERS AS THE MAIN ENTRY POINT FOR THE openGPMP WORKFLOW | |
name: CI/CD | |
on: | |
push: | |
branches: | |
- '**' | |
pull_request: | |
branches: | |
- '**' | |
create: | |
types: [ tag ] | |
branches: [ main ] | |
jobs: | |
src_changes: | |
name: Check changes to src | |
runs-on: 'ubuntu-20.04' | |
# Declare outputs for next jobs | |
outputs: | |
src_changed: ${{ steps.check_file_changed.outputs.src_changed }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
# Checkout as many commits as needed for the diff | |
fetch-depth: 2 | |
- shell: pwsh # the example this is adopted from makes use of PowerShell | |
id: check_file_changed | |
run: | | |
# diff HEAD W/ previous commit | |
$diff = git diff --name-only HEAD^ HEAD | |
# check if specific folder with file extentions has changes | |
$SourceDiff = $diff | Where-Object { $_ -match '^modules/' -or $_ -match '^include/' } | |
$HasDiff = $SourceDiff.Length -gt 0 | |
Write-Host "::set-output name=src_changed::$HasDiff" | |
test_changes: | |
name: Check Changes to tests | |
runs-on: 'ubuntu-20.04' | |
# Declare outputs for next jobs | |
outputs: | |
tests_changed: ${{ steps.check_file_changed.outputs.tests_changed }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
# Checkout as many commits as needed for the diff | |
fetch-depth: 2 | |
- shell: pwsh # the example this is adopted from makes use of PowerShell | |
id: check_file_changed | |
run: | | |
# diff HEAD W/ previous commit | |
$diff = git diff --name-only HEAD^ HEAD | |
# check if specific folder with file extentions has changes | |
$SourceDiff = $diff | Where-Object { $_ -match '^tests/' } | |
$HasDiff = $SourceDiff.Length -gt 0 | |
Write-Host "::set-output name=tests_changed::$HasDiff" | |
tests_codecov: | |
#needs: [ test_changes ] | |
#if: needs.test_changes.outputs.tests_changed == 'True' | |
uses: ./.github/workflows/codecov.yml | |
documentation: | |
needs: [tests_codecov] | |
uses: ./.github/workflows/doxygen.yml | |
cpp: | |
needs: [ src_changes ] | |
if: needs.src_changes.outputs.src_changed == 'True' | |
uses: ./.github/workflows/build_nix.yml | |
cpp_osx: | |
needs: [ src_changes ] | |
if: needs.src_changes.outputs.src_changed == 'True' | |
uses: ./.github/workflows/build_osx.yml | |
CUDA: | |
needs: [ src_changes ] | |
if: needs.src_changes.outputs.src_changed == 'True' | |
uses: ./.github/workflows/CUDA.yml | |
python: | |
needs: [ cpp ] | |
uses: ./.github/workflows/test_wheels.yml | |
latest_version: | |
needs: [ python ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: oprypin/find-latest-tag@v1 | |
with: | |
repository: akielaries/openGPMP | |
id: gpmp_version | |
- run: echo ${{ steps.gpmp_version.outputs.tag }} | |
bump_version: | |
needs: [ latest_version ] | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Bump version and push tag | |
#if: github.ref == 'refs/heads/main' | |
uses: anothrNick/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
WITH_V: true | |
VERBOSE: true | |
DEFAULT_BRANCH: main | |
RELEASE_BRANCHES: main | |
MAJOR_STRING_TOKEN: MAJOR | |
MINOR_STRING_TOKEN: MINOR | |
PATCH_STRING_TOKEN: PATCH | |
DEFAULT_BUMP: none | |
BRANCH_HISTORY: last | |
id: new_version | |
- run: echo ${{ steps.new_version.outputs.new_tag }} | |
build_plat: | |
name: Build source distribution | |
needs: [ bump_version , latest_version ] | |
if: contains(github.event.head_commit.message, '#PATCH:') || contains(github.event.head_commit.message, '#MINOR:') || contains(github.event.head_commit.message, '#MAJOR:') | |
#if: ${{ needs.bump_version.new_version.outputs.new_tag }} != ${{ needs.latest_version.gpmp_version.outputs.tag }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # required for versioneer to find tags | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.x" | |
- name: Build sdist | |
run: | | |
pip install versioneer | |
#pip install autopep8 | |
#python setup.py build_ext --inplace | |
pipx run build --sdist | |
#autopep8 --recursive --in-place --aggressive --aggressive . | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: dist/*.tar.gz | |
compile_wheels: | |
name: Build Wheels on ${{ matrix.os }} | |
needs: [ build_plat ] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, macos-latest ] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # required for versioneer to find tags | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.x" | |
- name: Set up QEMU | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: all | |
- name: Install Versioneer | |
run: | | |
pip install versioneer | |
git status | |
#git clean -xdfq | |
#git status | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_ENVIRONMENT: "CC='g++' CXX='g++' CFLAGS='-std=c++2a' CXXFLAGS='-std=c++2a'" | |
CIBW_ARCHS_MACOS: x86_64 arm64 | |
CIBW_ARCHS_LINUX: auto aarch64 ppc64le s390x | |
CIBW_BEFORE_BUILD: "git status" | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl | |
publish: | |
name: Publish to PYPI | |
needs: [ compile_wheels, build_plat ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
# unpacks default artifact into dist/ | |
# if `name: artifact` is omitted, the action will create extra parent dir | |
name: artifact | |
path: dist | |
- uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
# the build installation is supported by x86 based OSX | |
# versions and LINUX distros by the CIBUILDWHEEL utilities. | |
# test pip install pygpmp on the following platforms | |
pip_test: | |
needs: publish | |
uses: ./.github/workflows/test_pip.yml | |