| 1 | name: check |
| 2 | on: |
| 3 | push: |
| 4 | branches: |
| 5 | - "*" |
| 6 | tags: |
| 7 | - "*" |
| 8 | pull_request: |
| 9 | branches: |
| 10 | - "*" |
| 11 | |
| 12 | jobs: |
| 13 | build: |
| 14 | strategy: |
| 15 | matrix: |
| 16 | os: |
| 17 | - ubuntu-latest |
| 18 | - macos-latest |
| 19 | - windows-latest |
| 20 | runs-on: ${{ matrix.os }} |
| 21 | steps: |
| 22 | - name: Checkout |
| 23 | uses: actions/checkout@v4 |
| 24 | with: |
| 25 | submodules: true |
| 26 | - uses: actions-rs/toolchain@v1 |
| 27 | with: |
| 28 | toolchain: stable |
| 29 | override: true |
| 30 | components: clippy, rustfmt |
| 31 | - name: Check format |
| 32 | run: cargo fmt --all -- --check |
| 33 | - name: Check fix |
| 34 | run: cargo fix && cargo fix |
| 35 | - name: Check with clippy |
| 36 | run: cargo clippy --all-targets --all-features -- -D warnings |
| 37 | - name: Build Release |
| 38 | run: cargo build --release |
| 39 | - name: Run tests |
| 40 | run: cargo test |
| 41 | |
| 42 | - uses: dtolnay/rust-toolchain@v1 |
| 43 | with: |
| 44 | target: riscv32imc-unknown-none-elf |
| 45 | toolchain: stable |
| 46 | components: rust-src |
| 47 | - name: Run no_std example |
| 48 | run: | |
| 49 | cargo fmt --all -- --check |
| 50 | cargo clippy --release --all -- -D warnings |
| 51 | cargo b --release |
| 52 | working-directory: ./is_debug_no_std |
| 53 | |
| 54 | |
| 55 | |
| 56 | publish-crate: |
| 57 | if: startsWith(github.ref, 'refs/tags/v') |
| 58 | runs-on: ubuntu-latest |
| 59 | steps: |
| 60 | - name: Set up Rust |
| 61 | uses: hecrj/setup-rust-action@v2 |
| 62 | - uses: actions/checkout@v4 |
| 63 | - name: Publish |
| 64 | shell: bash |
| 65 | run: | |
| 66 | cargo publish --token ${{ secrets.CRATES_GITHUB_TOKEN }} |