4 - cron: '0 0 * * *' # midnight UTC
14 RUSTFLAGS: "-D warnings -W unreachable-pub"
15 RUSTUP_MAX_RETRIES: 10
16 FETCH_DEPTH: 0 # pull in the tags for the version string
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
112 run: cargo xtask dist --client-patch-version $GITHUB_RUN_NUMBER
114 - name: Run analysis-stats on rust-analyzer
115 run: target/${{ env.RA_TARGET }}/release/rust-analyzer analysis-stats .
117 - name: Run analysis-stats on rust std library
118 run: target/${{ env.RA_TARGET }}/release/rust-analyzer analysis-stats --with-deps $(rustc --print sysroot)/lib/rustlib/src/rust/library/std
120 - name: Upload artifacts
121 uses: actions/upload-artifact@v1
123 name: dist-x86_64-unknown-linux-gnu
126 dist-aarch64-unknown-linux-gnu:
127 name: dist (aarch64-unknown-linux-gnu)
128 runs-on: ubuntu-20.04
130 RA_TARGET: aarch64-unknown-linux-gnu
131 CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
134 - name: Checkout repository
135 uses: actions/checkout@v2
137 fetch-depth: ${{ env.FETCH_DEPTH }}
139 - name: Install Rust toolchain
140 uses: actions-rs/toolchain@v1
143 target: aarch64-unknown-linux-gnu
147 - name: Update apt repositories
148 run: sudo apt-get update
150 - name: Install target toolchain
151 run: sudo apt-get install gcc-aarch64-linux-gnu
154 run: cargo xtask dist
156 - name: Upload artifacts
157 uses: actions/upload-artifact@v1
159 name: dist-aarch64-unknown-linux-gnu
162 dist-x86_64-unknown-linux-musl:
163 name: dist (x86_64-unknown-linux-musl)
164 runs-on: ubuntu-latest
166 RA_TARGET: x86_64-unknown-linux-musl
167 # For some reason `-crt-static` is not working for clang without lld
168 RUSTFLAGS: "-C link-arg=-fuse-ld=lld -C target-feature=-crt-static"
172 - /usr/local/cargo/registry
175 - name: Install dependencies
176 run: apk add --no-cache git clang lld musl-dev
178 - name: Checkout repository
179 uses: actions/checkout@v2
181 fetch-depth: ${{ env.FETCH_DEPTH }}
184 run: cargo xtask dist
186 - name: Upload artifacts
187 uses: actions/upload-artifact@v1
189 name: dist-x86_64-unknown-linux-musl
192 dist-x86_64-apple-darwin:
193 name: dist (x86_64-apple-darwin)
194 runs-on: macos-latest
196 RA_TARGET: x86_64-apple-darwin
197 SELECT_XCODE: /Applications/Xcode_12.2.app
200 - name: Select XCode version
201 run: sudo xcode-select -s "${SELECT_XCODE}"
203 - name: Checkout repository
204 uses: actions/checkout@v2
206 fetch-depth: ${{ env.FETCH_DEPTH }}
208 - name: Install Rust toolchain
209 uses: actions-rs/toolchain@v1
216 run: cargo xtask dist
218 - name: Upload artifacts
219 uses: actions/upload-artifact@v1
221 name: dist-x86_64-apple-darwin
224 dist-aarch64-apple-darwin:
225 name: dist (aarch64-apple-darwin)
226 runs-on: macos-latest
228 RA_TARGET: aarch64-apple-darwin
229 SELECT_XCODE: /Applications/Xcode_12.2.app
232 - name: Select XCode version
233 run: sudo xcode-select -s "${SELECT_XCODE}"
235 - name: Checkout repository
236 uses: actions/checkout@v2
238 fetch-depth: ${{ env.FETCH_DEPTH }}
240 - name: Install Rust toolchain
241 uses: actions-rs/toolchain@v1
244 target: aarch64-apple-darwin
249 run: SDKROOT=$(xcrun -sdk macosx11.0 --show-sdk-path) MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx11.0 --show-sdk-platform-version) cargo xtask dist
251 - name: Upload artifacts
252 uses: actions/upload-artifact@v1
254 name: dist-aarch64-apple-darwin
259 runs-on: ubuntu-latest
260 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']
262 - name: Install Nodejs
263 uses: actions/setup-node@v1
267 - run: echo "TAG=$(date --iso -u)" >> $GITHUB_ENV
268 if: github.ref == 'refs/heads/release'
269 - run: echo "TAG=nightly" >> $GITHUB_ENV
270 if: github.ref != 'refs/heads/release'
271 - run: 'echo "TAG: $TAG"'
273 - name: Checkout repository
274 uses: actions/checkout@v2
276 fetch-depth: ${{ env.FETCH_DEPTH }}
278 - run: echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
279 - run: 'echo "HEAD_SHA: $HEAD_SHA"'
281 - uses: actions/download-artifact@v1
283 name: dist-aarch64-apple-darwin
285 - uses: actions/download-artifact@v1
287 name: dist-x86_64-apple-darwin
289 - uses: actions/download-artifact@v1
291 name: dist-x86_64-unknown-linux-gnu
293 - uses: actions/download-artifact@v1
295 name: dist-x86_64-unknown-linux-musl
297 - uses: actions/download-artifact@v1
299 name: dist-aarch64-unknown-linux-gnu
301 - uses: actions/download-artifact@v1
303 name: dist-x86_64-pc-windows-msvc
305 - uses: actions/download-artifact@v1
307 name: dist-aarch64-pc-windows-msvc
311 - name: Publish Release
312 uses: ./.github/actions/github-release
316 token: ${{ secrets.GITHUB_TOKEN }}
319 working-directory: ./editors/code
321 - name: Publish Extension
322 if: github.ref == 'refs/heads/release'
323 working-directory: ./editors/code
324 # token from https://dev.azure.com/rust-analyzer/
325 run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer.vsix