diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..dd8ab28 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,41 @@ +--- +name: CI + +on: + workflow_call: + workflow_dispatch: + +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Build binaries + run: cargo build + - name: Run tests + run: cargo test + + fmt: + name: Format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Check code format + run: cargo fmt --all -- --check + + clippy: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Lint code + run: cargo clippy --all-features -- -D warnings diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml new file mode 100644 index 0000000..bda0544 --- /dev/null +++ b/.github/workflows/pr.yaml @@ -0,0 +1,14 @@ +--- +name: Pull Request + +on: + workflow_dispatch: + pull_request: + types: + - opened + - edited + +jobs: + ci: + uses: ./.github/workflows/ci.yaml + secrets: inherit diff --git a/README.md b/README.md index 7865d24..c26c397 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # Leetcode Command Line Interface +[![Tests Status][actions-badge]][actions-url] + +[actions-badge]: https://github.com/coding-kelps/leetcode-cli/actions/workflows/ci.yaml/badge.svg?branch=main + Interact with LeetCode in your development environment. ## Example