Merge pull request #196 from cunarist/improve-internals #2
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: quality-control | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
concurrency: | |
# Cancels the workflow | |
# when another event in the same context happens. | |
# If it's a PR, context is the pull request number. | |
# Otherwise, it uses the Git reference(branch or tag name). | |
group: > | |
${{ github.workflow }} | |
${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
code: | |
name: dart-and-rust-code | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup Flutter SDK | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
- name: Setup Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Setup Protobuf compiler | |
uses: arduino/setup-protoc@v2 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install Clippy | |
run: rustup component add clippy | |
- name: Install the CLI tool | |
working-directory: rust_crate/ | |
run: cargo install --path ./ | |
- name: Fetch Flutter dependencies | |
working-directory: flutter_ffi_plugin/example/ | |
run: flutter pub get | |
- name: Generate message files | |
working-directory: flutter_ffi_plugin/example/ | |
run: rinf message | |
- name: Check for any errors | |
run: | | |
rustup target add wasm32-unknown-unknown | |
RUSTFLAGS="-D warnings" | |
cargo check | |
cargo check --release | |
cargo check --target wasm32-unknown-unknown | |
cargo check --target wasm32-unknown-unknown --release | |
- name: Format Dart code | |
run: dart format . | |
- name: Format Rust code | |
run: | | |
cargo fmt | |
cargo clippy --fix --allow-dirty | |
- name: Check if the code has changed | |
run: git diff --exit-code | |
config: | |
name: configuration-files | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Check files with Prettier | |
uses: creyD/[email protected] | |
with: | |
dry: True | |
prettier_options: > | |
--write | |
./**/*.{md,yaml} |