Repository navigation
Cleanup #102
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: Thermite FFI Build | |
| on: | |
| push: | |
| branches: ["rewrite"] | |
| jobs: | |
| build-artifacts: | |
| if: contains(github.event.head_commit.message, '[build ffi]') | |
| name: Build on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| artifact_name: libthermite.so | |
| archive_name: thermite-linux-x86_64.tar.gz | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| artifact_name: thermite.dll | |
| archive_name: thermite-windows-x86_64.zip | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Setup Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Install cbindgen | |
| run: cargo install cbindgen | |
| - name: Generate C Header | |
| run: cbindgen -q --config crates/thermite-ffi/cbindgen.toml --crate thermite-ffi --output thermite.h | |
| - name: Build the shared library | |
| run: cargo build --profile release-ffi -p thermite-ffi --target ${{ matrix.target }} | |
| - name: Package artifacts | |
| shell: bash | |
| run: | | |
| mkdir -p staging | |
| cp target/${{ matrix.target }}/release-ffi/${{ matrix.artifact_name }} staging/ | |
| cp thermite.h staging/ | |
| cd staging | |
| if [[ "${{ matrix.os }}" == "windows-latest" ]]; then | |
| cp ../target/${{ matrix.target }}/release-ffi/thermite.dll.lib ./ | |
| ../crates/thermite-ffi/tools/mpress.exe -s thermite.dll | |
| 7z a ../${{ matrix.archive_name }} * | |
| else | |
| tar -czf ../${{ matrix.archive_name }} * | |
| fi | |
| - name: Upload Artifact to Workflow Run | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| # The name must be unique for each matrix job so they don't overwrite each other | |
| name: thermite-${{ matrix.os }} | |
| path: ${{ matrix.archive_name }} |