Skip to content

Commit 70736dc

Browse files
authored
Feature: test & CI (#4)
* feat: unit-test * chore: bump dependencies * feat(ci): add CI for Pull Request * fix(ci): remove unecessary CI run * fix(ci): add cross
1 parent 0e256e4 commit 70736dc

File tree

9 files changed

+1594
-637
lines changed

9 files changed

+1594
-637
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on:
55
- main
66
release:
77
types: [ created, edited ]
8-
pull_request:
98

109
name: Main
1110
jobs:

.github/workflows/pr-build.yaml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: PR Build
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
branches:
7+
- main
8+
- master
9+
10+
jobs:
11+
build:
12+
runs-on: ${{ matrix.os.imageName }}
13+
timeout-minutes: 30
14+
strategy:
15+
matrix:
16+
rust_toolchain: ["stable"]
17+
os:
18+
- target_platform: x86_64-unknown-linux-gnu
19+
imageName: ubuntu-latest
20+
cross: "true"
21+
- target_platform: x86_64-unknown-linux-musl
22+
imageName: ubuntu-latest
23+
cross: "true"
24+
- target_platform: aarch64-unknown-linux-musl
25+
imageName: ubuntu-latest
26+
cross: "true"
27+
- target_platform: x86_64-apple-darwin
28+
imageName: "macOS-latest"
29+
- target_platform: aarch64-apple-darwin
30+
imageName: "macOS-latest"
31+
- target_platform: x86_64-pc-windows-msvc
32+
imageName: windows-latest
33+
34+
steps:
35+
- uses: actions/checkout@v3
36+
- name: Cache cargo & target directories
37+
uses: Swatinem/rust-cache@v2
38+
with:
39+
prefix-key: v2-rust
40+
key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }}
41+
restore-keys: |
42+
43+
- uses: rui314/setup-mold@v1
44+
- uses: actions-rs/toolchain@v1
45+
with:
46+
toolchain: ${{ matrix.rust_toolchain }}
47+
target: ${{ matrix.os.target_platform }}
48+
override: true
49+
profile: minimal
50+
- name: Install cross
51+
if: matrix.os.cross == 'true'
52+
run: cargo install cross --git https://github.com/cross-rs/cross
53+
- name: Run cargo check
54+
uses: actions-rs/cargo@v1
55+
with:
56+
use-cross: ${{ matrix.os.cross == 'true' }}
57+
command: check
58+
args: --target ${{ matrix.os.target_platform }}
59+
- name: Run cargo build
60+
uses: actions-rs/cargo@v1
61+
with:
62+
use-cross: ${{ matrix.os.cross == 'true' }}
63+
command: build
64+
args: --release --target ${{ matrix.os.target_platform }}
65+
- name: Run cargo test
66+
uses: actions-rs/cargo@v1
67+
with:
68+
use-cross: ${{ matrix.os.cross == 'true' }}
69+
command: test
70+
args: --target ${{ matrix.os.target_platform }}

0 commit comments

Comments
 (0)