Added github actions

- typo check
- formatting check
- tests
- docs & docs deploy
This commit is contained in:
Dzuchun 2024-11-16 15:47:48 +02:00
commit 2cbb279bb1
3 changed files with 135 additions and 0 deletions

43
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,43 @@
# initial source: https://gist.github.com/domnikl/ccb8d0b82056fbe5cf7f4f145ac7f44b
name: Build and Test
on:
push:
branches: [ master ]
env:
CARGO_TERM_COLOR: always
jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install rustup
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: install check-all-fetures
run: cargo install cargo-all-features
- name: cargo check
env:
RUSTFLAGS: -D warnings
run: cargo check-all-features
- name: rustfmt
run: cargo fmt --all -- --check
- name: clippy
run: cargo clippy --all --tests -- -D warnings
- name: cargo test
run: cargo test-all-features
- name: cargo test on release
run: cargo test-all-features --release

65
.github/workflows/docs.yml vendored Normal file
View file

@ -0,0 +1,65 @@
# source: https://gist.github.com/antonengelhardt/f44815b91946440a2ac2c60976638686
name: Documentation
on:
push:
branches:
- master
env:
CARGO_TERM_COLOR: always
jobs:
build_docs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install rustup
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- name: Generate documentation
uses: actions-rs/cargo@v1
with:
command: doc
args: --no-deps --all-features
- name: Fix file permissions
shell: sh
run: |
chmod -c -R +rX "target/doc" |
while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: Generate index.html file
run: |
echo "<meta http-equiv=refresh content=0;url=wasm_oidc_plugin/index.html>" > target/doc/index.html
- name: Upload documentation
if: ${{ !env.ACT }}
uses: actions/upload-pages-artifact@v1
with:
path: ./target/doc
deploy_github_pages:
if: ${{ !github.event.act }} # skip during local actions testing
needs: build_docs
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.pages.outputs.page_url }}
steps:
- name: Deploy documentation
id: pages
uses: actions/deploy-pages@v2

27
.github/workflows/typos.yml vendored Normal file
View file

@ -0,0 +1,27 @@
# source: https://github.com/crate-ci/typos/blob/master/docs/github-action.md
name: Test GitHub Action
on:
push:
branches:
- master
jobs:
spellcheck:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install rustup
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: cargo
- name: Install typos
run: cargo install typos-cli
- name: Check spelling of source code
run: typos ./src/*.rs README.md