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
37 container: ubuntu:18.04
39 target: aarch64-unknown-linux-gnu
40 code-target: linux-arm64
42 target: arm-unknown-linux-gnueabihf
43 code-target: linux-armhf
45 target: x86_64-apple-darwin
46 code-target: darwin-x64
48 target: aarch64-apple-darwin
49 code-target: darwin-arm64
51 name: dist (${{ matrix.target }})
52 runs-on: ${{ matrix.os }}
53 container: ${{ matrix.container }}
56 RA_TARGET: ${{ matrix.target }}
59 - name: Checkout repository
60 uses: actions/checkout@v3
62 fetch-depth: ${{ env.FETCH_DEPTH }}
64 - name: Install toolchain dependencies
65 if: matrix.container == 'ubuntu:18.04'
66 run: apt-get update && apt-get install -y build-essential curl
68 - name: Install Rust toolchain
69 uses: actions-rs/toolchain@v1
72 target: ${{ matrix.target }}
76 - name: Install Node.js
77 uses: actions/setup-node@v1
81 - name: Update apt repositories
82 if: matrix.target == 'aarch64-unknown-linux-gnu' || matrix.target == 'arm-unknown-linux-gnueabihf'
83 run: sudo apt-get update
85 - name: Install AArch64 target toolchain
86 if: matrix.target == 'aarch64-unknown-linux-gnu'
87 run: sudo apt-get install gcc-aarch64-linux-gnu
89 - name: Install ARM target toolchain
90 if: matrix.target == 'arm-unknown-linux-gnueabihf'
91 run: sudo apt-get install gcc-arm-linux-gnueabihf
94 run: cargo xtask dist --client-patch-version ${{ github.run_number }}
97 working-directory: editors/code
99 - name: Package Extension (release)
100 if: github.ref == 'refs/heads/release'
101 run: npx vsce package -o "../../dist/rust-analyzer-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }}
102 working-directory: editors/code
104 - name: Package Extension (nightly)
105 if: github.ref != 'refs/heads/release'
106 run: npx vsce package -o "../../dist/rust-analyzer-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }} --pre-release
107 working-directory: editors/code
109 - if: matrix.target == 'x86_64-unknown-linux-gnu'
110 run: rm -rf editors/code/server
112 - if: matrix.target == 'x86_64-unknown-linux-gnu' && github.ref == 'refs/heads/release'
113 run: npx vsce package -o ../../dist/rust-analyzer-no-server.vsix
114 working-directory: editors/code
116 - if: matrix.target == 'x86_64-unknown-linux-gnu' && github.ref != 'refs/heads/release'
117 run: npx vsce package -o ../../dist/rust-analyzer-no-server.vsix --pre-release
118 working-directory: editors/code
120 - name: Run analysis-stats on rust-analyzer
121 if: matrix.target == 'x86_64-unknown-linux-gnu'
122 run: target/${{ matrix.target }}/release/rust-analyzer analysis-stats .
124 - name: Run analysis-stats on rust std library
125 if: matrix.target == 'x86_64-unknown-linux-gnu'
126 run: target/${{ matrix.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-${{ matrix.target }}
134 dist-x86_64-unknown-linux-musl:
135 name: dist (x86_64-unknown-linux-musl)
136 runs-on: ubuntu-latest
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:/usr/local/cargo/registry
147 - name: Install dependencies
148 run: apk add --no-cache git clang lld musl-dev nodejs npm
150 - name: Checkout repository
151 uses: actions/checkout@v3
153 fetch-depth: ${{ env.FETCH_DEPTH }}
156 run: cargo xtask dist --client-patch-version ${{ github.run_number }}
159 working-directory: editors/code
161 - name: Package Extension (release)
162 if: github.ref == 'refs/heads/release'
163 run: npx vsce package -o "../../dist/rust-analyzer-alpine-x64.vsix" --target alpine-x64
164 working-directory: editors/code
166 - name: Package Extension (nightly)
167 if: github.ref != 'refs/heads/release'
168 run: npx vsce package -o "../../dist/rust-analyzer-alpine-x64.vsix" --target alpine-x64 --pre-release
169 working-directory: editors/code
171 - run: rm -rf editors/code/server
173 - name: Upload artifacts
174 uses: actions/upload-artifact@v1
176 name: dist-x86_64-unknown-linux-musl
181 runs-on: ubuntu-latest
182 needs: ["dist", "dist-x86_64-unknown-linux-musl"]
184 - name: Install Nodejs
185 uses: actions/setup-node@v1
189 - run: echo "TAG=$(date --iso -u)" >> $GITHUB_ENV
190 if: github.ref == 'refs/heads/release'
191 - run: echo "TAG=nightly" >> $GITHUB_ENV
192 if: github.ref != 'refs/heads/release'
193 - run: 'echo "TAG: $TAG"'
195 - name: Checkout repository
196 uses: actions/checkout@v3
198 fetch-depth: ${{ env.FETCH_DEPTH }}
200 - run: echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
201 - run: 'echo "HEAD_SHA: $HEAD_SHA"'
203 - uses: actions/download-artifact@v1
205 name: dist-aarch64-apple-darwin
207 - uses: actions/download-artifact@v1
209 name: dist-x86_64-apple-darwin
211 - uses: actions/download-artifact@v1
213 name: dist-x86_64-unknown-linux-gnu
215 - uses: actions/download-artifact@v1
217 name: dist-x86_64-unknown-linux-musl
219 - uses: actions/download-artifact@v1
221 name: dist-aarch64-unknown-linux-gnu
223 - uses: actions/download-artifact@v1
225 name: dist-arm-unknown-linux-gnueabihf
227 - uses: actions/download-artifact@v1
229 name: dist-x86_64-pc-windows-msvc
231 - uses: actions/download-artifact@v1
233 name: dist-aarch64-pc-windows-msvc
237 - name: Publish Release
238 uses: ./.github/actions/github-release
242 token: ${{ secrets.GITHUB_TOKEN }}
244 - run: rm dist/rust-analyzer-no-server.vsix
247 working-directory: ./editors/code
249 - name: Publish Extension (Code Marketplace, release)
250 if: github.ref == 'refs/heads/release' && (github.repository == 'rust-analyzer/rust-analyzer' || github.repository == 'rust-lang/rust-analyzer')
251 working-directory: ./editors/code
252 # token from https://dev.azure.com/rust-analyzer/
253 run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer-*.vsix
255 - name: Publish Extension (OpenVSX, release)
256 if: github.ref == 'refs/heads/release' && (github.repository == 'rust-analyzer/rust-analyzer' || github.repository == 'rust-lang/rust-analyzer')
257 working-directory: ./editors/code
258 # token from https://dev.azure.com/rust-analyzer/
259 run: npx ovsx publish --pat ${{ secrets.OPENVSX_TOKEN }} --packagePath ../../dist/rust-analyzer-*.vsix || true
261 - name: Publish Extension (Code Marketplace, nightly)
262 if: github.ref != 'refs/heads/release' && (github.repository == 'rust-analyzer/rust-analyzer' || github.repository == 'rust-lang/rust-analyzer')
263 working-directory: ./editors/code
264 run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer-*.vsix
266 - name: Publish Extension (OpenVSX, nightly)
267 if: github.ref != 'refs/heads/release' && (github.repository == 'rust-analyzer/rust-analyzer' || github.repository == 'rust-lang/rust-analyzer')
268 working-directory: ./editors/code
269 run: npx ovsx publish --pat ${{ secrets.OPENVSX_TOKEN }} --packagePath ../../dist/rust-analyzer-*.vsix || true