-
Notifications
You must be signed in to change notification settings - Fork 47
131 lines (112 loc) · 4.13 KB
/
binaries.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
name: Build binaries
on:
workflow_call:
inputs:
ref:
description: "ref to build eg v0.5.1"
required: false
type: string
npmVersion:
description: "if provided, also push npm packages with this version"
default: ""
required: false
type: string
workflow_dispatch:
inputs:
ref:
description: "ref to build eg v0.5.1"
required: false
type: string
npmVersion:
description: "if provided, also push npm packages with this version"
default: ""
required: false
type: string
jobs:
build:
permissions:
contents: read
packages: read
runs-on: ${{ matrix.build.os }}
strategy:
matrix:
build:
# - target: aarch64-apple-darwin
# os: macos-latest
# - target: x86_64-apple-darwin
# os: macos-latest
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
env:
RUST_BACKTRACE: full
RUSTC_WRAPPER: "sccache"
SCCACHE_GHA_ENABLED: "true"
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- uses: ./.github/actions/clean-runner
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: "" # set to empty value to not overwrite rustflags from .cargo/config.toml
# necessary because the toolchain@v1 action would install this target for stable only, whereas this command respects rust-toolchain.toml
- name: Install x86_64-apple-darwin Rust toolchain
if: ${{ matrix.build.target == 'x86_64-apple-darwin' }}
run: rustup target add x86_64-apple-darwin
- name: Install aarch64-apple-darwin Rust toolchain
if: ${{ matrix.build.target == 'aarch64-apple-darwin' }}
run: rustup target add aarch64-apple-darwin
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.4
- name: Cache Rust
uses: Swatinem/rust-cache@v2
- name: Install cargo-license
run: cargo install cargo-license
- name: Install protoc
if: ${{ matrix.build.os == 'macos-latest' }} # installed in cross docker image in linux builds
uses: ./.github/actions/install-protoc
- name: Setup just
uses: extractions/setup-just@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate notice
run: just notice-file
- name: Compile Mac binaries
if: ${{ matrix.build.os == 'macos-latest' }}
env:
MACOSX_DEPLOYMENT_TARGET: 10.14.0
run: cargo build --release --bins --target ${{ matrix.build.target }}
- name: Compile Linux binaries
if: ${{ matrix.build.os == 'ubuntu-latest' }}
uses: addnab/docker-run-action@v3
with:
image: ghcr.io/restatedev/dev-tools:1.3.0
options: -v ${{ github.workspace }}:/restate -w /restate -e ACTIONS_CACHE_URL -e ACTIONS_RUNTIME_TOKEN -e SCCACHE_GHA_ENABLED
run: |
cargo build --release --bins --target ${{ matrix.build.target }}
- name: Sign binaries
if: ${{ matrix.build.os == 'macos-latest' }}
run: |
codesign -s - target/${{ matrix.build.target }}/release/restate-server
codesign -s - target/${{ matrix.build.target }}/release/restate
- name: Move binary
run: cp target/${{ matrix.build.target }}/release/restate-server target/${{ matrix.build.target }}/release/restate .
- name: Create tar
run: tar -cvzf restate.${{ matrix.build.target }}.tar.gz LICENSE NOTICE restate-server restate
- uses: actions/upload-artifact@v4
with:
name: restate.${{ matrix.build.target }}.tar.gz
path: restate.${{ matrix.build.target }}.tar.gz
retention-days: 1
if-no-files-found: error
publish-npm:
name: Publish to NPM
if: ${{ inputs.npmVersion != '' }}
needs: [build]
uses: ./.github/workflows/npm.yml
secrets: inherit
with:
version: ${{ inputs.npmVersion }}