feat: admin role support #167
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: development | |
env: | |
FIXED_RUST_VERSION: 1.74.0 | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
toolchain: | |
- 1.74.0 | |
- stable | |
- beta | |
- nightly | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: de-vri-es/setup-git-credentials@v2 | |
with: | |
credentials: "https://${{ github.repository_owner }}:${{ secrets.GIT_CREDENTIALS }}@github.com" | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
profile: minimal | |
- name: Release build | |
run: cargo build --release | |
lint: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
toolchain: | |
- 1.74.0 | |
- stable | |
- beta | |
- nightly | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: de-vri-es/setup-git-credentials@v2 | |
with: | |
credentials: "https://${{ github.repository_owner }}:${{ secrets.GIT_CREDENTIALS }}@github.com" | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
profile: minimal | |
components: rustfmt, clippy | |
- name: Format | |
run: cargo fmt --all -- --check | |
- name: Clippy | |
run: cargo clippy --all-targets --all-features -- -D warnings | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
toolchain: | |
- 1.74.0 | |
- stable | |
- beta | |
- nightly | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: de-vri-es/setup-git-credentials@v2 | |
with: | |
credentials: "https://${{ github.repository_owner }}:${{ secrets.GIT_CREDENTIALS }}@github.com" | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
profile: minimal | |
- name: Unit Test | |
run: cargo test --lib | |
- name: Start MongoDB | |
uses: supercharge/[email protected] | |
- name: Integration Test | |
run: cargo test --test '*' | |
env: | |
RUST_TEST_THREADS: 1 | |
MONGODB_URI: "mongodb://localhost:27017/" | |
MONGODB_DATABASE_NAME: "test" | |
coverage: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# https://docs.deepsource.com/docs/analyzers-test-coverage#with-github-actions | |
- name: Use pull request HEAD commit for DeepSource | |
if: github.event_name == 'pull_request' | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: de-vri-es/setup-git-credentials@v2 | |
with: | |
credentials: "https://${{ github.repository_owner }}:${{ secrets.GIT_CREDENTIALS }}@github.com" | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ env.FIXED_RUST_VERSION }} | |
profile: minimal | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: Install rust-covfix | |
run: | | |
curl -L https://github.com/Kogia-sima/rust-covfix/releases/latest/download/rust-covfix-linux-x86_64.tar.xz |tar Jxf - | |
mv rust-covfix-linux-x86_64/rust-covfix ./ | |
- name: Start MongoDB | |
uses: supercharge/[email protected] | |
- name: Generate and fix code coverage | |
run: | | |
cargo llvm-cov --ignore-filename-regex "main" --lcov --output-path lcov.info | |
./rust-covfix lcov.info -o lcov.info | |
env: | |
RUST_TEST_THREADS: 1 | |
MONGODB_URI: "mongodb://localhost:27017/" | |
MONGODB_DATABASE_NAME: "test" | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
file: ./lcov.info | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
- name: Upload coverage reports to DeepSource | |
if: github.event_name == 'pull_request' | |
run: | | |
curl https://deepsource.io/cli | sh | |
./bin/deepsource report --analyzer test-coverage --key rust --value-file ./lcov.info | |
env: | |
DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }} |