forked from ret2shell/ret2shell
-
Notifications
You must be signed in to change notification settings - Fork 0
162 lines (138 loc) · 4.42 KB
/
Copy pathbinary.yml
File metadata and controls
162 lines (138 loc) · 4.42 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: Binary
on:
push:
paths:
- ".github/workflows/binary.yml"
- ".github/setup-env.sh"
- "crates/**"
- "Cargo.toml"
- "Cargo.lock"
- "rustfmt.toml"
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- ".github/workflows/binary.yml"
- ".github/setup-env.sh"
- "crates/**"
- "Cargo.toml"
- "Cargo.lock"
- "rustfmt.toml"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: binary-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
fmt-check:
name: Format
if: ${{ github.event_name != 'workflow_dispatch' }}
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
- name: Setup nightly rustfmt
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Rust format check
run: cargo +nightly fmt --all -- --check
check:
name: Test and Clippy
if: ${{ github.event_name != 'workflow_dispatch' }}
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
- name: Install linker toolchain
run: |
if ! command -v clang >/dev/null 2>&1 || ! command -v ld.lld >/dev/null 2>&1; then
sudo apt update
sudo apt install -y clang lld
fi
- name: Setup rust
uses: dtolnay/rust-toolchain@1.98.1
with:
components: clippy
- name: Cache cargo registry
uses: actions/cache@v5
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cargo/git/checkouts/
key: cargo-${{ runner.os }}-1.98.1-${{ hashFiles('Cargo.lock') }}
restore-keys: |
cargo-${{ runner.os }}-1.98.1-
cargo-${{ runner.os }}-
- name: Cache target
uses: actions/cache@v5
with:
path: target/
key: cargo-target-${{ runner.os }}-1.98.1-${{ hashFiles('Cargo.lock') }}
restore-keys: |
cargo-target-${{ runner.os }}-1.98.1-
cargo-target-${{ runner.os }}-
- name: Run tests
run: cargo test --locked --workspace --all-features
- name: Cargo clippy checks
run: cargo clippy --locked --workspace --all-features --all-targets -- -D warnings
binary:
name: Build
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
timeout-minutes: 90
strategy:
matrix:
target: [x86_64-unknown-linux-musl]
env:
R2S_GIT_VERSION: unknown
commit_sha: unknown
app_v: unknown
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: chetan/git-restore-mtime-action@v2
- name: Setup environment
id: setup-env
run: |
if ! command -v musl-gcc >/dev/null 2>&1 || ! command -v clang >/dev/null 2>&1 || ! command -v ld.lld >/dev/null 2>&1; then
sudo apt update
sudo apt install -y musl-tools musl-dev clang lld
fi
bash .github/setup-env.sh
- name: Setup rust
uses: dtolnay/rust-toolchain@1.98.1
with:
targets: ${{ matrix.target }}
- name: Cache cargo registry
uses: actions/cache@v5
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cargo/git/checkouts/
key: cargo-${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
cargo-${{ runner.os }}-${{ matrix.target }}-
cargo-${{ runner.os }}-
- name: Cache build target
uses: actions/cache@v5
with:
path: target/
key: cargo-target-${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
cargo-target-${{ runner.os }}-${{ matrix.target }}-
cargo-target-${{ runner.os }}-
- name: Build on version ${{ env.app_v }}-${{ env.commit_sha }}
run: cargo build --locked --bin r2s-server --release --target '${{ matrix.target }}'
- name: Upload artifact
continue-on-error: true
uses: actions/upload-artifact@v7
with:
name: r2s-server
path: target/${{ matrix.target }}/release/r2s-server
retention-days: 1