Skip to content

Commit

Permalink
Configure Rust CI actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Sharparam committed Aug 13, 2023
1 parent 3ceecf5 commit 6e34025
Show file tree
Hide file tree
Showing 5 changed files with 154 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Security audit

on:
schedule:
- cron: '0 0 * * *'
push:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
pull_request:

jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
41 changes: 41 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Docs

on:
push:
branches: [$default-branch]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

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

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Generate docs
uses: actions-rs/cargo@v1
with:
command: doc
args: --release --workspace
- name: Copy custom redirect page
run: cp docs/facti_redirect.html target/doc/index.html
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: './target/doc'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
35 changes: 35 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
on:
push:
pull_request:

name: Lint

permissions:
contents: read
checks: write

jobs:
clippy_check:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- beta
- nightly
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
components: rustfmt, clippy
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features -- -D warnings
48 changes: 48 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
on:
pull_request:
push:

name: Test

jobs:
test:
name: Test
env:
CARGO_INCREMENTAL: 0
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- beta
- nightly
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- name: Cache dependencies
uses: actions/cache@v2
env:
cache-name: cache-dependencies
with:
path: |
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/bin
~/.cargo/registry/index
~/.cargo/registry/cache
target
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Cargo.lock') }}
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --verbose
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose
11 changes: 11 additions & 0 deletions docs/facti_redirect.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>facti documentation</title>
<meta http-equiv="refresh" content="0; url=facti/index.html" />
</head>
<body>
<p><a href="facti/index.html">Go to documentation.</a></p>
</body>
</html>

0 comments on commit 6e34025

Please sign in to comment.