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