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
19 MACOSX_DEPLOYMENT_TARGET: 10.15
20 CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
28 target: x86_64-pc-windows-msvc
29 code-target: win32-x64
31 target: aarch64-pc-windows-msvc
32 code-target: win32-arm64
34 target: x86_64-unknown-linux-gnu
35 code-target: linux-x64
37 target: aarch64-unknown-linux-gnu
38 code-target: linux-arm64
40 target: x86_64-apple-darwin
41 code-target: darwin-x64
43 target: aarch64-apple-darwin
44 code-target: darwin-arm64
46 name: dist (${{ matrix.target }})
47 runs-on: ${{ matrix.os }}
50 RA_TARGET: ${{ matrix.target }}
53 - name: Checkout repository
54 uses: actions/checkout@v2
56 fetch-depth: ${{ env.FETCH_DEPTH }}
58 # We need to disable the existing toolchain to avoid updating rust-docs
59 # which takes a long time. The fastest way to do this is to rename the
60 # existing folder, as deleting it takes about as much time as not doing
61 # anything and just updating rust-docs.
62 - name: Rename existing Rust toolchain
63 if: matrix.os == 'windows-latest'
64 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
66 - name: Install Rust toolchain
67 uses: actions-rs/toolchain@v1
70 target: ${{ matrix.target }}
74 - name: Install Rust library source
75 if: matrix.target == 'x86_64-unknown-linux-gnu'
76 uses: actions-rs/toolchain@v1
79 target: ${{ matrix.target }}
84 - name: Install Node.js
85 uses: actions/setup-node@v1
89 - name: Update apt repositories
90 if: matrix.target == 'aarch64-unknown-linux-gnu'
91 run: sudo apt-get update
93 - name: Install target toolchain
94 if: matrix.target == 'aarch64-unknown-linux-gnu'
95 run: sudo apt-get install gcc-aarch64-linux-gnu
98 run: cargo xtask dist --client-patch-version ${{ github.run_number }}
101 working-directory: editors/code
103 - run: npx vsce package -o "../../dist/rust-analyzer-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }}
104 working-directory: editors/code
106 - if: matrix.target == 'x86_64-unknown-linux-gnu'
107 run: rm -rf editors/code/server
109 - if: matrix.target == 'x86_64-unknown-linux-gnu'
110 run: npx vsce package -o ../../dist/rust-analyzer.vsix
111 working-directory: editors/code
113 - name: Run analysis-stats on rust-analyzer
114 if: matrix.target == 'x86_64-unknown-linux-gnu'
115 run: target/${{ matrix.target }}/release/rust-analyzer analysis-stats .
117 - name: Run analysis-stats on rust std library
118 if: matrix.target == 'x86_64-unknown-linux-gnu'
119 run: target/${{ matrix.target }}/release/rust-analyzer analysis-stats --with-deps $(rustc --print sysroot)/lib/rustlib/src/rust/library/std
121 - name: Upload artifacts
122 uses: actions/upload-artifact@v1
124 name: dist-${{ matrix.target }}
127 dist-x86_64-unknown-linux-musl:
128 name: dist (x86_64-unknown-linux-musl)
129 runs-on: ubuntu-latest
131 RA_TARGET: x86_64-unknown-linux-musl
132 # For some reason `-crt-static` is not working for clang without lld
133 RUSTFLAGS: "-C link-arg=-fuse-ld=lld -C target-feature=-crt-static"
137 - /usr/local/cargo/registry
140 - name: Install dependencies
141 run: apk add --no-cache git clang lld musl-dev nodejs npm
143 - name: Checkout repository
144 uses: actions/checkout@v2
146 fetch-depth: ${{ env.FETCH_DEPTH }}
149 run: cargo xtask dist --client-patch-version ${{ github.run_number }}
152 working-directory: editors/code
154 - run: npx vsce package -o "../../dist/rust-analyzer-alpine-x64.vsix" --target alpine-x64
155 working-directory: editors/code
157 - run: rm -rf editors/code/server
159 - name: Upload artifacts
160 uses: actions/upload-artifact@v1
162 name: dist-x86_64-unknown-linux-musl
167 runs-on: ubuntu-latest
168 needs: ["dist", "dist-x86_64-unknown-linux-musl"]
170 - name: Install Nodejs
171 uses: actions/setup-node@v1
175 - run: echo "TAG=$(date --iso -u)" >> $GITHUB_ENV
176 if: github.ref == 'refs/heads/release'
177 - run: echo "TAG=nightly" >> $GITHUB_ENV
178 if: github.ref != 'refs/heads/release'
179 - run: 'echo "TAG: $TAG"'
181 - name: Checkout repository
182 uses: actions/checkout@v2
184 fetch-depth: ${{ env.FETCH_DEPTH }}
186 - run: echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
187 - run: 'echo "HEAD_SHA: $HEAD_SHA"'
189 - uses: actions/download-artifact@v1
191 name: dist-aarch64-apple-darwin
193 - uses: actions/download-artifact@v1
195 name: dist-x86_64-apple-darwin
197 - uses: actions/download-artifact@v1
199 name: dist-x86_64-unknown-linux-gnu
201 - uses: actions/download-artifact@v1
203 name: dist-x86_64-unknown-linux-musl
205 - uses: actions/download-artifact@v1
207 name: dist-aarch64-unknown-linux-gnu
209 - uses: actions/download-artifact@v1
211 name: dist-x86_64-pc-windows-msvc
213 - uses: actions/download-artifact@v1
215 name: dist-aarch64-pc-windows-msvc
219 - name: Publish Release
220 uses: ./.github/actions/github-release
224 token: ${{ secrets.GITHUB_TOKEN }}
227 working-directory: ./editors/code
229 - name: Publish Extension
230 if: github.ref == 'refs/heads/release'
231 working-directory: ./editors/code
232 # token from https://dev.azure.com/rust-analyzer/
233 run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer-*.vsix