-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (114 loc) · 5.09 KB
/
release.yml
File metadata and controls
139 lines (114 loc) · 5.09 KB
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
name: CI
on:
push:
branches:
- main
release:
types: [released]
pull_request:
branches:
- main
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
build:
name: Build and Release
permissions:
contents: write
env:
APP_NAME: http_trace
strategy:
matrix:
target:
# Windows
- { displayName: 32-bit Windows,
rustTarget: i686-pc-windows-gnu,
testTarget: win-x86,
runner: 'ubuntu-latest' }
- { displayName: 64-bit Windows,
rustTarget: x86_64-pc-windows-gnu,
testTarget: win-x64,
runner: 'ubuntu-latest' }
# Linux
- { displayName: 32-bit Linux,
rustTarget: i686-unknown-linux-gnu,
testTarget: '',
runner: 'ubuntu-latest' }
- { displayName: 64-bit Linux,
rustTarget: x86_64-unknown-linux-gnu,
testTarget: linux-x64,
runner: 'ubuntu-latest' }
- { displayName: ARM32 ARMv6 Linux,
rustTarget: arm-unknown-linux-gnueabi,
testTarget: linux-arm,
runner: 'ubuntu-latest' }
- { displayName: ARM32 ARMv7 Linux,
rustTarget: armv7-unknown-linux-gnueabihf,
testTarget: linux-arm,
runner: 'ubuntu-latest' }
- { displayName: ARM64 Linux,
rustTarget: aarch64-unknown-linux-gnu,
testTarget: linux-arm64,
runner: 'ubuntu-latest' }
# macOS
- { displayName: 64-bit macOS,
rustTarget: x86_64-apple-darwin,
testTarget: osx-x64,
runner: 'macos-latest' }
runs-on: ${{ matrix.target.runner }}
steps:
# Get the machine ready to build
- name: Checkout Code
uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Update apt-get package list
if: ${{ contains(matrix.target.runner, 'ubuntu') }}
run: sudo apt-get update
- name: Add Rust Target
run: rustup target add ${{ matrix.target.rustTarget }}
- name: Update Sources
if: ${{ contains(matrix.target.rustTarget, 'linux') }}
run: sudo apt update
- name: Add Windows Build Dependencies
if: ${{ contains(matrix.target.rustTarget, 'pc-windows') }}
run: sudo apt install -y gcc-mingw-w64
- name: Add ARM32 Build Dependencies
if: ${{ contains(matrix.target.rustTarget, 'arm') }}
run: sudo apt install -y gcc-arm-linux-gnueabihf gcc-arm-linux-gnueabi gcc-arm-none-eabi binutils-arm-linux-gnueabi
- name: Add ARM64 Build Dependencies
if: ${{ contains(matrix.target.rustTarget, 'aarch64') }}
run: sudo apt install -y gcc-aarch64-linux-gnu crossbuild-essential-arm64
- name: Add 32-bit Linux Build Dependencies
if: ${{ contains(matrix.target.rustTarget, 'i686-unknown-linux-gnu') }}
run: sudo apt install -y gcc-multilib
# Build time
- name: Build
run: cargo build --release --target ${{ matrix.target.rustTarget }}
- name: Upload Asset
uses: actions/upload-artifact@v7
with:
name: ${{ env.APP_NAME }}-${{ matrix.target.rustTarget }}${{ endsWith(matrix.target.rustTarget, '-windows-gnu') && '.exe' || '' }}
path: ./target/${{ matrix.target.rustTarget }}/release/${{ env.APP_NAME }}${{ endsWith(matrix.target.rustTarget, '-windows-gnu') && '.exe' || '' }}
- name: Upload Release Asset
if: github.event_name == 'release'
id: upload-release-asset
env:
GH_TOKEN: ${{ github.token }}
run: |
cp ./target/${{ matrix.target.rustTarget }}/release/${{ env.APP_NAME }}${{ endsWith(matrix.target.rustTarget, '-windows-gnu') && '.exe' || '' }} ./${{ env.APP_NAME }}-${{ github.ref_name }}-${{ matrix.target.rustTarget }}${{ endsWith(matrix.target.rustTarget, '-windows-gnu') && '.exe' || '' }} &&
gh release upload ${{ github.event.release.tag_name }} ./${{ env.APP_NAME }}-${{ github.ref_name }}-${{ matrix.target.rustTarget }}${{ endsWith(matrix.target.rustTarget, '-windows-gnu') && '.exe' || '' }}#"${{ env.APP_NAME }}-${{ github.ref_name }}-${{ matrix.target.rustTarget }}${{ endsWith(matrix.target.rustTarget, '-windows-gnu') && '.exe' || '' }} (${{ matrix.target.displayName }})"
- name: Setup .NET SDK
uses: actions/setup-dotnet@v5
- name: Restore HTTP Trace Server
if: ${{ matrix.target.testTarget != '' }}
run: dotnet restore ./test/http_trace_server.csproj
- name: Build HTTP Trace Server
if: ${{ matrix.target.testTarget != '' }}
run: dotnet publish ./test/http_trace_server.csproj -c Release -r ${{ matrix.target.testTarget }} --self-contained -o ./publish/${{ matrix.target.testTarget }}
- name: Upload Test Artifact
if: ${{ matrix.target.testTarget != '' }}
uses: actions/upload-artifact@v7
with:
name: http_trace_server-${{ matrix.target.testTarget }}-${{ matrix.target.rustTarget }}
path: ./publish/${{ matrix.target.testTarget }}