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@v3
56 fetch-depth: ${{ env.FETCH_DEPTH }}
58 - name: Install Rust toolchain
60 rustup update --no-self-update stable
61 rustup target add ${{ matrix.target }}
62 rustup component add rust-src
64 - name: Install Node.js
65 uses: actions/setup-node@v1
69 - name: Update apt repositories
70 if: matrix.target == 'aarch64-unknown-linux-gnu'
71 run: sudo apt-get update
73 - name: Install target toolchain
74 if: matrix.target == 'aarch64-unknown-linux-gnu'
75 run: sudo apt-get install gcc-aarch64-linux-gnu
78 run: cargo xtask dist --client-patch-version ${{ github.run_number }}
81 working-directory: editors/code
83 - name: Package Extension (release)
84 if: github.ref == 'refs/heads/release'
85 run: npx vsce package -o "../../dist/rust-analyzer-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }}
86 working-directory: editors/code
88 - name: Package Extension (nightly)
89 if: github.ref != 'refs/heads/release'
90 run: npx vsce package -o "../../dist/rust-analyzer-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }} --pre-release
91 working-directory: editors/code
93 - if: matrix.target == 'x86_64-unknown-linux-gnu'
94 run: rm -rf editors/code/server
96 - if: matrix.target == 'x86_64-unknown-linux-gnu' && github.ref == 'refs/heads/release'
97 run: npx vsce package -o ../../dist/rust-analyzer-no-server.vsix
98 working-directory: editors/code
100 - if: matrix.target == 'x86_64-unknown-linux-gnu' && github.ref != 'refs/heads/release'
101 run: npx vsce package -o ../../dist/rust-analyzer-no-server.vsix --pre-release
102 working-directory: editors/code
104 - name: Run analysis-stats on rust-analyzer
105 if: matrix.target == 'x86_64-unknown-linux-gnu'
106 run: target/${{ matrix.target }}/release/rust-analyzer analysis-stats .
108 - name: Run analysis-stats on rust std library
109 if: matrix.target == 'x86_64-unknown-linux-gnu'
110 run: target/${{ matrix.target }}/release/rust-analyzer analysis-stats --with-deps $(rustc --print sysroot)/lib/rustlib/src/rust/library/std
112 - name: Upload artifacts
113 uses: actions/upload-artifact@v1
115 name: dist-${{ matrix.target }}
118 dist-x86_64-unknown-linux-musl:
119 name: dist (x86_64-unknown-linux-musl)
120 runs-on: ubuntu-latest
122 RA_TARGET: x86_64-unknown-linux-musl
123 # For some reason `-crt-static` is not working for clang without lld
124 RUSTFLAGS: "-C link-arg=-fuse-ld=lld -C target-feature=-crt-static"
128 - /usr/local/cargo/registry
131 - name: Install dependencies
132 run: apk add --no-cache git clang lld musl-dev nodejs npm
134 - name: Checkout repository
135 uses: actions/checkout@v3
137 fetch-depth: ${{ env.FETCH_DEPTH }}
140 run: cargo xtask dist --client-patch-version ${{ github.run_number }}
143 working-directory: editors/code
145 - name: Package Extension (release)
146 if: github.ref == 'refs/heads/release'
147 run: npx vsce package -o "../../dist/rust-analyzer-alpine-x64.vsix" --target alpine-x64
148 working-directory: editors/code
150 - name: Package Extension (nightly)
151 if: github.ref != 'refs/heads/release'
152 run: npx vsce package -o "../../dist/rust-analyzer-alpine-x64.vsix" --target alpine-x64 --pre-release
153 working-directory: editors/code
155 - run: rm -rf editors/code/server
157 - name: Upload artifacts
158 uses: actions/upload-artifact@v1
160 name: dist-x86_64-unknown-linux-musl
165 runs-on: ubuntu-latest
166 needs: ["dist", "dist-x86_64-unknown-linux-musl"]
168 - name: Install Nodejs
169 uses: actions/setup-node@v1
173 - run: echo "TAG=$(date --iso -u)" >> $GITHUB_ENV
174 if: github.ref == 'refs/heads/release'
175 - run: echo "TAG=nightly" >> $GITHUB_ENV
176 if: github.ref != 'refs/heads/release'
177 - run: 'echo "TAG: $TAG"'
179 - name: Checkout repository
180 uses: actions/checkout@v3
182 fetch-depth: ${{ env.FETCH_DEPTH }}
184 - run: echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
185 - run: 'echo "HEAD_SHA: $HEAD_SHA"'
187 - uses: actions/download-artifact@v1
189 name: dist-aarch64-apple-darwin
191 - uses: actions/download-artifact@v1
193 name: dist-x86_64-apple-darwin
195 - uses: actions/download-artifact@v1
197 name: dist-x86_64-unknown-linux-gnu
199 - uses: actions/download-artifact@v1
201 name: dist-x86_64-unknown-linux-musl
203 - uses: actions/download-artifact@v1
205 name: dist-aarch64-unknown-linux-gnu
207 - uses: actions/download-artifact@v1
209 name: dist-x86_64-pc-windows-msvc
211 - uses: actions/download-artifact@v1
213 name: dist-aarch64-pc-windows-msvc
217 - name: Publish Release
218 uses: ./.github/actions/github-release
222 token: ${{ secrets.GITHUB_TOKEN }}
224 - run: rm dist/rust-analyzer-no-server.vsix
227 working-directory: ./editors/code
229 - name: Publish Extension (Code Marketplace, release)
230 if: github.ref == 'refs/heads/release' && (github.repository == 'rust-analyzer/rust-analyzer' || github.repository == 'rust-lang/rust-analyzer')
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
235 - name: Publish Extension (OpenVSX, release)
236 if: github.ref == 'refs/heads/release' && (github.repository == 'rust-analyzer/rust-analyzer' || github.repository == 'rust-lang/rust-analyzer')
237 working-directory: ./editors/code
238 # token from https://dev.azure.com/rust-analyzer/
239 run: npx ovsx publish --pat ${{ secrets.OPENVSX_TOKEN }} --packagePath ../../dist/rust-analyzer-*.vsix
241 - name: Publish Extension (Code Marketplace, nightly)
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 run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer-*.vsix --pre-release
246 - name: Publish Extension (OpenVSX, nightly)
247 if: github.ref != 'refs/heads/release' && (github.repository == 'rust-analyzer/rust-analyzer' || github.repository == 'rust-lang/rust-analyzer')
248 working-directory: ./editors/code
249 run: npx ovsx publish --pat ${{ secrets.OPENVSX_TOKEN }} --packagePath ../../dist/rust-analyzer-*.vsix --pre-release