-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (121 loc) · 3.75 KB
/
ci.yml
File metadata and controls
143 lines (121 loc) · 3.75 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
name: Build and Test
on:
push:
branches: [main, master]
tags:
- 'v*'
pull_request:
branches: [main, master]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
check:
name: Check and Lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
- name: Cache cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Check documentation
run: cargo doc --no-deps --all-features
- name: Check base build
run: cargo build --release
test:
name: Test
runs-on: ${{ matrix.os }}
needs: check
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Cache cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run tests
run: cargo test --verbose
- name: Run tests with CLI features
run: cargo test --features=cli --verbose
build:
name: Build Release Binaries
runs-on: ${{ matrix.os }}
needs: test
strategy:
matrix:
include:
- os: ubuntu-latest
artifact_name: bbl_parser-linux-x64
binary_path: target/release/bbl_parser
- os: windows-latest
artifact_name: bbl_parser-windows-x64
binary_path: target/release/bbl_parser.exe
- os: macos-latest
artifact_name: bbl_parser-macos-x64
binary_path: target/release/bbl_parser
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Cache cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build release binary
run: cargo build --release
- name: Create binary ZIP archive (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
Compress-Archive -Path "${{ matrix.binary_path }}" -DestinationPath "bbl_parser-${{ matrix.artifact_name }}.zip"
- name: Create binary ZIP archive (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
zip "bbl_parser-${{ matrix.artifact_name }}.zip" "${{ matrix.binary_path }}"
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: bbl_parser-${{ matrix.artifact_name }}.zip
overwrite: true
if-no-files-found: error