-
Notifications
You must be signed in to change notification settings - Fork 3
137 lines (118 loc) · 4.82 KB
/
build.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
name: Build
on:
push:
branches: ['main']
pull_request:
branches: ['main']
workflow_dispatch:
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
PROJECT_NAME: "ropgadget-rs"
REPO: hugsy/ropgadget-rs
VERBOSE: 1
RUST_BACKTRACE: 1
DEBUG_IN_CI: 0
jobs:
build:
strategy:
fail-fast: false
matrix:
job:
- { os: ubuntu-latest, target: arm-unknown-linux-gnueabihf , use-cross: true , name: "linux_armv7"}
- { os: ubuntu-latest, target: aarch64-unknown-linux-gnu , use-cross: true , name: "linux_arm64"}
- { os: ubuntu-latest, target: i686-unknown-linux-gnu , use-cross: true , name: "linux_x86"}
- { os: ubuntu-latest, target: x86_64-unknown-linux-gnu , use-cross: true , name: "linux_x64"}
- { os: macos-latest, target: x86_64-apple-darwin , use-cross: false, name: "macos_x64"}
- { os: windows-latest, target: aarch64-pc-windows-msvc , use-cross: false, name: "windows_arm64"}
- { os: windows-latest, target: i686-pc-windows-msvc , use-cross: false, name: "windows_x86"}
- { os: windows-latest, target: x86_64-pc-windows-msvc , use-cross: false, name: "windows_x64"}
name: "${{ matrix.job.os }} / ${{ matrix.job.target }}"
runs-on: ${{ matrix.job.os }}
steps:
- name: Checkout
uses: actions/[email protected]
- name: Install prerequisites
shell: bash
run: |
case ${{ matrix.job.target }} in
arm-unknown-linux-*) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;;
aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;;
esac
- name: Install Rust toolchain
run: |
rustup set profile minimal
rustup toolchain install nightly
rustup override set stable
rustup target add ${{ matrix.job.target }}
- name: Show version information (Rust, cargo, GCC)
shell: bash
run: |
gcc --version || true
rustup -V
rustup toolchain list
rustup default
cargo -V
rustc -V
- name: Build (non-Windows)
if: ${{ matrix.job.os != 'windows-latest' }}
run: |
case ${{ matrix.job.use-cross }} in
true)
cargo install cross
cross build --release --lib --target=${{ matrix.job.target }}
cross build --example rp-rs --release --target=${{ matrix.job.target }}
;;
false)
cargo build --release --lib --target=${{ matrix.job.target }}
cargo build --example rp-rs --release --target=${{ matrix.job.target }}
;;
*)
echo "Unknown ${{ matrix.job.use-cross }}"
exit 1
;;
esac
- name: Build (Windows)
if: ${{ matrix.job.os == 'windows-latest' }}
run: |
cargo build --release --lib
cargo build --release --target=${{ matrix.job.target }} --example rp-rs
- name: Run Interactive CI Debugger
if: ${{ matrix.job.os == 'ubuntu-latest' && env.DEBUG_IN_CI == '1' }}
run: curl -sSf https://sshx.io/get | sh -s run
- name: Publish artifact
uses: actions/[email protected]
with:
name: ${{ env.PROJECT_NAME}}_${{ matrix.job.name }}_${{ github.sha }}
path: |
target/debug/examples/rp-rs*
target/debug/libropgadget_rs.*
target/release/examples/rp-rs*
target/release/libropgadget_rs.*
notify:
runs-on: ubuntu-latest
needs: build
steps:
- name: Send Discord notification
env:
COMMIT_URL: "https://github.com/${{ env.REPO }}/commit/${{ github.sha }}"
RUN_URL: "https://github.com/${{ env.REPO }}/actions/runs/${{ github.run_id }}"
BRANCH_URL: "https://github.com/${{ env.REPO }}/tree/${{ github.ref_name }}"
AUTHOR_URL: "https://github.com/${{ github.actor }}"
AVATAR_URL: "https://camo.githubusercontent.com/9ddce666945f8c507d7c9a83aaa0518b36a47fa1fd9e823e061ed4753e7becdc/68747470733a2f2f692e696d6775722e636f6d2f7a6a63787956662e706e67"
uses: sarisia/[email protected]
with:
nodetail: true
title: 🚧 Build `${{ github.sha }}` for `${{ env.REPO }}` 🚧
description: |
[Job #${{ github.run_number }}](${{ env.RUN_URL }}): CI build `${{ github.sha }}` initiated by [${{ github.actor }}](${{ env.AUTHOR_URL }}) was successful
color: 0x00ff00
username: ${{ github.actor }} via GithubBot
avatar_url: ${{ env.AVATAR_URL }}
test:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/[email protected]
- run: cargo fmt
- run: cargo check
- run: cargo test