feat: finish thing for demo #43
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
name: CI | |
on: | |
push: | |
branches: [main] | |
paths-ignore: | |
- 'README.md' | |
pull_request: | |
branches: [main] | |
paths-ignore: | |
- 'README.md' | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y cmake make g++ build-essential libboost-all-dev | |
- name: Configure CMake | |
run: cmake -S . -B build -DBUILD_BINDINGS=OFF | |
- name: Build | |
run: cmake --build build | |
- name: Run tests | |
run: | | |
cd build | |
ctest -V | |
release: | |
needs: test | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y cmake make g++ build-essential python3 python3-pip | |
- name: Install Python dependencies | |
run: pip3 install setuptools wheel twine scikit-build pybind11 | |
- name: Bump version | |
id: bump_version | |
run: | | |
./bump_version.sh | |
- name: Commit and tag version | |
run: | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git | |
git add setup.py | |
git commit -m "Bump version to ${{ steps.bump_version.outputs.new_version }}" | |
git tag "v${{ steps.bump_version.outputs.new_version }}" | |
git push origin main --tags | |
- name: Build Python package | |
run: python3 setup.py sdist | |
- name: Create GitHub release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: 'dist/*' | |
token: ${{ secrets.PAT }} | |
tag: ${{ steps.bump_version.outputs.new_version }} | |
name: ${{ steps.bump_version.outputs.version }} | |
body: "Release generated by GitHub Actions" | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
pypi-publish: | |
needs: release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.x' | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools twine | |
- name: Publish package | |
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
package: dist/*.tar.gz |