Skip to content

Commit

Permalink
Configuring Rust CI
Browse files Browse the repository at this point in the history
  • Loading branch information
oestradiol committed Sep 17, 2024
1 parent 4140045 commit 6b55832
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 4 deletions.
33 changes: 33 additions & 0 deletions .github/rust.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"problemMatcher": [
{
"owner": "rustfmt",
"severity": "warning",
"pattern": [
{
"regexp": "^(Diff in (.+)) at line (\\d+):$",
"message": 1,
"file": 2,
"line": 3
}
]
},
{
"owner": "clippy",
"pattern": [
{
"regexp": "^(?:\\x1b\\[[\\d;]+m)*(warning|warn|error)(?:\\x1b\\[[\\d;]+m)*(\\[(.*)\\])?(?:\\x1b\\[[\\d;]+m)*:(?:\\x1b\\[[\\d;]+m)* ([^\\x1b]*)(?:\\x1b\\[[\\d;]+m)*$",
"severity": 1,
"message": 4,
"code": 3
},
{
"regexp": "^(?:\\x1b\\[[\\d;]+m)*\\s*(?:\\x1b\\[[\\d;]+m)*\\s*--> (?:\\x1b\\[[\\d;]+m)*(.*):(\\d*):(\\d*)(?:\\x1b\\[[\\d;]+m)*$",
"file": 1,
"line": 2,
"column": 3
}
]
}
]
}
33 changes: 29 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Rust
name: Rust CI

on:
push:
Expand All @@ -8,11 +8,36 @@ on:

env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
RUST_BACKTRACE: short
RUSTFLAGS: "-D warnings"

jobs:
build:
rust:
name: Rust
runs-on: ubuntu-latest

strategy:
fail-fast: false

steps:
- uses: actions/checkout@v4
- name: Build
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1

# https://github.com/actions-rust-lang/setup-rust-toolchain/blob/main/rust.json
- name: Install Rust Problem Matcher
run: echo "::add-matcher::.github/rust.json"

- name: Bump opt-level
run: sed -i '/\[profile.dev]/a opt-level=1' Cargo.toml

- name: Compile (rust-analyzer)
run: cargo build --verbose

- name: rustfmt
run: cargo fmt-no-gen

0 comments on commit 6b55832

Please sign in to comment.