-
Notifications
You must be signed in to change notification settings - Fork 85
122 lines (98 loc) · 3.57 KB
/
rust-cli.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
name: Rust CLI CI
on:
push:
branches-ignore:
- "master"
- "next"
paths:
- "zowex/**"
- '.github/workflows/rust-cli*.yml'
pull_request:
paths: "zowex/**"
jobs:
build-linux:
name: Build Linux
runs-on: ubuntu-latest
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) && !contains(github.event.head_commit.message, '[ci skip]')
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Prepare Cross
run: cargo install [email protected]
# Need to build in container with old version of GLIBC to support RHEL 7
# https://kobzol.github.io/rust/ci/2021/05/07/building-rust-binaries-in-ci-that-work-with-older-glibc.html
- name: Build
working-directory: zowex
run: cross build --verbose
- name: Create Archive
run: |
cd zowex/target/x86_64-unknown-linux-gnu/debug
tar -cvzf zowe.tgz zowe
- name: Archive Results
id: upload
uses: actions/upload-artifact@v4
with:
name: zowe-linux.tgz
path: zowex/target/x86_64-unknown-linux-gnu/debug/zowe.tgz
- name: Run linter
run: |
cargo clippy --manifest-path=zowex/Cargo.toml
- name: Run tests
run: cargo test unit --verbose --manifest-path=zowex/Cargo.toml -- --nocapture
build-macos:
name: Build MacOS
runs-on: macos-latest
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) && !contains(github.event.head_commit.message, '[ci skip]')
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-apple-darwin
- name: Build
run: |
cargo build --verbose --target aarch64-apple-darwin --manifest-path=zowex/Cargo.toml
cargo build --verbose --target x86_64-apple-darwin --manifest-path=zowex/Cargo.toml
mkdir -p zowex/target/debug && cd zowex/target/debug
mv ../aarch64-apple-darwin/debug/zowe zowe.aarch64 && mv ../x86_64-apple-darwin/debug/zowe zowe.x86_64
lipo -create -output zowe zowe.aarch64 zowe.x86_64
# Use gtar instead of tar on MacOS to prevent extra `GNUSparseFile.0` directory
- name: Create Archive
run: |
cd zowex/target/debug
gtar -cvzf zowe.tgz zowe
- name: Archive Results
id: upload
uses: actions/upload-artifact@v4
with:
name: zowe-macos.tgz
path: zowex/target/debug/zowe.tgz
- name: Run tests
run: cargo test unit --verbose --manifest-path=zowex/Cargo.toml -- --nocapture
build-windows:
name: Build Windows
runs-on: windows-latest
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) && !contains(github.event.head_commit.message, '[ci skip]')
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Build
run: cargo build --verbose --manifest-path=zowex/Cargo.toml
env:
RUSTFLAGS: "-Ctarget-feature=+crt-static"
- name: Create Archive
run: |
cd zowex/target/debug
tar -cvzf zowe.tgz zowe.exe
- name: Archive Results
id: upload
uses: actions/upload-artifact@v4
with:
name: zowe-windows.tgz
path: zowex/target/debug/zowe.tgz
- name: Run tests
run: cargo test unit --verbose --manifest-path=zowex/Cargo.toml -- --nocapture