Skip to content

Commit

Permalink
ci(actions): add ci action
Browse files Browse the repository at this point in the history
  • Loading branch information
Xenira committed Oct 28, 2023
1 parent c723075 commit d5eb79d
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 0 deletions.
94 changes: 94 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: CI

on:
push:
pull_request:
- master

jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: x86_64-unknown-linux-gnu
- name: Cache
uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --locked -v
- name: Upload
uses: actions/upload-artifacts@v3
with:
name: daktilo-nvim-debug
path: target/debug/libdaktilo_nvim*

test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Cache
uses: Swatinem/rust-cache@v2
- name: Generate code coverage
run: cargo llvm-cov --lcov --output-path lcov.info
env:
OUT_DIR: target
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
files: lcov.info
fail_ci_if_error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Check typos
uses: crate-ci/typos@master
- name: Validate commit messages
run: |
git show-ref
curl -sSfL https://github.com/convco/convco/releases/latest/download/convco-ubuntu.zip | zcat > convco
chmod +x convco
./convco check ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}
rm convco
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache Cargo dependencies
uses: Swatinem/rust-cache@v2

- name: Check code formatting
run: cargo fmt --all -- --check
- name: Check lints
run: cargo clippy -- -D warnings
- name: Run cargo-audit
uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Run msrv
shell: bash
run: |
curl -s 'https://api.github.com/repos/foresterre/cargo-msrv/releases' | \
jq -r "[.[] | select(.prerelease == false)][0].assets[] | \
select(.name | ascii_downcase | test(\"linux.*x86_64|x86_64.*linux\")).browser_download_url" | \
wget -qi -
tar -xvf cargo-msrv*.tar* -C ~/.cargo/bin/ cargo-msrv
printf "%s" "Checking MSRV..."
cargo msrv --output-format json verify | tail -n 1 | jq --exit-status '.success'
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ version = "0.1.0"
edition = "2021"
license = "GPL-3.0"

[lib]
crate-type = ["cdylib"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Expand Down

0 comments on commit d5eb79d

Please sign in to comment.