feat: implement custom memory management hooks and example usage #5
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: CD | |
| on: | |
| push: | |
| branches: [ main ] | |
| tags: [ 'v*' ] | |
| release: | |
| types: [ published ] | |
| jobs: | |
| doxygen-docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Doxygen | |
| run: sudo apt-get update && sudo apt-get install -y doxygen graphviz | |
| - name: Generate Documentation | |
| run: doxygen Doxyfile | |
| - name: Upload Documentation Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: documentation | |
| path: docs/html/ | |
| retention-days: 30 | |
| - name: Deploy to GitHub Pages | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./docs/html | |
| force_orphan: true | |
| build-artifacts: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| build_type: [Release, Debug] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: sudo apt-get update && sudo apt-get install -y cmake gcc | |
| - name: Get architecture info | |
| id: arch | |
| run: | | |
| echo "arch=$(uname -m)" >> $GITHUB_OUTPUT | |
| echo "platform=linux" >> $GITHUB_OUTPUT | |
| - name: Configure CMake | |
| run: cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
| - name: Build | |
| run: cmake --build build | |
| - name: Package artifacts | |
| run: | | |
| mkdir -p dist/${{ matrix.build_type }} | |
| cp -r output/* dist/${{ matrix.build_type }}/ | |
| cp src/mjsonrpc.h dist/${{ matrix.build_type }}/ | |
| cp build/src/libmjsonrpc.a dist/${{ matrix.build_type }}/ || true | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: mjsonrpc-${{ matrix.build_type }}-${{ steps.arch.outputs.platform }}-${{ steps.arch.outputs.arch }} | |
| path: dist/${{ matrix.build_type }}/ | |
| retention-days: 7 | |
| create-release: | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: [doxygen-docs, build-artifacts] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts/ | |
| - name: Create release packages | |
| run: | | |
| mkdir -p release | |
| cd artifacts | |
| for dir in mjsonrpc-*-linux-*; do | |
| tar -czf ../release/${dir}.tar.gz ${dir}/ | |
| done | |
| cd .. | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: release/* | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |