-
Notifications
You must be signed in to change notification settings - Fork 389
87 lines (82 loc) · 2.93 KB
/
agent-release-artifacts.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
name: Agent Release Artifacts
on:
release:
types: [published]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency:
group: agent-release-artifacts-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
tag_date: ${{ steps.taggen.outputs.TAG_DATE }}
tag_sha: ${{ steps.taggen.outputs.TAG_SHA }}
steps:
- name: generate tag data
id: taggen
run: |
echo "TAG_DATE=$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_OUTPUT
echo "TAG_SHA=$(echo '${{ github.sha }}' | cut -b 1-7)" >> $GITHUB_OUTPUT
build:
needs: prepare
strategy:
fail-fast: false
matrix:
include:
- TARGET: x86_64-unknown-linux-gnu
OS: larger-runner
- TARGET: x86_64-apple-darwin
OS: macos-latest
- TARGET: aarch64-apple-darwin
OS: macos-latest
- TARGET: x86_64-pc-windows-msvc
OS: windows-latest
runs-on: ${{ matrix.OS }}
steps:
- name: checkout
uses: actions/checkout@v4
- name: ubuntu setup
if: ${{ matrix.OS == 'larger-runner' }}
run: |
sudo apt-get update -qq
sudo apt-get install -qq crossbuild-essential-arm64 crossbuild-essential-armhf
# some additional configuration for cross-compilation on linux
cat >>~/.cargo/config <<EOF
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
[target.aarch64-unknown-linux-musl]
linker = "aarch64-linux-gnu-gcc"
EOF
- name: setup rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
target: ${{ matrix.TARGET }}
- name: setup target
run: rustup target add ${{ matrix.TARGET }}
working-directory: ./rust
- name: build
run: cargo build --release --target ${{ matrix.TARGET }} --bin relayer --bin scraper --bin validator
working-directory: ./rust
- name: make executable
if: ${{ matrix.OS == 'larger-runner' || matrix.OS == 'macos-latest' }}
run: chmod ug+x,-w relayer scraper validator
working-directory: rust/target/${{ matrix.TARGET }}/release
- name: upload binaries
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.TARGET }}-${{ needs.prepare.outputs.tag_sha }}-${{ needs.prepare.outputs.tag_date }}
path: |
rust/target/${{ matrix.TARGET }}/release/relayer
rust/target/${{ matrix.TARGET }}/release/relayer.exe
rust/target/${{ matrix.TARGET }}/release/scraper
rust/target/${{ matrix.TARGET }}/release/scraper.exe
rust/target/${{ matrix.TARGET }}/release/validator
rust/target/${{ matrix.TARGET }}/release/validator.exe
if-no-files-found: error