From 4cd9f2685ffaa7a6c2d84b22ea9a4ca2a97edfe1 Mon Sep 17 00:00:00 2001 From: Daniel Bershatsky Date: Sat, 24 Aug 2024 23:53:31 +0300 Subject: [PATCH] Set up Github Actions workflow --- .github/workflows/on-push.yml | 33 +++++++++++++++++++++++++++++++++ .pre-commit-config.yaml | 5 +---- README.md | 8 ++++++-- 3 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/on-push.yml diff --git a/.github/workflows/on-push.yml b/.github/workflows/on-push.yml new file mode 100644 index 0000000..9fbdcc1 --- /dev/null +++ b/.github/workflows/on-push.yml @@ -0,0 +1,33 @@ +name: Continuous Integration +on: [push, pull_request, merge_group] + +env: + RUSTFLAGS: "-Dwarnings" + RUSTDOCFLAGS: "-Dwarnings" + +jobs: + lint: + name: Lint and format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@1.80.1 + with: + components: clippy, rustfmt + - uses: Swatinem/rust-cache@v2 + - name: Run `pre-commit` checks + uses: pre-commit/action@v3.0.0 + - run: cargo doc --workspace --no-deps + - run: cargo fmt --check --all + + test: + name: Test + needs: 'lint' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@1.80.1 + - uses: Swatinem/rust-cache@v2 + - run: cargo clippy --workspace --all-targets --all-features --no-deps + - run: cargo test --workspace --no-run + - run: cargo test --workspace --no-fail-fast diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e69cbbe..e877138 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,11 +8,8 @@ repos: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace - - id: debug-statements - repo: https://github.com/backplane/pre-commit-rust-hooks rev: v1.1.0 hooks: - - id: fmt - - id: check - - id: clippy + - id: fmt-check diff --git a/README.md b/README.md index 0345a59..f2dee91 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,17 @@ # Typstd +![Linting and testing][1] + +[1]: https://github.com/daskol/typstd/actions/workflows/on-push.yml/badge.svg + ## Overview -**Typstd** is a pretty simple language server for [Typst][1] markup language. +**Typstd** is a pretty simple language server for [Typst][2] markup language. Its distinctive feature is workspace management and completion for global objects which are defined out of scope of text document in focus (e.g. bibliography references). -[1]: https://github.com/typst/typst +[2]: https://github.com/typst/typst ### Workspace