4 - cron: '0 0 * * *' # midnight UTC
14 RUSTFLAGS: "-D warnings -W unreachable-pub"
15 RUSTUP_MAX_RETRIES: 10
19 dist-x86_64-pc-windows-msvc:
20 name: dist (x86_64-pc-windows-msvc)
21 runs-on: windows-latest
23 RA_TARGET: x86_64-pc-windows-msvc
26 - name: Checkout repository
27 uses: actions/checkout@v2
29 fetch-depth: ${{ env.FETCH_DEPTH }}
31 # We need to disable the existing toolchain to avoid updating rust-docs
32 # which takes a long time. The fastest way to do this is to rename the
33 # existing folder, as deleting it takes about as much time as not doing
34 # anything and just updating rust-docs.
35 - name: Rename existing rust toolchain
36 run: Rename-Item C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc.old
38 - name: Install Rust toolchain
39 uses: actions-rs/toolchain@v1
48 - name: Upload artifacts
49 uses: actions/upload-artifact@v1
51 name: dist-x86_64-pc-windows-msvc
54 dist-aarch64-pc-windows-msvc:
55 name: dist (aarch64-pc-windows-msvc)
56 runs-on: windows-latest
58 RA_TARGET: aarch64-pc-windows-msvc
61 - name: Checkout repository
62 uses: actions/checkout@v2
64 fetch-depth: ${{ env.FETCH_DEPTH }}
66 - name: Rename existing rust toolchain
67 run: Rename-Item C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc.old
69 - name: Install Rust toolchain
70 uses: actions-rs/toolchain@v1
73 target: aarch64-pc-windows-msvc
80 - name: Upload artifacts
81 uses: actions/upload-artifact@v1
83 name: dist-aarch64-pc-windows-msvc
86 dist-x86_64-unknown-linux-gnu:
87 name: dist (x86_64-unknown-linux-gnu)
90 RA_TARGET: x86_64-unknown-linux-gnu
93 - name: Checkout repository
94 uses: actions/checkout@v2
96 fetch-depth: ${{ env.FETCH_DEPTH }}
98 - name: Install Rust toolchain
99 uses: actions-rs/toolchain@v1
106 - name: Install Nodejs
107 uses: actions/setup-node@v1
111 - name: Print current revision
112 run: git describe --tags
115 if: github.ref == 'refs/heads/release'
116 run: cargo xtask dist --client 0.2.$GITHUB_RUN_NUMBER
119 if: github.ref != 'refs/heads/release'
120 run: cargo xtask dist --nightly --client 0.3.$GITHUB_RUN_NUMBER-nightly
122 - name: Run analysis-stats on rust-analyzer
123 run: target/${{ env.RA_TARGET }}/release/rust-analyzer analysis-stats .
125 - name: Run analysis-stats on rust std library
126 run: target/${{ env.RA_TARGET }}/release/rust-analyzer analysis-stats --with-deps $(rustc --print sysroot)/lib/rustlib/src/rust/library/std
128 - name: Upload artifacts
129 uses: actions/upload-artifact@v1
131 name: dist-x86_64-unknown-linux-gnu
134 dist-x86_64-unknown-linux-musl:
135 name: dist (x86_64-unknown-linux-musl)
136 runs-on: ubuntu-20.04
138 RA_TARGET: x86_64-unknown-linux-musl
139 # For some reason `-crt-static` is not working for clang without lld
140 RUSTFLAGS: "-C link-arg=-fuse-ld=lld -C target-feature=-crt-static"
144 - /usr/local/cargo/registry
147 - name: Install dependencies
148 run: apk add --no-cache git clang lld musl-dev
150 - name: Checkout repository
151 uses: actions/checkout@v2
153 fetch-depth: ${{ env.FETCH_DEPTH }}
156 run: cargo xtask dist
158 - name: Upload artifacts
159 uses: actions/upload-artifact@v1
161 name: dist-x86_64-unknown-linux-musl
164 dist-aarch64-unknown-linux-gnu:
165 name: dist (aarch64-unknown-linux-gnu)
166 runs-on: ubuntu-16.04
168 RA_TARGET: aarch64-unknown-linux-gnu
169 CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
172 - name: Checkout repository
173 uses: actions/checkout@v2
175 fetch-depth: ${{ env.FETCH_DEPTH }}
177 - name: Install Rust toolchain
178 uses: actions-rs/toolchain@v1
181 target: aarch64-unknown-linux-gnu
185 - name: Install target toolchain
186 run: sudo apt-get install gcc-aarch64-linux-gnu
189 run: cargo xtask dist
191 - name: Upload artifacts
192 uses: actions/upload-artifact@v1
194 name: dist-aarch64-unknown-linux-gnu
197 dist-x86_64-apple-darwin:
198 name: dist (x86_64-apple-darwin)
199 runs-on: macos-latest
201 RA_TARGET: x86_64-apple-darwin
202 SELECT_XCODE: /Applications/Xcode_12.2.app
205 - name: Select XCode version
206 run: sudo xcode-select -s "${SELECT_XCODE}"
208 - name: Checkout repository
209 uses: actions/checkout@v2
211 fetch-depth: ${{ env.FETCH_DEPTH }}
213 - name: Install Rust toolchain
214 uses: actions-rs/toolchain@v1
221 run: cargo xtask dist
223 - name: Upload artifacts
224 uses: actions/upload-artifact@v1
226 name: dist-x86_64-apple-darwin
229 dist-aarch64-apple-darwin:
230 name: dist (aarch64-apple-darwin)
231 runs-on: macos-latest
233 RA_TARGET: aarch64-apple-darwin
234 SELECT_XCODE: /Applications/Xcode_12.2.app
237 - name: Select XCode version
238 run: sudo xcode-select -s "${SELECT_XCODE}"
240 - name: Checkout repository
241 uses: actions/checkout@v2
243 fetch-depth: ${{ env.FETCH_DEPTH }}
245 - name: Install Rust toolchain
246 uses: actions-rs/toolchain@v1
249 target: aarch64-apple-darwin
254 run: SDKROOT=$(xcrun -sdk macosx11.0 --show-sdk-path) MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx11.0 --show-sdk-platform-version) cargo xtask dist
256 - name: Upload artifacts
257 uses: actions/upload-artifact@v1
259 name: dist-aarch64-apple-darwin
264 runs-on: ubuntu-16.04
265 needs: ['dist-x86_64-pc-windows-msvc', 'dist-aarch64-pc-windows-msvc', 'dist-x86_64-unknown-linux-gnu', 'dist-x86_64-unknown-linux-musl', 'dist-aarch64-unknown-linux-gnu', 'dist-x86_64-apple-darwin', 'dist-aarch64-apple-darwin']
267 - name: Install Nodejs
268 uses: actions/setup-node@v1
272 - run: echo "TAG=$(date --iso --utc)" >> $GITHUB_ENV
273 if: github.ref == 'refs/heads/release'
274 - run: echo "TAG=nightly" >> $GITHUB_ENV
275 if: github.ref != 'refs/heads/release'
276 - run: 'echo "TAG: $TAG"'
278 - name: Checkout repository
279 uses: actions/checkout@v2
281 fetch-depth: ${{ env.FETCH_DEPTH }}
283 - run: echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
284 - run: 'echo "HEAD_SHA: $HEAD_SHA"'
286 - uses: actions/download-artifact@v1
288 name: dist-aarch64-apple-darwin
290 - uses: actions/download-artifact@v1
292 name: dist-x86_64-apple-darwin
294 - uses: actions/download-artifact@v1
296 name: dist-x86_64-unknown-linux-gnu
298 - uses: actions/download-artifact@v1
300 name: dist-x86_64-unknown-linux-musl
302 - uses: actions/download-artifact@v1
304 name: dist-aarch64-unknown-linux-gnu
306 - uses: actions/download-artifact@v1
308 name: dist-x86_64-pc-windows-msvc
310 - uses: actions/download-artifact@v1
312 name: dist-aarch64-pc-windows-msvc
316 - name: Publish Release
317 uses: ./.github/actions/github-release
321 token: ${{ secrets.GITHUB_TOKEN }}
324 working-directory: ./editors/code
326 - name: Publish Extension
327 if: github.ref == 'refs/heads/release'
328 working-directory: ./editors/code
329 # token from https://dev.azure.com/rust-analyzer/
330 run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer.vsix