-
Notifications
You must be signed in to change notification settings - Fork 7
159 lines (133 loc) · 5.01 KB
/
package-ffi-engine.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
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')
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 To Pull Request (Pull Request)
uses: actions/upload-artifact@v4
if: github.event_name == 'pull_request' && startsWith(github.head_ref, 'package/')
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' }}
- 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' }}