Skip to content

try again

try again #83

Workflow file for this run

name: CMake Build
on:
push:
branches: [newVersion]
pull_request:
branches: [newVersion]
jobs:
build:
runs-on: ${{ matrix.os }}
timeout-minutes: 480
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
# os: [ubuntu-latest, windows-latest, macos-latest]
include:
- os: ubuntu-latest
suffix: so
- os: macos-latest
suffix: dylib
# - os: windows-latest
# suffix: pyd
steps:
- uses: actions/checkout@v2
- name: Install dependencies
shell: bash
run: |
if [[ "${{ runner.os }}" == "Linux" ]]; then
sudo apt-get update
sudo apt install curl
sudo apt install libssl-dev
sudo apt-get install -y libcurl4-openssl-dev
elif [[ "${{ runner.os }}" == "macOS" ]]; then
brew install curl
else
choco install curl
choco install openssl
fi
- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: "3.11"
# - name: Create Build Environment
# run: cmake -E make_directory ${{runner.workspace}}/build
# - name: Configure CMake
# shell: bash
# run: cmake $GITHUB_WORKSPACE -B ${{runner.workspace}}/build
# - name: Build
# working-directory: ${{runner.workspace}}/build
# shell: bash
# run: cmake --build . --config Release
# - name: Upload Artifact Shared
# uses: actions/upload-artifact@v2
# with:
# name: library-${{ matrix.os }}-${{ matrix.suffix }}
# path: ${{runner.workspace}}/build/libtoken_granter_shared.${{ matrix.suffix }}
# - name: Upload Artifact Pybindings
# uses: actions/upload-artifact@v2
# with:
# name: library-${{ matrix.os }}-${{ matrix.suffix }}
# path: ${{runner.workspace}}/TokenGranterWrapper/token_granter_wrapper/token_granter.*.so
- name: Install Packages
run: python -m pip install cibuildwheel twine build pytest
# - name: Clean project directory
# run: find . -path ./include -prune -o -type f \( -name "*.so" -o -name "*.c" -o -name "*.o" \) -exec rm -f {} \;
- name: Build wheels
shell: bash
run: |
if [[ "${{ runner.os }}" == "macOS" ]]; then
echo "brew install curl" > prebuild.sh
elif [[ "${{ runner.os }}" == "Windows" ]]; then
echo "choco install curl" > prebuild.sh
# elif grep -q 'centos' /etc/os-release || grep -q 'rhel' /etc/os-release || grep -q 'fedora' /etc/os-release; then
# echo "cat /etc/os-release && yum install -y curl libcurl-devel" > prebuild.sh
# elif grep -q 'ID=debian' /etc/os-release || grep -q 'ID_LIKE=debian' /etc/os-release; then
# cat /etc/os-release
# echo "yum install -y curl libcurl-devel || apk add curl curl-dev || apt-get install -y curl libcurl4-openssl-dev" > prebuild.sh
else
cat /etc/os-release
echo "yum install -y curl libcurl-devel || apk add curl curl-dev || apt-get install -y curl libcurl4-openssl-dev" > prebuild.sh
fi
chmod +x prebuild.sh
ls -l prebuild.sh # Check that prebuild.sh exists and is executable
cat prebuild.sh # Check the contents of prebuild.sh
platform=$(echo ${{ runner.os }} | tr '[:upper:]' '[:lower:]')
python -m cibuildwheel --platform $platform --output-dir wheelhouse
env:
CIBW_BEFORE_BUILD: "./prebuild.sh"
CIBW_SKIP: "cp38-* cp39-* cp310-* cp311=* cp312=*"
CIBW_BUILD: cp311*
# CIBW_BEFORE_TEST: "pip install wheelhouse/*.whl "
# CIBW_TEST_COMMAND: "pytest {project}/tests/"
- name: List wheelhouse contents
run: |
ls
echo "TK GRANTER STARTS HERE"
ls token_granter_wrapper
echo "WHEELHOUSE STARTS HERE"
ls wheelhouse
- name: Test pacakge
run: pip install wheelhouse/*.whl && pytest tests/
- name: Publish to PyPI
run: python -m twine upload --repository-url https://pypi.ghaz.dev:440 wheelhouse/*.whl --verbose
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}