-
-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (88 loc) · 2.62 KB
/
check.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
name: Check
on: [ push, pull_request ]
jobs:
test:
name: Run with test inputs
strategy:
fail-fast: false
matrix:
toolchain:
- stable
- beta
- nightly
cargo_args:
- ""
- "--release"
- "--all-features"
- "--all-features --release"
runs-on: ubuntu-latest
permissions: {}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Update env
shell: bash
run: echo 'CARGO_ARGS=${{ matrix.cargo_args }} --color=always' >> "${GITHUB_ENV}"
- name: Update rust
shell: bash
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- name: Build project
shell: bash
run: cargo build --verbose --release
- name: Run benchmark script
shell: bash
run: bash ./benchmark.sh
- name: Run benchmark script
shell: bash
run: bash ./benchmark.sh
lint_code:
name: Clippy
runs-on: ubuntu-latest
permissions: { }
strategy:
fail-fast: false
matrix:
toolchain:
- stable
cargo_args:
- ""
- "--all-features"
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Update rust
shell: bash
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- name: Run cargo clippy
run: cargo clippy --color=always ${{ matrix.cargo_args }} -- -D warnings
improve_code:
name: Improve and format the code
runs-on: ubuntu-latest
if: github.ref_type == 'branch'
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Update rust
shell: bash
run: rustup update stable && rustup default stable
- name: Improve the code
run: cargo clippy --fix || cargo clippy --fix --all-features
- name: Format the code
run: cargo fmt
- name: Update env
run: |
D=$(python -c "print((_dt:=__import__('datetime')).datetime.now(tz=_dt.timezone.utc).replace(minute=0, second=0, microsecond=0).isoformat())")
echo "GIT_AUTHOR_DATE=${D}" >> "${GITHUB_ENV}"
echo "GIT_COMMITTER_DATE=${D}" >> "${GITHUB_ENV}"
- name: Push changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "format code"
commit_user_name: Bot
commit_user_email:
commit_author: Bot <>