Skip to content

Commit

Permalink
ci(fix): modernise CI and remove warnings (#67)
Browse files Browse the repository at this point in the history
* ci(fix): modernise CI and remove warnings

* ci(fix): add ependabot
  • Loading branch information
leet4tari committed Dec 11, 2023
1 parent 85eea94 commit 38d0cc1
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 49 deletions.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
10 changes: 7 additions & 3 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
---
name: Security audit
on:

'on':
push:
pull_request:
schedule:
- cron: "43 04 * * *"

jobs:
security_audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/audit-check@v1
- uses: actions/checkout@v4

- uses: rustsec/audit-check@v1.4.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
81 changes: 43 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,75 +1,80 @@
---
name: CI

on: [push, pull_request]
'on': [push, pull_request]

env:
toolchain: nightly-2022-11-03

jobs:
clippy:
name: clippy
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: "true"

- name: toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly-2022-11-03
profile: minimal
toolchain: ${{ env.toolchain }}
components: rustfmt, clippy
override: true
- uses: Swatinem/rust-cache@v1

- name: Cache rust dependencies
uses: Swatinem/rust-cache@v2

- name: cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: install cargo lints
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-lints
- name: cargo lints clippy
uses: actions-rs/cargo@v1
with:
command: lints
args: clippy
run: |
cargo +${{ env.toolchain }} fmt --all -- --check
- name: Install cargo-lints
run: |
cargo install cargo-lints
- name: Clippy check (with lints)
run: |
cargo lints clippy --all-targets --all-features
build:
name: build
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: "true"

- name: toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1

- name: Cache rust dependencies
uses: Swatinem/rust-cache@v2

- name: cargo build
uses: actions-rs/cargo@v1
with:
command: build
args: --release
run: |
cargo build --release
test:
name: test
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: "true"

- name: toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1

- name: Cache rust dependencies
uses: Swatinem/rust-cache@v2

- name: cargo test
uses: actions-rs/cargo@v1
with:
command: test
run: |
cargo test
21 changes: 15 additions & 6 deletions .github/workflows/cov.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,48 @@
---
name: Coverage
on:

'on':
push:
branches:
- development
- cov-*

env:
RUSTUP_TOOLCHAIN: "nightly"

jobs:
coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: "true"

- name: Install dependencies
run: |
sudo apt update
sudo apt install -y jq lcov
- name: Download Rust
uses: actions-rs/toolchain@v1
sudo apt install --no-install-recommends --assume-yes \
jq lcov
- name: toolchain
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
override: true
components: llvm-tools-preview

- name: Install requirements for code coverage
run: |
cargo install cargo-binutils
cargo install rustfilt
- name: Run test coverage
id: coverage
env:
SKIP_HTML: "1"
run: |
/bin/bash -c ./code_coverage.sh
- name: Coveralls upload
uses: coverallsapp/github-action@master
with:
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/pr_title.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
name: PR
on:

'on':
pull_request:
types:
- opened
Expand All @@ -15,6 +17,9 @@ jobs:
run: |
npm install -g @commitlint/cli @commitlint/config-conventional
echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js
- name: lint
env:
PR_TITLE: ${{github.event.pull_request.title}}
run: |
echo "${{github.event.pull_request.title}}" | commitlint
echo "$PR_TITLE" | commitlint

0 comments on commit 38d0cc1

Please sign in to comment.