docs
This commit is contained in:
@@ -1,27 +1,98 @@
|
||||
name: 'deploy'
|
||||
on: [push]
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, dev ]
|
||||
pull_request:
|
||||
branches: [ main, dev ]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
redis:
|
||||
image: redis
|
||||
ports:
|
||||
- 6379:6379
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
|
||||
- name: Install cargo-llvm-cov manually
|
||||
run: |
|
||||
mkdir -p $HOME/.cargo/bin
|
||||
curl -LO https://github.com/taiki-e/cargo-llvm-cov/releases/latest/download/cargo-llvm-cov-x86_64-unknown-linux-gnu.tar.gz
|
||||
tar xf cargo-llvm-cov-x86_64-unknown-linux-gnu.tar.gz
|
||||
chmod +x cargo-llvm-cov
|
||||
mv cargo-llvm-cov $HOME/.cargo/bin/
|
||||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
||||
rm cargo-llvm-cov-x86_64-unknown-linux-gnu.tar.gz
|
||||
|
||||
- name: Generate code coverage
|
||||
run: |
|
||||
cargo llvm-cov --lcov --output-path lcov.info
|
||||
cargo llvm-cov --html
|
||||
|
||||
- name: Extract Coverage Percentage
|
||||
id: coverage
|
||||
run: |
|
||||
COVERAGE=$(cargo llvm-cov --summary | grep -oP 'coverage: \K[0-9.]+%' || echo "0%")
|
||||
echo "total_coverage=$COVERAGE" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Create Coverage Badge
|
||||
uses: schneegans/dynamic-badges-action@v1.6.0
|
||||
with:
|
||||
auth: ${{ secrets.GIST_SECRET }}
|
||||
gistID: your_gist_id_here
|
||||
filename: coverage.json
|
||||
label: coverage
|
||||
message: ${{ steps.coverage.outputs.total_coverage }}
|
||||
color: green
|
||||
|
||||
- name: Upload coverage HTML
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: code-coverage
|
||||
path: target/llvm-cov/html
|
||||
|
||||
- name: Upload LCOV report
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: lcov-report
|
||||
path: lcov.info
|
||||
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Cloning repo
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Get Repo Name
|
||||
id: repo_name
|
||||
run: echo "::set-output name=repo::$(echo ${GITHUB_REPOSITORY##*/})"
|
||||
- name: Install Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
|
||||
- name: Get Branch Name
|
||||
id: branch_name
|
||||
run: echo "::set-output name=branch::$(echo ${GITHUB_REF##*/})"
|
||||
- name: Check formatting
|
||||
run: cargo fmt --all -- --check
|
||||
|
||||
- name: Push to dokku
|
||||
uses: dokku/github-action@master
|
||||
with:
|
||||
branch: 'main'
|
||||
git_remote_url: 'ssh://dokku@v2.discours.io:22/quoter'
|
||||
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
git_push_flags: '--force'
|
||||
- name: Clippy
|
||||
run: cargo clippy -- -D warnings
|
||||
|
||||
deploy:
|
||||
needs: [test, lint]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Deploy to Dokku
|
||||
uses: dokku/github-action@master
|
||||
with:
|
||||
git_remote_url: 'ssh://dokku@staging.discours.io:22/inbox'
|
||||
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
Reference in New Issue
Block a user