Skip to content

Commit

Permalink
add CI actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyrix126 committed May 30, 2024
1 parent d421ef3 commit 4ec1367
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This runs `cargo audit` on all dependencies (only if Cargo deps changed)

name: Audit

on:
push:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'

env:
CARGO_TERM_COLOR: always

jobs:
audit:

runs-on: ubuntu-latest

steps:
- name: Cache
uses: actions/[email protected]
with:
path: |
~/.cargo
target
key: audit
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: cargo install cargo-audit --locked
- name: Audit
run: cargo audit

58 changes: 58 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI

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

env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: "full"

jobs:
ci:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest]

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo
target
key: ${{ matrix.os }}

- name: Install dependencies
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt update
shell: bash

- name: Test
run: cargo test --release

- name: Build
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
cargo build --release --target x86_64-unknown-linux-gnu
mv target/x86_64-unknown-linux-gnu/release/api-formatter .
cargo build --release --target x86_64-unknown-linux-gnu --features=bundle
fi
shell: bash

- name: Archive (Linux)
if: ${{ runner.os == 'Linux' }}
uses: actions/upload-artifact@v4
with:
name: linux
path: linux.tar
43 changes: 43 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Rust

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

env:
CARGO_TERM_COLOR: always

jobs:
fmt:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Format
run: cargo fmt --all --check

# Run typo checker separately.
# This will fast-cancel other CI early if this fails.
typo:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Spell Check
uses: crate-ci/typos@master
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Clippy (fail on warnings)
run: cargo clippy --workspace --all-features --all-targets -- -D warnings
- name: Check compilation
run: cargo check --all-features --verbose
- name: Tests
run: cargo test --all-features
- name: Documentation
run: cargo doc --workspace --all-features --no-deps

0 comments on commit 4ec1367

Please sign in to comment.