microsoft/qdk

Public

mirrored fromhttps://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
billt/revert-mimalloc

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

.github/workflows/ci.yml

215lines · modecode

1name: CI Build and Test
2
3on:
4 pull_request:
5 branches:
6 - main
7 - 'feature/**'
8 - 'release/**'
9 merge_group:
10 workflow_dispatch:
11
12# Cancel in-progress run when a pull request is updated
13# Code taken from:
14# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-a-fallback-value
15concurrency:
16 group: ${{ github.head_ref || github.run_id }}
17 cancel-in-progress: true
18
19env:
20 CARGO_TERM_COLOR: always
21 NODE_VERSION: "18.17.1"
22 PYTHON_VERSION: "3.11"
23 RUST_TOOLCHAIN_VERSION: "1.76"
24 RUST_TOOLCHAIN_COMPONENTS: rustfmt clippy
25
26jobs:
27 format:
28 name: Format
29 runs-on: ubuntu-latest
30 steps:
31 - uses: actions/checkout@v3
32 with:
33 submodules: "true"
34 - name: Setup rust toolchain
35 uses: ./.github/actions/toolchains/rust
36 with:
37 toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }}
38 components: ${{ env.RUST_TOOLCHAIN_COMPONENTS }}
39 - name: Check Formatting
40 run: cargo fmt --all -- --check
41
42 clippy:
43 name: Clippy
44 runs-on: ubuntu-latest
45 steps:
46 - uses: actions/checkout@v3
47 with:
48 submodules: "true"
49 - name: Setup rust toolchain
50 uses: ./.github/actions/toolchains/rust
51 with:
52 toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }}
53 components: ${{ env.RUST_TOOLCHAIN_COMPONENTS }}
54 - uses: Swatinem/rust-cache@v2
55 - name: Clippy Lints
56 run: cargo clippy --all-targets --all-features -- -D warnings
57
58 web-check:
59 name: Check web files
60 runs-on: ubuntu-latest
61 steps:
62 - uses: actions/checkout@v3
63 with:
64 submodules: "true"
65 - uses: actions/setup-node@v3
66 with:
67 node-version: ${{ env.NODE_VERSION }}
68 - name: npm install
69 run: npm install
70 - name: npm check
71 run: npm run check
72
73 build:
74 name: Build and test
75 strategy:
76 matrix:
77 os: [windows-latest, ubuntu-latest, macos-14]
78
79 runs-on: ${{matrix.os}}
80
81 steps:
82 - uses: actions/checkout@v3
83 with:
84 submodules: "true"
85 - name: Setup rust toolchain
86 uses: ./.github/actions/toolchains/rust
87 with:
88 toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }}
89 components: ${{ env.RUST_TOOLCHAIN_COMPONENTS }}
90 - name: Add additional Rust targets
91 run: |
92 rustup target add x86_64-apple-darwin
93 if: matrix.os == 'macos-14'
94 - uses: actions/setup-python@v4
95 with:
96 python-version: ${{ env.PYTHON_VERSION }}
97 - uses: actions/setup-node@v3
98 with:
99 node-version: ${{ env.NODE_VERSION }}
100 - uses: Swatinem/rust-cache@v2
101 - name: Prereqs
102 run: python ./prereqs.py --install
103 - name: Build and Test
104 run: python ./build.py --no-check
105
106 integration-tests:
107 name: Integration tests
108 timeout-minutes: 15
109 strategy:
110 matrix:
111 os: [windows-latest, ubuntu-latest, macos-14]
112
113 runs-on: ${{matrix.os}}
114
115 steps:
116 - uses: actions/checkout@v3
117 with:
118 submodules: "true"
119 - name: Setup rust toolchain
120 uses: ./.github/actions/toolchains/rust
121 with:
122 toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }}
123 components: ${{ env.RUST_TOOLCHAIN_COMPONENTS }}
124 - name: Add additional Rust targets
125 run: |
126 rustup target add x86_64-apple-darwin
127 if: matrix.os == 'macos-14'
128 - uses: actions/setup-python@v4
129 with:
130 python-version: ${{ env.PYTHON_VERSION }}
131 - uses: actions/setup-node@v3
132 with:
133 node-version: ${{ env.NODE_VERSION }}
134 - uses: Swatinem/rust-cache@v2
135 - name: Prereqs
136 run: python ./prereqs.py --install
137 - name: Run integration tests
138 run: python ./build.py --no-check --no-test --wasm --npm --vscode --pip --widgets --integration-tests
139
140 runBenchmark:
141 name: run benchmark
142 runs-on: ubuntu-latest
143 permissions:
144 contents: read
145 pull-requests: write
146 steps:
147 - uses: actions/checkout@v3
148 - uses: boa-dev/criterion-compare-action@v3
149 with:
150 branchName: ${{ github.base_ref }}
151 cwd: "compiler/qsc"
152 if: ${{ github.base_ref != null }}
153
154 runMemoryProfile:
155 name: run memory profile
156 runs-on: ubuntu-latest
157 permissions:
158 contents: read
159 pull-requests: write
160 steps:
161 - uses: actions/checkout@v2
162 with:
163 ref: main
164 - uses: Swatinem/rust-cache@v2
165 - run: |
166 MAIN_MEASUREMENT=$(cargo run --bin memtest)
167 echo "MAIN_MEASUREMENT<<EOF" >> $GITHUB_ENV
168 echo "$MAIN_MEASUREMENT" >> $GITHUB_ENV
169 echo "EOF" >> $GITHUB_ENV
170 - run: |
171 echo "${{env.MAIN_MEASUREMENT}}"
172 echo $MAIN_MEASUREMENT
173
174 - uses: actions/checkout@v2
175 - run: |
176 BRANCH_MEASUREMENT=$(cargo run --bin memtest)
177 echo "BRANCH_MEASUREMENT<<EOF" >> $GITHUB_ENV
178 echo "$BRANCH_MEASUREMENT" >> $GITHUB_ENV
179 echo "EOF" >> $GITHUB_ENV
180 - run: |
181 echo "${{env.BRANCH_MEASUREMENT}}"
182 echo $BRANCH_MEASUREMENT
183 - uses: actions/github-script@v6
184 with:
185 script: |
186 if (${{ env.BRANCH_MEASUREMENT }} !== ${{ env.MAIN_MEASUREMENT }}) {
187 try {
188 await github.rest.issues.createComment({
189 issue_number: context.issue.number,
190 owner: context.repo.owner,
191 repo: context.repo.repo,
192 body: `_Change in memory usage detected by benchmark._
193 ## Memory Report for ${{ github.sha }}
194
195 | Test | This Branch | On Main |
196 |-----------------------------|-------------|----------|
197 | compile core + standard lib | ${{ env.BRANCH_MEASUREMENT }} bytes | ${{ env.MAIN_MEASUREMENT }} bytes |`
198 })
199 } catch (err) {
200 core.warning(`Failed writing comment on GitHub issue: ${err}`)
201 }
202 } else {
203 console.log("no change in memory usage detected by benchmark");
204 }
205 if: ${{ github.base_ref != null }}
206
207 status-check:
208 name: Status Check
209 needs: [format, clippy, web-check, build, integration-tests, runBenchmark, runMemoryProfile]
210 runs-on: ubuntu-latest
211 if: failure()
212 steps:
213 - run: |
214 echo "::error Build failed"
215 exit 1
216