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
21 CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
29 target: x86_64-pc-windows-msvc
30 code-target: win32-x64
32 target: aarch64-pc-windows-msvc
33 code-target: win32-arm64
35 target: x86_64-unknown-linux-gnu
36 code-target: linux-x64
38 target: aarch64-unknown-linux-gnu
39 code-target: linux-arm64
41 target: arm-unknown-linux-gnueabihf
42 code-target: linux-armhf
44 target: x86_64-apple-darwin
45 code-target: darwin-x64
47 target: aarch64-apple-darwin
48 code-target: darwin-arm64
50 name: dist (${{ matrix.target }})
51 runs-on: ${{ matrix.os }}
54 RA_TARGET: ${{ matrix.target }}
57 - name: Checkout repository
58 uses: actions/checkout@v3
60 fetch-depth: ${{ env.FETCH_DEPTH }}
62 - name: Install Rust toolchain
64 rustup update --no-self-update stable
65 rustup target add ${{ matrix.target }}
66 rustup component add rust-src
68 - name: Install Node.js
69 uses: actions/setup-node@v1
73 - name: Update apt repositories
74 if: matrix.target == 'aarch64-unknown-linux-gnu' || matrix.target == 'arm-unknown-linux-gnueabihf'
75 run: sudo apt-get update
77 - name: Install AArch64 target toolchain
78 if: matrix.target == 'aarch64-unknown-linux-gnu'
79 run: sudo apt-get install gcc-aarch64-linux-gnu
81 - name: Install ARM target toolchain
82 if: matrix.target == 'arm-unknown-linux-gnueabihf'
83 run: sudo apt-get install gcc-arm-linux-gnueabihf
86 run: cargo xtask dist --client-patch-version ${{ github.run_number }}
89 working-directory: editors/code
91 - name: Package Extension (release)
92 if: github.ref == 'refs/heads/release'
93 run: npx vsce package -o "../../dist/rust-analyzer-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }}
94 working-directory: editors/code
96 - name: Package Extension (nightly)
97 if: github.ref != 'refs/heads/release'
98 run: npx vsce package -o "../../dist/rust-analyzer-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }} --pre-release
99 working-directory: editors/code
101 - if: matrix.target == 'x86_64-unknown-linux-gnu'
102 run: rm -rf editors/code/server
104 - if: matrix.target == 'x86_64-unknown-linux-gnu' && github.ref == 'refs/heads/release'
105 run: npx vsce package -o ../../dist/rust-analyzer-no-server.vsix
106 working-directory: editors/code
108 - if: matrix.target == 'x86_64-unknown-linux-gnu' && github.ref != 'refs/heads/release'
109 run: npx vsce package -o ../../dist/rust-analyzer-no-server.vsix --pre-release
110 working-directory: editors/code
112 - name: Run analysis-stats on rust-analyzer
113 if: matrix.target == 'x86_64-unknown-linux-gnu'
114 run: target/${{ matrix.target }}/release/rust-analyzer analysis-stats .
116 - name: Run analysis-stats on rust std library
117 if: matrix.target == 'x86_64-unknown-linux-gnu'
118 run: target/${{ matrix.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-${{ matrix.target }}
126 dist-x86_64-unknown-linux-musl:
127 name: dist (x86_64-unknown-linux-musl)
128 runs-on: ubuntu-latest
130 RA_TARGET: x86_64-unknown-linux-musl
131 # For some reason `-crt-static` is not working for clang without lld
132 RUSTFLAGS: "-C link-arg=-fuse-ld=lld -C target-feature=-crt-static"
136 - /usr/local/cargo/registry:/usr/local/cargo/registry
139 - name: Install dependencies
140 run: apk add --no-cache git clang lld musl-dev nodejs npm
142 - name: Checkout repository
143 uses: actions/checkout@v3
145 fetch-depth: ${{ env.FETCH_DEPTH }}
148 run: cargo xtask dist --client-patch-version ${{ github.run_number }}
151 working-directory: editors/code
153 - name: Package Extension (release)
154 if: github.ref == 'refs/heads/release'
155 run: npx vsce package -o "../../dist/rust-analyzer-alpine-x64.vsix" --target alpine-x64
156 working-directory: editors/code
158 - name: Package Extension (nightly)
159 if: github.ref != 'refs/heads/release'
160 run: npx vsce package -o "../../dist/rust-analyzer-alpine-x64.vsix" --target alpine-x64 --pre-release
161 working-directory: editors/code
163 - run: rm -rf editors/code/server
165 - name: Upload artifacts
166 uses: actions/upload-artifact@v1
168 name: dist-x86_64-unknown-linux-musl
173 runs-on: ubuntu-latest
174 needs: ["dist", "dist-x86_64-unknown-linux-musl"]
176 - name: Install Nodejs
177 uses: actions/setup-node@v1
181 - run: echo "TAG=$(date --iso -u)" >> $GITHUB_ENV
182 if: github.ref == 'refs/heads/release'
183 - run: echo "TAG=nightly" >> $GITHUB_ENV
184 if: github.ref != 'refs/heads/release'
185 - run: 'echo "TAG: $TAG"'
187 - name: Checkout repository
188 uses: actions/checkout@v3
190 fetch-depth: ${{ env.FETCH_DEPTH }}
192 - run: echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
193 - run: 'echo "HEAD_SHA: $HEAD_SHA"'
195 - uses: actions/download-artifact@v1
197 name: dist-aarch64-apple-darwin
199 - uses: actions/download-artifact@v1
201 name: dist-x86_64-apple-darwin
203 - uses: actions/download-artifact@v1
205 name: dist-x86_64-unknown-linux-gnu
207 - uses: actions/download-artifact@v1
209 name: dist-x86_64-unknown-linux-musl
211 - uses: actions/download-artifact@v1
213 name: dist-aarch64-unknown-linux-gnu
215 - uses: actions/download-artifact@v1
217 name: dist-arm-unknown-linux-gnueabihf
219 - uses: actions/download-artifact@v1
221 name: dist-x86_64-pc-windows-msvc
223 - uses: actions/download-artifact@v1
225 name: dist-aarch64-pc-windows-msvc
229 - name: Publish Release
230 uses: ./.github/actions/github-release
234 token: ${{ secrets.GITHUB_TOKEN }}
236 - run: rm dist/rust-analyzer-no-server.vsix
239 working-directory: ./editors/code
241 - name: Publish Extension (Code Marketplace, release)
242 if: github.ref == 'refs/heads/release' && (github.repository == 'rust-analyzer/rust-analyzer' || github.repository == 'rust-lang/rust-analyzer')
243 working-directory: ./editors/code
244 # token from https://dev.azure.com/rust-analyzer/
245 run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer-*.vsix
247 - name: Publish Extension (OpenVSX, release)
248 if: github.ref == 'refs/heads/release' && (github.repository == 'rust-analyzer/rust-analyzer' || github.repository == 'rust-lang/rust-analyzer')
249 working-directory: ./editors/code
250 # token from https://dev.azure.com/rust-analyzer/
251 run: npx ovsx publish --pat ${{ secrets.OPENVSX_TOKEN }} --packagePath ../../dist/rust-analyzer-*.vsix
253 - name: Publish Extension (Code Marketplace, nightly)
254 if: github.ref != 'refs/heads/release' && (github.repository == 'rust-analyzer/rust-analyzer' || github.repository == 'rust-lang/rust-analyzer')
255 working-directory: ./editors/code
256 run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer-*.vsix
258 - name: Publish Extension (OpenVSX, nightly)
259 if: github.ref != 'refs/heads/release' && (github.repository == 'rust-analyzer/rust-analyzer' || github.repository == 'rust-lang/rust-analyzer')
260 working-directory: ./editors/code
261 run: npx ovsx publish --pat ${{ secrets.OPENVSX_TOKEN }} --packagePath ../../dist/rust-analyzer-*.vsix