Skip to content

Commit 867e233

Browse files
committed
ci: add github actions for pull requests automated checks
1 parent 72558d1 commit 867e233

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
name: CI
3+
4+
on:
5+
workflow_call:
6+
workflow_dispatch:
7+
8+
jobs:
9+
test:
10+
name: Test
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Cache
15+
uses: actions/cache@v4
16+
with:
17+
path: |
18+
~/.cargo/registry
19+
~/.cargo/git
20+
target
21+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
22+
- name: Build binaries
23+
run: cargo build
24+
- name: Run tests
25+
run: cargo test
26+
27+
fmt:
28+
name: Format
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v4
32+
- name: Check code format
33+
run: cargo fmt --all -- --check
34+
35+
clippy:
36+
name: Lint
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v4
40+
- name: Lint code
41+
run: cargo clippy --all-features -- -D warnings

.github/workflows/pr.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
name: Pull Request
3+
4+
on:
5+
workflow_dispatch:
6+
pull_request:
7+
types:
8+
- opened
9+
- edited
10+
11+
jobs:
12+
ci:
13+
uses: ./.github/workflows/ci.yaml
14+
secrets: inherit

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Leetcode Command Line Interface
22

3+
[![Build Status][actions-badge]][actions-url]
4+
5+
[actions-badge]: https://github.com/coding-kelps/leetcode-cli/actions/workflows/ci.yaml/badge.svg?branch=main
6+
37
Interact with LeetCode in your development environment.
48

59
## Example

0 commit comments

Comments
 (0)