Skip to content

Commit

Permalink
Merge pull request #8 from cbeck88/add-ci
Browse files Browse the repository at this point in the history
add github actions CI
  • Loading branch information
cbeck88 authored Oct 12, 2024
2 parents 64a72d8 + 1648a8f commit c3aedfc
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 2 deletions.
17 changes: 17 additions & 0 deletions .github/actions/check-dirty-git/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Check dirty git
description: Check the git status of the current directory, and raise an error if there are uncommitted changes.

runs:
using: composite
steps:
- name: Checking dirty git
shell: bash
run: |
# Workaround for https://github.com/actions/checkout/issues/766
git config --global --add safe.directory "$GITHUB_WORKSPACE"
if [[ -n $(git status --porcelain) ]]; then
echo "repo is dirty"
git status
exit 1
fi
65 changes: 65 additions & 0 deletions .github/workflows/ci-rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Continuous Integration (rust)

on:
push:
branches: [ "develop" ]
# See docu here: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-including-and-excluding-branches
# it seems pretty similar to .gitignore
paths:
- '**'
- '!**.md'
pull_request:
paths:
- '**'
- '!**.md'

env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full

jobs:
# builds and tests rust code, with --deny warnings. tests for dirty git
build-and-test-rust:
runs-on: ubuntu-latest

env:
RUSTFLAGS: --deny warnings

steps:
- uses: actions/checkout@v4
- name: Rustup update
run: rustup update
- name: Show cargo version
run: cargo --version
- name: rust build caching
uses: Swatinem/rust-cache@v2
with:
workspaces: . -> target
save-if: ${{ github.ref == 'refs/heads/develop' }}
- name: Build Rust
run: cargo check --verbose --locked
- name: Test Rust
run: cargo test --all --verbose --locked
- name: Check dirty git
uses: ./.github/actions/check-dirty-git

# lints and checks formatting of rust code
lint-rust:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Rustup install nightly & update
run: rustup toolchain add nightly && rustup component add --toolchain nightly rustfmt && rustup update
- name: Show cargo version
run: cargo --version
- name: rust build caching
uses: Swatinem/rust-cache@v2
with:
key: lint
workspaces: . -> target
save-if: ${{ github.ref == 'refs/heads/develop' }}
- name: Format
run: cargo +nightly fmt -- --check
- name: Clippy
run: cargo clippy --all --all-features -- -D warnings
2 changes: 0 additions & 2 deletions src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use std::ffi::OsString;
/// their config structure in `main()`.
///
/// Hand-written implementations of this trait are not supported.
///
#[doc = include_str!("../REFERENCE_derive_conf.md")]
pub trait Conf: Sized {
/// Parse self from the process CLI args and environment, and exit the program with a help
Expand Down Expand Up @@ -153,7 +152,6 @@ pub trait Conf: Sized {
/// the `#[conf(subcommands)]` attribute.
///
/// Hand-written implementations of this trait are not supported.
///
#[doc = include_str!("../REFERENCE_derive_subcommands.md")]
pub trait Subcommands: Sized {
// Get the subcommands associated to this enum.
Expand Down

0 comments on commit c3aedfc

Please sign in to comment.