Skip to content

Setup Github Actions #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jun 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Docs

on:
push:
branches: [ "main" ]

concurrency:
group: deploy
cancel-in-progress: false

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Cache Dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-rust-

- name: Setup pages
id: pages
uses: actions/configure-pages@v5

- name: Clean docs folder
run: cargo clean --doc

- name: Build docs
run: cargo doc --no-deps

- name: Add redirect
run: echo '<meta http-equiv="refresh" content="0;url=aoc/index.html">' > target/doc/index.html

- name: Remove lock file
run: rm target/doc/.lock

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: target/doc

deploy:
runs-on: ubuntu-latest
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
66 changes: 66 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Rust

on:
push:
branches: [ "main" ]

pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt, clippy

- name: Cache Dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-rust-

- name: Format
uses: actions-rust-lang/rustfmt@v1

- name: Lint
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
env:
RUSTFLAGS: "-D warnings"

- name: Install Tools
uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov, nextest

- name: Test
run: cargo llvm-cov nextest --no-fail-fast --lcov --output-path lcov.info

- name: Upload Coverage
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v3
with:
files: lcov.info
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"rust-analyzer.check.extraArgs": [
"--all-features",
"--",
"-D warnings"
],
"rust-analyzer.check.command": "clippy"
}
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ default-features = false
[dev-dependencies]
libc = "0.2.172"
serde_json = "1.0.140"
serde_test = "1.0.177"
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,11 @@ Unix exit code from a raw integer:
```rust
use proc_result::unix::ExitCode;

fn main() {
let code = ExitCode::from_raw(1);
if code.is_success() {
println!("Command succeeded!");
} else {
eprintln!("Command failed with exit code: {}", code);
}
let code = ExitCode::from_raw(1);
if code.is_success() {
println!("Command succeeded!");
} else {
eprintln!("Command failed with exit code: {}", code);
}
```

Expand Down
6 changes: 5 additions & 1 deletion src/unix/exit_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ use crate::raw::RawExitCode;

/// A Unix-like exit code.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(
feature = "serde",
derive(serde::Serialize, serde::Deserialize),
serde(transparent)
)]
pub struct ExitCode(u8);

impl ExitCode {
Expand Down
6 changes: 5 additions & 1 deletion src/unix/signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ use core::fmt::Display;
///
/// Represents a signal that can be sent to or received by processes on Unix-like systems.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(
feature = "serde",
derive(serde::Serialize, serde::Deserialize),
serde(transparent)
)]
pub struct Signal(u8);

impl Signal {
Expand Down
Loading