fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
9.8 KiB281 linesraw
1name: release
2on:
3  schedule:
4    - cron: "0 0 * * *" # midnight UTC
5
6  workflow_dispatch:
7
8  push:
9    branches:
10      - release
11      - trigger-nightly
12
13env:
14  CARGO_INCREMENTAL: 0
15  CARGO_NET_RETRY: 10
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
22
23jobs:
24  dist:
25    strategy:
26      matrix:
27        include:
28          - os: windows-latest
29            target: x86_64-pc-windows-msvc
30            code-target: win32-x64
31          - os: windows-latest
32            target: i686-pc-windows-msvc
33            code-target: win32-ia32
34          - os: windows-latest
35            target: aarch64-pc-windows-msvc
36            code-target: win32-arm64
37          - os: ubuntu-20.04
38            target: x86_64-unknown-linux-gnu
39            code-target: linux-x64
40            container: ubuntu:18.04
41          - os: ubuntu-20.04
42            target: aarch64-unknown-linux-gnu
43            code-target: linux-arm64
44          - os: ubuntu-20.04
45            target: arm-unknown-linux-gnueabihf
46            code-target: linux-armhf
47          - os: macos-11
48            target: x86_64-apple-darwin
49            code-target: darwin-x64
50          - os: macos-11
51            target: aarch64-apple-darwin
52            code-target: darwin-arm64
53
54    name: dist (${{ matrix.target }})
55    runs-on: ${{ matrix.os }}
56    container: ${{ matrix.container }}
57
58    env:
59      RA_TARGET: ${{ matrix.target }}
60
61    steps:
62      - name: Checkout repository
63        uses: actions/checkout@v3
64        with:
65          fetch-depth: ${{ env.FETCH_DEPTH }}
66
67      - name: Install toolchain dependencies
68        if: matrix.container == 'ubuntu:18.04'
69        shell: bash
70        run: |
71          apt-get update && apt-get install -y build-essential curl
72          curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL "https://sh.rustup.rs" | sh -s -- --profile minimal --default-toolchain none -y
73          echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH
74
75      - name: Install Rust toolchain
76        run: |
77          rustup update --no-self-update stable
78          rustup target add ${{ matrix.target }}
79          rustup component add rust-src
80
81      - name: Install Node.js
82        uses: actions/setup-node@v3
83        with:
84          node-version: 16
85
86      - name: Update apt repositories
87        if: matrix.target == 'aarch64-unknown-linux-gnu' || matrix.target == 'arm-unknown-linux-gnueabihf'
88        run: sudo apt-get update
89
90      - name: Install AArch64 target toolchain
91        if: matrix.target == 'aarch64-unknown-linux-gnu'
92        run: sudo apt-get install gcc-aarch64-linux-gnu
93
94      - name: Install ARM target toolchain
95        if: matrix.target == 'arm-unknown-linux-gnueabihf'
96        run: sudo apt-get install gcc-arm-linux-gnueabihf
97
98      - name: Dist
99        run: cargo xtask dist --client-patch-version ${{ github.run_number }}
100
101      - run: npm ci
102        working-directory: editors/code
103
104      - name: Package Extension (release)
105        if: github.ref == 'refs/heads/release'
106        run: npx vsce package -o "../../dist/rust-analyzer-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }}
107        working-directory: editors/code
108
109      - name: Package Extension (nightly)
110        if: github.ref != 'refs/heads/release'
111        run: npx vsce package -o "../../dist/rust-analyzer-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }} --pre-release
112        working-directory: editors/code
113
114      - if: matrix.target == 'x86_64-unknown-linux-gnu'
115        run: rm -rf editors/code/server
116
117      - if: matrix.target == 'x86_64-unknown-linux-gnu' && github.ref == 'refs/heads/release'
118        run: npx vsce package -o ../../dist/rust-analyzer-no-server.vsix
119        working-directory: editors/code
120
121      - if: matrix.target == 'x86_64-unknown-linux-gnu' && github.ref != 'refs/heads/release'
122        run: npx vsce package -o ../../dist/rust-analyzer-no-server.vsix --pre-release
123        working-directory: editors/code
124
125      - name: Run analysis-stats on rust-analyzer
126        if: matrix.target == 'x86_64-unknown-linux-gnu'
127        run: target/${{ matrix.target }}/release/rust-analyzer analysis-stats .
128
129      - name: Run analysis-stats on rust std library
130        if: matrix.target == 'x86_64-unknown-linux-gnu'
131        env:
132          RUSTC_BOOTSTRAP: 1
133        run: target/${{ matrix.target }}/release/rust-analyzer analysis-stats --with-deps $(rustc --print sysroot)/lib/rustlib/src/rust/library/std
134
135      - name: Upload artifacts
136        uses: actions/upload-artifact@v1
137        with:
138          name: dist-${{ matrix.target }}
139          path: ./dist
140
141  dist-x86_64-unknown-linux-musl:
142    name: dist (x86_64-unknown-linux-musl)
143    runs-on: ubuntu-latest
144    env:
145      RA_TARGET: x86_64-unknown-linux-musl
146      # For some reason `-crt-static` is not working for clang without lld
147      RUSTFLAGS: "-C link-arg=-fuse-ld=lld -C target-feature=-crt-static"
148    container:
149      image: rust:alpine
150      volumes:
151        - /usr/local/cargo/registry:/usr/local/cargo/registry
152
153    steps:
154      - name: Install dependencies
155        run: apk add --no-cache git clang lld musl-dev nodejs npm
156
157      - name: Checkout repository
158        uses: actions/checkout@v3
159        with:
160          fetch-depth: ${{ env.FETCH_DEPTH }}
161
162      - name: Dist
163        run: cargo xtask dist --client-patch-version ${{ github.run_number }}
164
165      - run: npm ci
166        working-directory: editors/code
167
168      - name: Package Extension (release)
169        if: github.ref == 'refs/heads/release'
170        run: npx vsce package -o "../../dist/rust-analyzer-alpine-x64.vsix" --target alpine-x64
171        working-directory: editors/code
172
173      - name: Package Extension (nightly)
174        if: github.ref != 'refs/heads/release'
175        run: npx vsce package -o "../../dist/rust-analyzer-alpine-x64.vsix" --target alpine-x64 --pre-release
176        working-directory: editors/code
177
178      - run: rm -rf editors/code/server
179
180      - name: Upload artifacts
181        uses: actions/upload-artifact@v1
182        with:
183          name: dist-x86_64-unknown-linux-musl
184          path: ./dist
185
186  publish:
187    name: publish
188    runs-on: ubuntu-latest
189    needs: ["dist", "dist-x86_64-unknown-linux-musl"]
190    steps:
191      - name: Install Nodejs
192        uses: actions/setup-node@v3
193        with:
194          node-version: 16
195
196      - run: echo "TAG=$(date --iso -u)" >> $GITHUB_ENV
197        if: github.ref == 'refs/heads/release'
198      - run: echo "TAG=nightly" >> $GITHUB_ENV
199        if: github.ref != 'refs/heads/release'
200      - run: 'echo "TAG: $TAG"'
201
202      - name: Checkout repository
203        uses: actions/checkout@v3
204        with:
205          fetch-depth: ${{ env.FETCH_DEPTH }}
206
207      - run: echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
208      - run: 'echo "HEAD_SHA: $HEAD_SHA"'
209
210      - uses: actions/download-artifact@v1
211        with:
212          name: dist-aarch64-apple-darwin
213          path: dist
214      - uses: actions/download-artifact@v1
215        with:
216          name: dist-x86_64-apple-darwin
217          path: dist
218      - uses: actions/download-artifact@v1
219        with:
220          name: dist-x86_64-unknown-linux-gnu
221          path: dist
222      - uses: actions/download-artifact@v1
223        with:
224          name: dist-x86_64-unknown-linux-musl
225          path: dist
226      - uses: actions/download-artifact@v1
227        with:
228          name: dist-aarch64-unknown-linux-gnu
229          path: dist
230      - uses: actions/download-artifact@v1
231        with:
232          name: dist-arm-unknown-linux-gnueabihf
233          path: dist
234      - uses: actions/download-artifact@v1
235        with:
236          name: dist-x86_64-pc-windows-msvc
237          path: dist
238      - uses: actions/download-artifact@v1
239        with:
240          name: dist-i686-pc-windows-msvc
241          path: dist
242      - uses: actions/download-artifact@v1
243        with:
244          name: dist-aarch64-pc-windows-msvc
245          path: dist
246      - run: ls -al ./dist
247
248      - name: Publish Release
249        uses: ./.github/actions/github-release
250        with:
251          files: "dist/*"
252          name: ${{ env.TAG }}
253          token: ${{ secrets.GITHUB_TOKEN }}
254
255      - run: rm dist/rust-analyzer-no-server.vsix
256
257      - run: npm ci
258        working-directory: ./editors/code
259
260      - name: Publish Extension (Code Marketplace, release)
261        if: github.ref == 'refs/heads/release' && (github.repository == 'rust-analyzer/rust-analyzer' || github.repository == 'rust-lang/rust-analyzer')
262        working-directory: ./editors/code
263        # token from https://dev.azure.com/rust-analyzer/
264        run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer-*.vsix
265
266      - name: Publish Extension (OpenVSX, release)
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
270        timeout-minutes: 2
271
272      - name: Publish Extension (Code Marketplace, nightly)
273        if: github.ref != 'refs/heads/release' && (github.repository == 'rust-analyzer/rust-analyzer' || github.repository == 'rust-lang/rust-analyzer')
274        working-directory: ./editors/code
275        run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer-*.vsix --pre-release
276
277      - name: Publish Extension (OpenVSX, nightly)
278        if: github.ref != 'refs/heads/release' && (github.repository == 'rust-analyzer/rust-analyzer' || github.repository == 'rust-lang/rust-analyzer')
279        working-directory: ./editors/code
280        run: npx ovsx publish --pat ${{ secrets.OPENVSX_TOKEN }} --packagePath ../../dist/rust-analyzer-*.vsix
281        timeout-minutes: 2