microsoft/qdk
Publicmirrored fromhttps://github.com/microsoft/qdkAvailable
.github/workflows/ci.yml
117lines · modecode
| 1 | name: CI Build and Test |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: [main] |
| 6 | pull_request: |
| 7 | branches: [main] |
| 8 | merge_group: |
| 9 | workflow_dispatch: |
| 10 | |
| 11 | # Cancel in-progress run when a pull request is updated |
| 12 | # Code taken from: |
| 13 | # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-a-fallback-value |
| 14 | concurrency: |
| 15 | group: ${{ github.head_ref || github.run_id }} |
| 16 | cancel-in-progress: true |
| 17 | |
| 18 | env: |
| 19 | CARGO_TERM_COLOR: always |
| 20 | RUST_TOOLCHAIN_VERSION: "1.72" |
| 21 | RUST_TOOLCHAIN_COMPONENTS: rustfmt clippy |
| 22 | |
| 23 | jobs: |
| 24 | format: |
| 25 | name: Format |
| 26 | runs-on: ubuntu-latest |
| 27 | steps: |
| 28 | - uses: actions/checkout@v3 |
| 29 | with: |
| 30 | submodules: "true" |
| 31 | - name: Setup rust toolchain |
| 32 | uses: ./.github/actions/toolchains/rust |
| 33 | with: |
| 34 | toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }} |
| 35 | components: ${{ env.RUST_TOOLCHAIN_COMPONENTS }} |
| 36 | - name: Check Formatting |
| 37 | run: cargo fmt --all -- --check |
| 38 | |
| 39 | clippy: |
| 40 | name: Clippy |
| 41 | runs-on: ubuntu-latest |
| 42 | steps: |
| 43 | - uses: actions/checkout@v3 |
| 44 | with: |
| 45 | submodules: "true" |
| 46 | - name: Setup rust toolchain |
| 47 | uses: ./.github/actions/toolchains/rust |
| 48 | with: |
| 49 | toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }} |
| 50 | components: ${{ env.RUST_TOOLCHAIN_COMPONENTS }} |
| 51 | - uses: Swatinem/rust-cache@v2 |
| 52 | - name: Clippy Lints |
| 53 | run: cargo clippy --all-targets --all-features -- -D warnings |
| 54 | |
| 55 | benches: |
| 56 | name: Benches |
| 57 | runs-on: ubuntu-latest |
| 58 | steps: |
| 59 | - uses: actions/checkout@v3 |
| 60 | with: |
| 61 | submodules: "true" |
| 62 | - name: Setup rust toolchain |
| 63 | uses: ./.github/actions/toolchains/rust |
| 64 | with: |
| 65 | toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }} |
| 66 | components: ${{ env.RUST_TOOLCHAIN_COMPONENTS }} |
| 67 | - uses: Swatinem/rust-cache@v2 |
| 68 | - name: cargo bench |
| 69 | run: cargo bench --workspace |
| 70 | |
| 71 | web-check: |
| 72 | name: Check web files |
| 73 | runs-on: ubuntu-latest |
| 74 | steps: |
| 75 | - uses: actions/checkout@v3 |
| 76 | with: |
| 77 | submodules: "true" |
| 78 | - uses: actions/setup-node@v3 |
| 79 | with: |
| 80 | node-version: '18.17.1' |
| 81 | - name: npm install |
| 82 | run: npm install |
| 83 | - name: npm check |
| 84 | run: npm run check |
| 85 | |
| 86 | build: |
| 87 | name: CI Build and Test |
| 88 | strategy: |
| 89 | matrix: |
| 90 | os: [windows-latest, ubuntu-latest, macos-latest] |
| 91 | |
| 92 | runs-on: ${{matrix.os}} |
| 93 | |
| 94 | steps: |
| 95 | - uses: actions/checkout@v3 |
| 96 | with: |
| 97 | submodules: "true" |
| 98 | - name: Setup rust toolchain |
| 99 | uses: ./.github/actions/toolchains/rust |
| 100 | with: |
| 101 | toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }} |
| 102 | components: ${{ env.RUST_TOOLCHAIN_COMPONENTS }} |
| 103 | - name: Add additional Rust targets |
| 104 | run: | |
| 105 | rustup target add aarch64-apple-darwin |
| 106 | if: matrix.os == 'macos-latest' |
| 107 | - uses: actions/setup-python@v4 |
| 108 | with: |
| 109 | python-version: '3.11' |
| 110 | - uses: actions/setup-node@v3 |
| 111 | with: |
| 112 | node-version: '18.17.1' |
| 113 | - uses: Swatinem/rust-cache@v2 |
| 114 | - name: Prereqs |
| 115 | run: python ./prereqs.py --install |
| 116 | - name: Build and Test |
| 117 | run: python ./build.py --no-check |
| 118 | |