# GitHub Actions workflow # to build `deltachat-rpc-server` binaries # and upload them to the release. # # The workflow is automatically triggered on releases. # It can also be triggered manually # to produce binary artifacts for testing. name: Build deltachat-rpc-server binaries concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true on: workflow_dispatch: release: types: [published] jobs: # Build a version statically linked against musl libc # to avoid problems with glibc version incompatibility. build_linux: name: Build deltachat-rpc-server for Linux strategy: fail-fast: false matrix: arch: [aarch64, armv7l, armv6l, i686, x86_64] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: show-progress: false - uses: DeterminateSystems/nix-installer-action@main - uses: DeterminateSystems/magic-nix-cache-action@main - name: Build deltachat-rpc-server binaries run: nix build .#deltachat-rpc-server-${{ matrix.arch }}-linux - name: Upload binary uses: actions/upload-artifact@v4 with: name: deltachat-rpc-server-${{ matrix.arch }}-linux path: result/bin/deltachat-rpc-server if-no-files-found: error build_windows: name: Build deltachat-rpc-server for Windows strategy: fail-fast: false matrix: arch: [win32, win64] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: show-progress: false - uses: DeterminateSystems/nix-installer-action@main - uses: DeterminateSystems/magic-nix-cache-action@main - name: Build deltachat-rpc-server binaries run: nix build .#deltachat-rpc-server-${{ matrix.arch }} - name: Upload binary uses: actions/upload-artifact@v4 with: name: deltachat-rpc-server-${{ matrix.arch }} path: result/bin/deltachat-rpc-server.exe if-no-files-found: error build_macos: name: Build deltachat-rpc-server for macOS strategy: fail-fast: false matrix: arch: [x86_64, aarch64] runs-on: macos-latest steps: - uses: actions/checkout@v4 with: show-progress: false - name: Setup rust target run: rustup target add ${{ matrix.arch }}-apple-darwin - name: Build run: cargo build --release --package deltachat-rpc-server --target ${{ matrix.arch }}-apple-darwin --features vendored - name: Upload binary uses: actions/upload-artifact@v4 with: name: deltachat-rpc-server-${{ matrix.arch }}-macos path: target/${{ matrix.arch }}-apple-darwin/release/deltachat-rpc-server if-no-files-found: error publish: name: Build wheels and upload binaries to the release needs: ["build_linux", "build_macos"] permissions: contents: write runs-on: "ubuntu-latest" steps: - uses: actions/checkout@v4 with: show-progress: false - name: Download Linux aarch64 binary uses: actions/download-artifact@v4 with: name: deltachat-rpc-server-aarch64-linux path: deltachat-rpc-server-aarch64-linux.d - name: Download Linux armv7l binary uses: actions/download-artifact@v4 with: name: deltachat-rpc-server-armv7l-linux path: deltachat-rpc-server-armv7l-linux.d - name: Download Linux armv6l binary uses: actions/download-artifact@v4 with: name: deltachat-rpc-server-armv6l-linux path: deltachat-rpc-server-armv6l-linux.d - name: Download Linux i686 binary uses: actions/download-artifact@v4 with: name: deltachat-rpc-server-i686-linux path: deltachat-rpc-server-i686-linux.d - name: Download Linux x86_64 binary uses: actions/download-artifact@v4 with: name: deltachat-rpc-server-x86_64-linux path: deltachat-rpc-server-x86_64-linux.d - name: Download Win32 binary uses: actions/download-artifact@v4 with: name: deltachat-rpc-server-win32 path: deltachat-rpc-server-win32.d - name: Download Win64 binary uses: actions/download-artifact@v4 with: name: deltachat-rpc-server-win64 path: deltachat-rpc-server-win64.d - name: Download macOS binary for x86_64 uses: actions/download-artifact@v4 with: name: deltachat-rpc-server-x86_64-macos path: deltachat-rpc-server-x86_64-macos.d - name: Download macOS binary for aarch64 uses: actions/download-artifact@v4 with: name: deltachat-rpc-server-aarch64-macos path: deltachat-rpc-server-aarch64-macos.d - name: Flatten dist/ directory run: | mkdir -p dist mv deltachat-rpc-server-aarch64-linux.d/deltachat-rpc-server dist/deltachat-rpc-server-aarch64-linux mv deltachat-rpc-server-armv7l-linux.d/deltachat-rpc-server dist/deltachat-rpc-server-armv7l-linux mv deltachat-rpc-server-armv6l-linux.d/deltachat-rpc-server dist/deltachat-rpc-server-armv6l-linux mv deltachat-rpc-server-i686-linux.d/deltachat-rpc-server dist/deltachat-rpc-server-i686-linux mv deltachat-rpc-server-x86_64-linux.d/deltachat-rpc-server dist/deltachat-rpc-server-x86_64-linux mv deltachat-rpc-server-win32.d/deltachat-rpc-server.exe dist/deltachat-rpc-server-win32.exe mv deltachat-rpc-server-win64.d/deltachat-rpc-server.exe dist/deltachat-rpc-server-win64.exe mv deltachat-rpc-server-x86_64-macos.d/deltachat-rpc-server dist/deltachat-rpc-server-x86_64-macos mv deltachat-rpc-server-aarch64-macos.d/deltachat-rpc-server dist/deltachat-rpc-server-aarch64-macos # Python 3.11 is needed for tomllib used in scripts/wheel-rpc-server.py - name: Install python 3.12 uses: actions/setup-python@v4 with: python-version: 3.12 - name: Install wheel run: pip install wheel - name: Build deltachat-rpc-server Python wheels and source package run: scripts/wheel-rpc-server.py - name: List downloaded artifacts run: ls -l dist/ - name: Upload binaries to the GitHub release if: github.event_name == 'release' env: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" run: | gh release upload ${{ github.ref_name }} \ --repo ${{ github.repository }} \ dist/*