Skip to content

Commit

Permalink
Setup github CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jpikl committed Mar 1, 2024
1 parent 44e8d05 commit 86968ec
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 10 deletions.
99 changes: 99 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: CI

on:
workflow_dispatch:
push:
branches-ignore: [stable-docs, gh-pages]
pull_request:
branches-ignore: [stable-docs, gh-pages]

env:
CARGO_TERM_COLOR: always

jobs:
build:
name: Build & Clippy
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install toolchain
uses: dtolnay/rust-toolchain@nightly
components: clippy

- name: Install just
uses: taiki-e/install-action@just

- name: Run build
run: just build

- name: Run clippy
run: just clippy

format:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install toolchain
uses: dtolnay/rust-toolchain@nightly
components: rustfmt

- name: Install just
uses: taiki-e/install-action@just

- name: Check format
run: just format --check

test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install toolchain
uses: dtolnay/rust-toolchain@stable

- name: Install just
uses: taiki-e/install-action@just

- name: Run tests
run: just test

coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install toolchain
uses: dtolnay/rust-toolchain@stable

- name: Install tarpaulin
uses: taiki-e/install-action@cargo-tarpaulin

- name: Install just
uses: taiki-e/install-action@just

- name: Run coverage
run: just coverage xml

- name: Upload coverage
if: ${{ github.event_name == 'push' }}
uses: codecov/codecov-action@v4
with:
file: ./cobertura.xml
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/book
target
tarpaulin-report.html
cobertura.xml
22 changes: 13 additions & 9 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ dev-docs:
wait

# Format code
format:
cargo +nightly fmt --all
format *ARGS:
cargo +nightly fmt --all {{ARGS}}

# Run clippy
clippy:
Expand All @@ -33,19 +33,23 @@ test:
docs:
cargo run --package xtask -- docs

# Build with release profile
build:
cargo build --release
# Build
build *ARGS:
cargo build {{ARGS}}

# Build and install to ~/.local/bin/
install: build
# Install release build to ~/.local/bin/
install: (build "--release")
mkdir -p ~/.local/bin/
cp target/release/rew ~/.local/bin/

# Run rew with args
# Run `rew` with args
run *ARGS:
cargo run -- {{ARGS}}

# Run `rew x` with a pattern
x PATTERN:
cargo run -- x "{{PATTERN}}"

# Run fuzzer
fuzz:
cargo +nightly fuzz run --jobs {{num_cpus()}} pattern
Expand All @@ -71,7 +75,7 @@ coverage-preview:
# Clean generated files
clean:
cargo clean
rm -rf book tarpaulin-report.html
rm -rf book cobertura.xml tarpaulin-report.html

# Set up development environment
[confirm("This might break your environment!\nRun `just --show setup` first to check what it does.\nContinue? [y/n]:")]
Expand Down
1 change: 0 additions & 1 deletion TODO.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
- Better shell specific examples for `rew x`.
- Refactor and split `x.rs` into multiple files.
- Finish user guide (performance, caveats, global opts propagation in `rew x`, forward compatibility, versioning).
- Setup CI (clippy, format, test, coverage).
- Setup CI (gh-pages on different path /rew-ng).
- Setup CI (release).
- Setup man generator.
Expand Down

0 comments on commit 86968ec

Please sign in to comment.