]> git.lizzy.rs Git - rust.git/blob - .github/workflows/release.yaml
Really switch XCode version
[rust.git] / .github / workflows / release.yaml
1 name: release
2 on:
3   schedule:
4   - cron: '0 0 * * *' # midnight UTC
5   
6   workflow_dispatch:
7
8   push:
9     branches:
10     - release
11     - trigger-nightly
12
13 env:
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
20 jobs:
21   dist-x86_64-pc-windows-msvc:
22     name: dist (x86_64-pc-windows-msvc)
23     runs-on: windows-latest
24     env:
25       RA_TARGET: x86_64-pc-windows-msvc
26
27     steps:
28     - name: Checkout repository
29       uses: actions/checkout@v2
30       with:
31         fetch-depth: ${{ env.FETCH_DEPTH }}
32
33     # We need to disable the existing toolchain to avoid updating rust-docs
34     # which takes a long time. The fastest way to do this is to rename the
35     # existing folder, as deleting it takes about as much time as not doing
36     # anything and just updating rust-docs.
37     - name: Rename existing rust toolchain
38       run: Rename-Item C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc.old
39
40     - name: Install Rust toolchain
41       uses: actions-rs/toolchain@v1
42       with:
43         toolchain: stable
44         profile: minimal
45         override: true
46
47     - name: Dist
48       run: cargo xtask dist
49
50     - name: Upload artifacts
51       uses: actions/upload-artifact@v1
52       with:
53         name: dist-x86_64-pc-windows-msvc
54         path: ./dist
55
56   dist-aarch64-pc-windows-msvc:
57     name: dist (aarch64-pc-windows-msvc)
58     runs-on: windows-latest
59     env:
60       RA_TARGET: aarch64-pc-windows-msvc
61
62     steps:
63     - name: Checkout repository
64       uses: actions/checkout@v2
65       with:
66         fetch-depth: ${{ env.FETCH_DEPTH }}
67
68     - name: Rename existing rust toolchain
69       run: Rename-Item C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc.old
70
71     - name: Install Rust toolchain
72       uses: actions-rs/toolchain@v1
73       with:
74         toolchain: stable
75         target: aarch64-pc-windows-msvc
76         profile: minimal
77         override: true
78
79     - name: Dist
80       run: cargo xtask dist
81
82     - name: Upload artifacts
83       uses: actions/upload-artifact@v1
84       with:
85         name: dist-aarch64-pc-windows-msvc
86         path: ./dist
87
88   dist-x86_64-unknown-linux-gnu:
89     name: dist (x86_64-unknown-linux-gnu)
90     runs-on: ubuntu-20.04
91     env:
92       RA_TARGET: x86_64-unknown-linux-gnu
93
94     steps:
95     - name: Checkout repository
96       uses: actions/checkout@v2
97       with:
98         fetch-depth: ${{ env.FETCH_DEPTH }}
99
100     - name: Install Rust toolchain
101       uses: actions-rs/toolchain@v1
102       with:
103         toolchain: stable
104         profile: minimal
105         override: true
106         components: rust-src
107
108     - name: Install Nodejs
109       uses: actions/setup-node@v1
110       with:
111         node-version: 14.x
112
113     - name: Dist
114       run: cargo xtask dist --client-patch-version $GITHUB_RUN_NUMBER
115
116     - name: Run analysis-stats on rust-analyzer
117       run: target/${{ env.RA_TARGET }}/release/rust-analyzer analysis-stats .
118
119     - name: Run analysis-stats on rust std library
120       run: target/${{ env.RA_TARGET }}/release/rust-analyzer analysis-stats --with-deps $(rustc --print sysroot)/lib/rustlib/src/rust/library/std
121
122     - name: Upload artifacts
123       uses: actions/upload-artifact@v1
124       with:
125         name: dist-x86_64-unknown-linux-gnu
126         path: ./dist
127
128   dist-aarch64-unknown-linux-gnu:
129     name: dist (aarch64-unknown-linux-gnu)
130     runs-on: ubuntu-20.04
131     env:
132       RA_TARGET: aarch64-unknown-linux-gnu
133       CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
134
135     steps:
136     - name: Checkout repository
137       uses: actions/checkout@v2
138       with:
139         fetch-depth: ${{ env.FETCH_DEPTH }}
140
141     - name: Install Rust toolchain
142       uses: actions-rs/toolchain@v1
143       with:
144         toolchain: stable
145         target: aarch64-unknown-linux-gnu
146         profile: minimal
147         override: true
148
149     - name: Update apt repositories
150       run: sudo apt-get update
151
152     - name: Install target toolchain
153       run: sudo apt-get install gcc-aarch64-linux-gnu
154
155     - name: Dist
156       run: cargo xtask dist
157
158     - name: Upload artifacts
159       uses: actions/upload-artifact@v1
160       with:
161         name: dist-aarch64-unknown-linux-gnu
162         path: ./dist
163
164   dist-x86_64-unknown-linux-musl:
165     name: dist (x86_64-unknown-linux-musl)
166     runs-on: ubuntu-latest
167     env:
168       RA_TARGET: x86_64-unknown-linux-musl
169       # For some reason `-crt-static` is not working for clang without lld
170       RUSTFLAGS: "-C link-arg=-fuse-ld=lld -C target-feature=-crt-static"
171     container:
172       image: rust:alpine
173       volumes:
174       - /usr/local/cargo/registry
175
176     steps:
177     - name: Install dependencies
178       run: apk add --no-cache git clang lld musl-dev
179
180     - name: Checkout repository
181       uses: actions/checkout@v2
182       with:
183         fetch-depth: ${{ env.FETCH_DEPTH }}
184
185     - name: Dist
186       run: cargo xtask dist
187
188     - name: Upload artifacts
189       uses: actions/upload-artifact@v1
190       with:
191         name: dist-x86_64-unknown-linux-musl
192         path: ./dist
193
194   dist-x86_64-apple-darwin:
195     name: dist (x86_64-apple-darwin)
196     runs-on: macos-latest
197     env:
198       RA_TARGET: x86_64-apple-darwin
199 #      SELECT_XCODE: /Applications/Xcode_12.2.app
200
201     steps:
202 # use the default (12.5.1 as of today)
203 #    - name: Select XCode version
204 #      run: sudo xcode-select -s "${SELECT_XCODE}"
205
206     - name: Checkout repository
207       uses: actions/checkout@v2
208       with:
209         fetch-depth: ${{ env.FETCH_DEPTH }}
210
211     - name: Install Rust toolchain
212       uses: actions-rs/toolchain@v1
213       with:
214         toolchain: stable
215         profile: minimal
216         override: true
217
218     - name: Dist
219       run: cargo xtask dist
220
221     - name: Upload artifacts
222       uses: actions/upload-artifact@v1
223       with:
224         name: dist-x86_64-apple-darwin
225         path: ./dist
226
227   dist-aarch64-apple-darwin:
228     name: dist (aarch64-apple-darwin)
229     runs-on: macos-latest
230     env:
231       RA_TARGET: aarch64-apple-darwin
232 #      SELECT_XCODE: /Applications/Xcode_12.2.app
233
234     steps:
235 #    - name: Select XCode version
236 #      run: sudo xcode-select -s "${SELECT_XCODE}"
237
238     - name: Checkout repository
239       uses: actions/checkout@v2
240       with:
241         fetch-depth: ${{ env.FETCH_DEPTH }}
242
243     - name: Install Rust toolchain
244       uses: actions-rs/toolchain@v1
245       with:
246         toolchain: stable
247         target: aarch64-apple-darwin
248         profile: minimal
249         override: true
250
251     - name: Dist
252       run: SDKROOT=$(xcrun -sdk macosx11.0 --show-sdk-path) MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx11.0 --show-sdk-platform-version) cargo xtask dist
253
254     - name: Upload artifacts
255       uses: actions/upload-artifact@v1
256       with:
257         name: dist-aarch64-apple-darwin
258         path: ./dist
259
260   publish:
261     name: publish
262     runs-on: ubuntu-latest
263     needs: ['dist-x86_64-pc-windows-msvc', 'dist-aarch64-pc-windows-msvc', 'dist-x86_64-unknown-linux-gnu', 'dist-x86_64-unknown-linux-musl', 'dist-aarch64-unknown-linux-gnu', 'dist-x86_64-apple-darwin', 'dist-aarch64-apple-darwin']
264     steps:
265     - name: Install Nodejs
266       uses: actions/setup-node@v1
267       with:
268         node-version: 14.x
269
270     - run: echo "TAG=$(date --iso -u)" >> $GITHUB_ENV
271       if: github.ref == 'refs/heads/release'
272     - run: echo "TAG=nightly" >> $GITHUB_ENV
273       if: github.ref != 'refs/heads/release'
274     - run: 'echo "TAG: $TAG"'
275
276     - name: Checkout repository
277       uses: actions/checkout@v2
278       with:
279         fetch-depth: ${{ env.FETCH_DEPTH }}
280
281     - run: echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
282     - run: 'echo "HEAD_SHA: $HEAD_SHA"'
283
284     - uses: actions/download-artifact@v1
285       with:
286         name: dist-aarch64-apple-darwin
287         path: dist
288     - uses: actions/download-artifact@v1
289       with:
290         name: dist-x86_64-apple-darwin
291         path: dist
292     - uses: actions/download-artifact@v1
293       with:
294         name: dist-x86_64-unknown-linux-gnu
295         path: dist
296     - uses: actions/download-artifact@v1
297       with:
298         name: dist-x86_64-unknown-linux-musl
299         path: dist
300     - uses: actions/download-artifact@v1
301       with:
302         name: dist-aarch64-unknown-linux-gnu
303         path: dist
304     - uses: actions/download-artifact@v1
305       with:
306         name: dist-x86_64-pc-windows-msvc
307         path: dist
308     - uses: actions/download-artifact@v1
309       with:
310         name: dist-aarch64-pc-windows-msvc
311         path: dist
312     - run: ls -al ./dist
313
314     - name: Publish Release
315       uses: ./.github/actions/github-release
316       with:
317         files: "dist/*"
318         name: ${{ env.TAG }}
319         token: ${{ secrets.GITHUB_TOKEN }}
320
321     - run: npm ci
322       working-directory: ./editors/code
323
324     - name: Publish Extension
325       if: github.ref == 'refs/heads/release'
326       working-directory: ./editors/code
327       # token from https://dev.azure.com/rust-analyzer/
328       run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer.vsix