-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (117 loc) · 4.01 KB
/
release.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
name: Build and Relaese
on:
push:
workflow_dispatch:
inputs:
fail-fast:
description: 'Terminate all jobs if one fails'
required: true
default: true
type: boolean
run-cross:
description: 'Run cross-compile on Linux'
required: true
default: true
type: boolean
run-apple:
description: 'Run job on macOS'
required: true
default: true
type: boolean
publish-release:
description: 'Publish a release'
required: true
default: false
type: boolean
jobs:
cross-compile:
if: ${{ inputs.run-cross }}
permissions:
contents: write
runs-on: ubuntu-latest
strategy:
fail-fast: ${{ inputs.fail-fast }}
matrix:
target:
- aarch64-linux-android
- aarch64-unknown-linux-gnu
- aarch64-unknown-linux-musl
- armv7-unknown-linux-musleabihf
- i686-pc-windows-gnu
- i686-unknown-linux-gnu
# - mips64-unknown-linux-muslabi64
# - mips64el-unknown-linux-muslabi64
# - powerpc64-unknown-linux-gnu
# - powerpc64le-unknown-linux-gnu
# - riscv64gc-unknown-linux-gnu
- x86_64-pc-windows-gnu
- x86_64-unknown-freebsd
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
steps:
- uses: actions/checkout@v4
- name: Cache cargo & target directories
uses: Swatinem/rust-cache@v2
with:
key: "v2"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: build
run: cross build --release --target ${{ matrix.target }}
# - run: ls target/${{ matrix.target }}/release
- name: Rename artifact
run: >
cp
${{ format('target/{0}/release/solver-multi{1}', matrix.target, contains(matrix.target, 'windows') && '.exe' || '') }}
${{ format('solver-multi_{0}{1}', matrix.target, contains(matrix.target, 'windows') && '.exe' || '') }}
- name: Publish GitHub release
uses: softprops/action-gh-release@v2
with:
draft: true
token: ${{ secrets.GITHUB_TOKEN }}
files: ${{ format('solver-multi_{0}{1}', matrix.target, contains(matrix.target, 'windows') && '.exe' || '') }}
if: startsWith( github.ref, 'refs/tags/v' ) || contains(github.event.head_commit.message, 'test release') || ${{ inputs.publish-release }}
build-for-mac:
if: ${{ inputs.run-apple }}
runs-on: macos-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache cargo & target directories
uses: Swatinem/rust-cache@v2
with:
key: "v2"
- name: Install latest rust toolchain
run: |
rustup update stable
rustup target install x86_64-apple-darwin
rustup target install aarch64-apple-darwin
- name: Build for mac
run: cargo build --release --target x86_64-apple-darwin
- name: Rename artifact (x86_64)
run: >
cp
target/x86_64-apple-darwin/release/solver-multi
solver-multi_x86_64-apple-darwin
- name: Cross-compile Apple Silicon
run: cargo build --release --target aarch64-apple-darwin
- name: Rename artifact (aarch64)
run: >
cp
target/aarch64-apple-darwin/release/solver-multi
solver-multi_aarch64-apple-darwin
- name: List directory
run: ls target
- name: Publish GitHub release
uses: softprops/action-gh-release@v2
with:
draft: true
token: ${{ secrets.GITHUB_TOKEN }}
files: |
solver-multi_x86_64-apple-darwin
solver-multi_aarch64-apple-darwin
if: startsWith( github.ref, 'refs/tags/v' ) || contains(github.event.head_commit.message, 'test release') || ${{ inputs.publish-release }}