4 - cron: "0 0 * * *" # midnight UTC
16 RUSTFLAGS: "-D warnings -W unreachable-pub"
17 RUSTUP_MAX_RETRIES: 10
18 FETCH_DEPTH: 0 # pull in the tags for the version string
26 target: x86_64-pc-windows-msvc
28 target: aarch64-pc-windows-msvc
30 target: x86_64-unknown-linux-gnu
32 target: aarch64-unknown-linux-gnu
33 cross_linker: aarch64-linux-gnu-gcc
35 target: x86_64-apple-darwin
37 target: aarch64-apple-darwin
39 name: dist (${{ matrix.target }})
40 runs-on: ${{ matrix.os }}
43 RA_TARGET: ${{ matrix.target }}
44 CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: ${{ matrix.cross_linker }}
47 - name: Checkout repository
48 uses: actions/checkout@v2
50 fetch-depth: ${{ env.FETCH_DEPTH }}
52 # We need to disable the existing toolchain to avoid updating rust-docs
53 # which takes a long time. The fastest way to do this is to rename the
54 # existing folder, as deleting it takes about as much time as not doing
55 # anything and just updating rust-docs.
56 - name: Rename existing Rust toolchain
57 if: matrix.os == 'windows-latest'
58 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
60 - name: Install Rust toolchain
61 uses: actions-rs/toolchain@v1
64 target: ${{ matrix.target }}
68 - name: Install Rust library source
69 if: matrix.target == 'x86_64-unknown-linux-gnu'
70 uses: actions-rs/toolchain@v1
73 target: ${{ matrix.target }}
78 - name: Install Node.js
79 if: matrix.target == 'x86_64-unknown-linux-gnu'
80 uses: actions/setup-node@v1
84 - name: Update apt repositories
85 if: matrix.target == 'aarch64-unknown-linux-gnu'
86 run: sudo apt-get update
88 - name: Install target toolchain
89 if: matrix.target == 'aarch64-unknown-linux-gnu'
90 run: sudo apt-get install gcc-aarch64-linux-gnu
92 - name: Dist (generic)
93 if: matrix.target != 'x86_64-unknown-linux-gnu'
97 if: matrix.target == 'x86_64-unknown-linux-gnu'
98 run: cargo xtask dist --client-patch-version $GITHUB_RUN_NUMBER
100 - name: Run analysis-stats on rust-analyzer
101 if: matrix.target == 'x86_64-unknown-linux-gnu'
102 run: target/${{ matrix.target }}/release/rust-analyzer analysis-stats .
104 - name: Run analysis-stats on rust std library
105 if: matrix.target == 'x86_64-unknown-linux-gnu'
106 run: target/${{ matrix.target }}/release/rust-analyzer analysis-stats --with-deps $(rustc --print sysroot)/lib/rustlib/src/rust/library/std
108 - name: Upload artifacts
109 uses: actions/upload-artifact@v1
111 name: dist-${{ matrix.target }}
114 dist-x86_64-unknown-linux-musl:
115 name: dist (x86_64-unknown-linux-musl)
116 runs-on: ubuntu-latest
118 RA_TARGET: x86_64-unknown-linux-musl
119 # For some reason `-crt-static` is not working for clang without lld
120 RUSTFLAGS: "-C link-arg=-fuse-ld=lld -C target-feature=-crt-static"
124 - /usr/local/cargo/registry
127 - name: Install dependencies
128 run: apk add --no-cache git clang lld musl-dev
130 - name: Checkout repository
131 uses: actions/checkout@v2
133 fetch-depth: ${{ env.FETCH_DEPTH }}
136 run: cargo xtask dist
138 - name: Upload artifacts
139 uses: actions/upload-artifact@v1
141 name: dist-x86_64-unknown-linux-musl
146 runs-on: ubuntu-latest
147 needs: ["dist", "dist-x86_64-unknown-linux-musl"]
149 - name: Install Nodejs
150 uses: actions/setup-node@v1
154 - run: echo "TAG=$(date --iso -u)" >> $GITHUB_ENV
155 if: github.ref == 'refs/heads/release'
156 - run: echo "TAG=nightly" >> $GITHUB_ENV
157 if: github.ref != 'refs/heads/release'
158 - run: 'echo "TAG: $TAG"'
160 - name: Checkout repository
161 uses: actions/checkout@v2
163 fetch-depth: ${{ env.FETCH_DEPTH }}
165 - run: echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
166 - run: 'echo "HEAD_SHA: $HEAD_SHA"'
168 - uses: actions/download-artifact@v1
170 name: dist-aarch64-apple-darwin
172 - uses: actions/download-artifact@v1
174 name: dist-x86_64-apple-darwin
176 - uses: actions/download-artifact@v1
178 name: dist-x86_64-unknown-linux-gnu
180 - uses: actions/download-artifact@v1
182 name: dist-x86_64-unknown-linux-musl
184 - uses: actions/download-artifact@v1
186 name: dist-aarch64-unknown-linux-gnu
188 - uses: actions/download-artifact@v1
190 name: dist-x86_64-pc-windows-msvc
192 - uses: actions/download-artifact@v1
194 name: dist-aarch64-pc-windows-msvc
198 - name: Publish Release
199 uses: ./.github/actions/github-release
203 token: ${{ secrets.GITHUB_TOKEN }}
206 working-directory: ./editors/code
208 - name: Publish Extension
209 if: github.ref == 'refs/heads/release'
210 working-directory: ./editors/code
211 # token from https://dev.azure.com/rust-analyzer/
212 run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer.vsix