Skip to content

chore: try to fix issue with dagger and host platform #575

chore: try to fix issue with dagger and host platform

chore: try to fix issue with dagger and host platform #575

name: Package FFI Engine
on:
pull_request:
branches:
- main
push:
tags: ["flipt-engine-ffi-v**"]
workflow_dispatch:
inputs:
tag:
description: "Tag (e.g. v0.1.0)"
required: true
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
platform:
- name: Linux-x86_64
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
use_cross: false
- name: Linux-arm64
os: ubuntu-latest
target: aarch64-unknown-linux-gnu
use_cross: true
- name: Linux-x86_64-musl
os: ubuntu-latest
target: x86_64-unknown-linux-musl
use_cross: true
- name: Linux-arm64-musl
os: ubuntu-latest
target: aarch64-unknown-linux-musl
use_cross: true
- name: Darwin-arm64
os: macos-latest
target: aarch64-apple-darwin
use_cross: false
- name: Darwin-x86_64
os: macos-latest
target: x86_64-apple-darwin
use_cross: false
- name: Windows-x86_64
os: windows-latest
target: x86_64-pc-windows-msvc
use_cross: false
- name: iOS-arm64
os: macos-latest
target: aarch64-apple-ios
use_cross: false
- name: iOS-arm64-sim
os: macos-latest
target: aarch64-apple-ios-sim
use_cross: false
- name: Android-arm64
os: ubuntu-latest
target: aarch64-linux-android
use_cross: true
- name: Android-x86_64
os: ubuntu-latest
target: x86_64-linux-android
use_cross: true
runs-on: ${{ matrix.platform.os }}
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v4
- name: Install Rust ${{ matrix.platform.name }}
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.platform.target }}
override: true
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-${{ matrix.platform.target}}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Set RUSTFLAGS
if: endsWith(matrix.platform.target, '-musl') || endsWith(matrix.platform.target, '-android')
run: |
echo "RUSTFLAGS=-C target-feature=-crt-static" >> $GITHUB_ENV
- name: Install cross from GitHub
run: |
which cross || cargo install cross --git https://github.com/cross-rs/cross
- name: Build ${{ matrix.platform.name }}
uses: actions-rs/cargo@v1
with:
command: build
args: -p flipt-engine-ffi --target ${{ matrix.platform.target }} --release
use-cross: ${{ matrix.platform.use_cross }}
- if: startsWith(matrix.platform.name, 'Darwin')
run: |
strip -x target/${{ matrix.platform.target }}/release/libfliptengine.dylib
- if: startsWith(matrix.platform.name, 'Linux-x86_64')
run: |
strip -x target/${{ matrix.platform.target }}/release/libfliptengine.so
- if: ${{ !startsWith(matrix.platform.name, 'Windows') }}
run: |
tar -czvf flipt-engine-ffi-${{ matrix.platform.name }}.tar.gz \
target/${{ matrix.platform.target }}/release/libfliptengine.* \
|| true
- if: startsWith(matrix.platform.name, 'Windows')
run: |
7z a -tzip flipt-engine-ffi-${{ matrix.platform.name }}.zip `
target\${{ matrix.platform.target }}\release\fliptengine.* `
|| true
- name: Upload Artifact (Pull Request)
uses: actions/upload-artifact@v4
if: github.event_name == 'pull_request'
with:
name: flipt-engine-ffi-${{ matrix.platform.name }}${{ startsWith(matrix.platform.name, 'Windows') && '.zip' || '.tar.gz' }}
path: flipt-engine-ffi-${{ matrix.platform.name }}${{ startsWith(matrix.platform.name, 'Windows') && '.zip' || '.tar.gz' }}
retention-days: 1
- name: Upload Release Assets (Tag)
uses: softprops/action-gh-release@v2
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/flipt-engine-ffi-v')
with:
tag_name: ${{ github.ref_name }}
files: |
flipt-engine-ffi-${{ matrix.platform.name }}${{ startsWith(matrix.platform.name, 'Windows') && '.zip' || '.tar.gz' }}
- name: Upload Release Assets (Workflow Dispatch)
uses: softprops/action-gh-release@v2
if: github.event_name == 'workflow_dispatch' && !endswith(github.event.inputs.tag, 'pre')
with:
tag_name: flipt-engine-ffi-${{ github.event.inputs.tag }}
files: |
flipt-engine-ffi-${{ matrix.platform.name }}${{ startsWith(matrix.platform.name, 'Windows') && '.zip' || '.tar.gz' }}
notify:
runs-on: ubuntu-latest
needs: build
if: github.repository == 'flipt-io/flipt-client-sdks'
steps:
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.FLIPT_RELEASE_BOT_APP_ID }}
private_key: ${{ secrets.FLIPT_RELEASE_BOT_APP_PEM }}
installation_id: ${{ secrets.FLIPT_RELEASE_BOT_INSTALLATION_ID }}
- name: Trigger Test Android SDK
run: |
curl -X POST -H "Authorization: Bearer ${{ steps.generate_token.outputs.token }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/flipt-io/flipt-client-sdks/actions/workflows/test-android-sdk.yml/dispatches \
-d '{"ref":"${{ github.head_ref }}", "inputs":{"caller_run_id":"${{ github.run_id }}"}}'