-
Notifications
You must be signed in to change notification settings - Fork 2
129 lines (114 loc) · 3.76 KB
/
ci.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
name: CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
env:
CARGO_TERM_COLOR: always
CICD_INTERMEDIATES_DIR: "_cicd-intermediates"
WUKONG_HONEYCOMB_API_KEY: ${{ secrets.WUKONG_HONEYCOMB_API_KEY }}
CI: true
jobs:
check-formatting-clippy:
name: Check Formatting and Clippy
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.81.0
components: rustfmt, clippy
- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Install protoc for Linux
shell: bash
run: |
sudo apt -y update
sudo curl -sSLO https://github.com/protocolbuffers/protobuf/releases/download/v22.3/protoc-22.3-linux-x86_64.zip
sudo unzip protoc-22.3-linux-x86_64.zip -d /usr
protoc --version
- name: Check clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
- name: Test Wukong CLI
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose
ci:
strategy:
fail-fast: false
matrix:
rust: [stable]
job:
- {
name: "macOS-arm",
target: aarch64-apple-darwin,
os: macos-latest,
}
- { name: "macOS-x86", target: x86_64-apple-darwin, os: macos-latest }
- {
name: "linux-x86",
target: x86_64-unknown-linux-gnu,
os: ubuntu-22.04,
use-cross: true,
}
- {
name: "linux-x86-musl",
target: x86_64-unknown-linux-musl,
os: ubuntu-22.04,
use-cross: true,
}
name: ${{ matrix.job.name }} (${{ matrix.job.target }})
runs-on: ${{ matrix.job.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: ${{ matrix.job.target }}
components: rustfmt, clippy
override: true
- name: Install protoc for Linux
if: contains(matrix.job.target, 'linux')
shell: bash
run: |
sudo apt -y update
sudo curl -sSLO https://github.com/protocolbuffers/protobuf/releases/download/v22.3/protoc-22.3-linux-x86_64.zip
sudo unzip protoc-22.3-linux-x86_64.zip -d /usr
which protoc
- name: Install protoc for macOS
if: contains(matrix.job.target, 'apple-darwin')
shell: bash
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install protobuf
protoc --version
- name: Extract crate information
shell: bash
run: |
echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV
echo "PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV
echo "PROJECT_MAINTAINER=$(sed -n 's/^authors = \["\(.*\)"\]/\1/p' Cargo.toml)" >> $GITHUB_ENV
echo "PROJECT_HOMEPAGE=$(sed -n 's/^homepage = "\(.*\)"/\1/p' Cargo.toml)" >> $GITHUB_ENV
- name: Build Wukong CLI
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.job.use-cross }}
command: build
args: --locked --features prod --release --target=${{ matrix.job.target }}