Skip to content

Commit

Permalink
Add basic CI
Browse files Browse the repository at this point in the history
  • Loading branch information
albertlarsan68 committed Jul 15, 2024
1 parent 4389ca0 commit 46f0966
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/problem_matchers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"problemMatcher": [
{
"owner": "cargo-common",
"pattern": [
{
"regexp": "^(warning|warn|error)(\\[(\\S*)\\])?: (.*)$",
"severity": 1,
"message": 4,
"code": 3
},
{
"regexp": "^\\s+-->\\s(\\S+):(\\d+):(\\d+)$",
"file": 1,
"line": 2,
"column": 3
}
]
},
{
"owner": "compiler-panic",
"pattern": [
{
"regexp": "error: internal compiler error: (.*):(\\d+):(\\d+): (.*)$",
"message": 4,
"file": 1,
"line": 2,
"column": 3
}
]
},
{
"owner": "cargo-fmt",
"pattern": [
{
"regexp": "^(Diff in (\\S+)) at line (\\d+):",
"message": 1,
"file": 2,
"line": 3
}
]
}
]
}
61 changes: 61 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Rust

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always

jobs:
formatting:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust
run: |
set -euo pipefail
rustup default beta
rustup component add rustfmt
- name: Add problem matchers
run: echo "::add-matcher::.github/problem_matchers.json"
- name: Check Rust formatting
run: cargo fmt --check
clippy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust
run: |
set -euo pipefail
rustup default beta
rustup component add clippy
- name: Add problem matchers
run: echo "::add-matcher::.github/problem_matchers.json"
- name: Run Clippy
run: cargo clippy -- -Dwarnings
checks:
strategy:
fail-fast: true
matrix:
rust-version: [ "stable", "beta", "nightly" ]
os: [ "ubuntu-latest", "windows-latest", "macos-latest" ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust
run: |
set -euo pipefail
rustup default ${{ matrix.rust-version }}
- name: Add problem matchers
run: echo "::add-matcher::.github/problem_matchers.json"
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose

0 comments on commit 46f0966

Please sign in to comment.