fork/rust-analyzer

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

borsAuto merge of #12920 - jonas-schievink:arm-release, r=jonas-schievink8e38833c36

master
9.1 KiB261 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: aarch64-pc-windows-msvc
33            code-target: win32-arm64
34          - os: ubuntu-18.04
35            target: x86_64-unknown-linux-gnu
36            code-target: linux-x64
37          - os: ubuntu-18.04
38            target: aarch64-unknown-linux-gnu
39            code-target: linux-arm64
40          - os: ubuntu-18.04
41            target: arm-unknown-linux-gnueabihf
42            code-target: linux-armhf
43          - os: macos-11
44            target: x86_64-apple-darwin
45            code-target: darwin-x64
46          - os: macos-11
47            target: aarch64-apple-darwin
48            code-target: darwin-arm64
49
50    name: dist (${{ matrix.target }})
51    runs-on: ${{ matrix.os }}
52
53    env:
54      RA_TARGET: ${{ matrix.target }}
55
56    steps:
57      - name: Checkout repository
58        uses: actions/checkout@v3
59        with:
60          fetch-depth: ${{ env.FETCH_DEPTH }}
61
62      - name: Install Rust toolchain
63        run: |
64          rustup update --no-self-update stable
65          rustup target add ${{ matrix.target }}
66          rustup component add rust-src
67
68      - name: Install Node.js
69        uses: actions/setup-node@v1
70        with:
71          node-version: 14.x
72
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
76
77      - name: Install AArch64 target toolchain
78        if: matrix.target == 'aarch64-unknown-linux-gnu'
79        run: sudo apt-get install gcc-aarch64-linux-gnu
80
81      - name: Install ARM target toolchain
82        if: matrix.target == 'arm-unknown-linux-gnueabihf'
83        run: sudo apt-get install gcc-arm-linux-gnueabihf
84
85      - name: Dist
86        run: cargo xtask dist --client-patch-version ${{ github.run_number }}
87
88      - run: npm ci
89        working-directory: editors/code
90
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
95
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
100
101      - if: matrix.target == 'x86_64-unknown-linux-gnu'
102        run: rm -rf editors/code/server
103
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
107
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
111
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 .
115
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
119
120      - name: Upload artifacts
121        uses: actions/upload-artifact@v1
122        with:
123          name: dist-${{ matrix.target }}
124          path: ./dist
125
126  dist-x86_64-unknown-linux-musl:
127    name: dist (x86_64-unknown-linux-musl)
128    runs-on: ubuntu-latest
129    env:
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"
133    container:
134      image: rust:alpine
135      volumes:
136        - /usr/local/cargo/registry
137
138    steps:
139      - name: Install dependencies
140        run: apk add --no-cache git clang lld musl-dev nodejs npm
141
142      - name: Checkout repository
143        uses: actions/checkout@v3
144        with:
145          fetch-depth: ${{ env.FETCH_DEPTH }}
146
147      - name: Dist
148        run: cargo xtask dist --client-patch-version ${{ github.run_number }}
149
150      - run: npm ci
151        working-directory: editors/code
152
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
157
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
162
163      - run: rm -rf editors/code/server
164
165      - name: Upload artifacts
166        uses: actions/upload-artifact@v1
167        with:
168          name: dist-x86_64-unknown-linux-musl
169          path: ./dist
170
171  publish:
172    name: publish
173    runs-on: ubuntu-latest
174    needs: ["dist", "dist-x86_64-unknown-linux-musl"]
175    steps:
176      - name: Install Nodejs
177        uses: actions/setup-node@v1
178        with:
179          node-version: 14.x
180
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"'
186
187      - name: Checkout repository
188        uses: actions/checkout@v3
189        with:
190          fetch-depth: ${{ env.FETCH_DEPTH }}
191
192      - run: echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
193      - run: 'echo "HEAD_SHA: $HEAD_SHA"'
194
195      - uses: actions/download-artifact@v1
196        with:
197          name: dist-aarch64-apple-darwin
198          path: dist
199      - uses: actions/download-artifact@v1
200        with:
201          name: dist-x86_64-apple-darwin
202          path: dist
203      - uses: actions/download-artifact@v1
204        with:
205          name: dist-x86_64-unknown-linux-gnu
206          path: dist
207      - uses: actions/download-artifact@v1
208        with:
209          name: dist-x86_64-unknown-linux-musl
210          path: dist
211      - uses: actions/download-artifact@v1
212        with:
213          name: dist-aarch64-unknown-linux-gnu
214          path: dist
215      - uses: actions/download-artifact@v1
216        with:
217          name: dist-arm-unknown-linux-gnueabihf
218          path: dist
219      - uses: actions/download-artifact@v1
220        with:
221          name: dist-x86_64-pc-windows-msvc
222          path: dist
223      - uses: actions/download-artifact@v1
224        with:
225          name: dist-aarch64-pc-windows-msvc
226          path: dist
227      - run: ls -al ./dist
228
229      - name: Publish Release
230        uses: ./.github/actions/github-release
231        with:
232          files: "dist/*"
233          name: ${{ env.TAG }}
234          token: ${{ secrets.GITHUB_TOKEN }}
235
236      - run: rm dist/rust-analyzer-no-server.vsix
237
238      - run: npm ci
239        working-directory: ./editors/code
240
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
246
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
252
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 --pre-release
257
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 --pre-release