]> git.lizzy.rs Git - rust.git/blob - .github/workflows/release.yaml
Merge #7353
[rust.git] / .github / workflows / release.yaml
1 name: release
2 on:
3   schedule:
4   - cron: '0 0 * * *' # midnight UTC
5
6   push:
7     branches:
8     - release
9     - trigger-nightly
10
11 env:
12   CARGO_INCREMENTAL: 0
13   CARGO_NET_RETRY: 10
14   RUSTFLAGS: "-D warnings -W unreachable-pub"
15   RUSTUP_MAX_RETRIES: 10
16
17 jobs:
18   dist-x86_64-pc-windows-msvc:
19     name: dist (x86_64-pc-windows-msvc)
20     runs-on: windows-latest
21     env:
22       RA_TARGET: x86_64-pc-windows-msvc
23
24     steps:
25     - name: Checkout repository
26       uses: actions/checkout@v2
27
28     # We need to disable the existing toolchain to avoid updating rust-docs
29     # which takes a long time. The fastest way to do this is to rename the
30     # existing folder, as deleting it takes about as much time as not doing
31     # anything and just updating rust-docs.
32     - name: Rename existing rust toolchain
33       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
34
35     - name: Install Rust toolchain
36       uses: actions-rs/toolchain@v1
37       with:
38         toolchain: stable
39         profile: minimal
40         override: true
41
42     - name: Dist
43       run: cargo xtask dist
44
45     - name: Upload artifacts
46       uses: actions/upload-artifact@v1
47       with:
48         name: dist-x86_64-pc-windows-msvc
49         path: ./dist
50
51   dist-aarch64-pc-windows-msvc:
52     name: dist (aarch64-pc-windows-msvc)
53     runs-on: windows-latest
54     env:
55       RA_TARGET: aarch64-pc-windows-msvc
56
57     steps:
58     - name: Checkout repository
59       uses: actions/checkout@v2
60
61     - name: Rename existing rust toolchain
62       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
63
64     - name: Install Rust toolchain
65       uses: actions-rs/toolchain@v1
66       with:
67         toolchain: stable
68         target: aarch64-pc-windows-msvc
69         profile: minimal
70         override: true
71
72     - name: Dist
73       run: cargo xtask dist
74
75     - name: Upload artifacts
76       uses: actions/upload-artifact@v1
77       with:
78         name: dist-aarch64-pc-windows-msvc
79         path: ./dist
80
81   dist-x86_64-unknown-linux-gnu:
82     name: dist (x86_64-unknown-linux-gnu)
83     runs-on: ubuntu-16.04
84     env:
85       RA_TARGET: x86_64-unknown-linux-gnu
86
87     steps:
88     - name: Checkout repository
89       uses: actions/checkout@v2
90
91     - name: Install Rust toolchain
92       uses: actions-rs/toolchain@v1
93       with:
94         toolchain: stable
95         profile: minimal
96         override: true
97         components: rust-src
98
99     - name: Install Nodejs
100       uses: actions/setup-node@v1
101       with:
102         node-version: 12.x
103
104     - name: Dist
105       if: github.ref == 'refs/heads/release'
106       run: cargo xtask dist --client 0.2.$GITHUB_RUN_NUMBER
107
108     - name: Dist
109       if: github.ref != 'refs/heads/release'
110       run: cargo xtask dist --nightly --client 0.3.$GITHUB_RUN_NUMBER-nightly
111
112     - name: Run analysis-stats on rust-analyzer
113       run: target/${{ env.RA_TARGET }}/release/rust-analyzer analysis-stats .
114
115     - name: Run analysis-stats on rust std library
116       run: target/${{ env.RA_TARGET }}/release/rust-analyzer analysis-stats --with-deps $(rustc --print sysroot)/lib/rustlib/src/rust/library/std
117
118     - name: Upload artifacts
119       uses: actions/upload-artifact@v1
120       with:
121         name: dist-x86_64-unknown-linux-gnu
122         path: ./dist
123
124   dist-aarch64-unknown-linux-gnu:
125     name: dist (aarch64-unknown-linux-gnu)
126     runs-on: ubuntu-16.04
127     env:
128       RA_TARGET: aarch64-unknown-linux-gnu
129       CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
130
131     steps:
132     - name: Checkout repository
133       uses: actions/checkout@v2
134
135     - name: Install Rust toolchain
136       uses: actions-rs/toolchain@v1
137       with:
138         toolchain: stable
139         target: aarch64-unknown-linux-gnu
140         profile: minimal
141         override: true
142
143     - name: Install target toolchain
144       run: sudo apt-get install gcc-aarch64-linux-gnu
145
146     - name: Dist
147       run: cargo xtask dist
148
149     - name: Upload artifacts
150       uses: actions/upload-artifact@v1
151       with:
152         name: dist-aarch64-unknown-linux-gnu
153         path: ./dist
154
155   dist-x86_64-apple-darwin:
156     name: dist (x86_64-apple-darwin)
157     runs-on: macos-latest
158     env:
159       RA_TARGET: x86_64-apple-darwin
160
161     steps:
162     - name: Checkout repository
163       uses: actions/checkout@v2
164
165     - name: Install Rust toolchain
166       uses: actions-rs/toolchain@v1
167       with:
168         toolchain: stable
169         profile: minimal
170         override: true
171
172     - name: Dist
173       run: cargo xtask dist
174
175     - name: Upload artifacts
176       uses: actions/upload-artifact@v1
177       with:
178         name: dist-x86_64-apple-darwin
179         path: ./dist
180
181   dist-aarch64-apple-darwin:
182     name: dist (aarch64-apple-darwin)
183     runs-on: macos-latest
184     env:
185       RA_TARGET: aarch64-apple-darwin
186
187     steps:
188     - name: Checkout repository
189       uses: actions/checkout@v2
190
191     - name: Install Rust toolchain
192       uses: actions-rs/toolchain@v1
193       with:
194         toolchain: stable
195         target: aarch64-apple-darwin
196         profile: minimal
197         override: true
198
199     - name: Dist
200       run: SDKROOT=$(xcrun -sdk macosx11.0 --show-sdk-path) MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx11.0 --show-sdk-platform-version) cargo xtask dist
201
202     - name: Upload artifacts
203       uses: actions/upload-artifact@v1
204       with:
205         name: dist-aarch64-apple-darwin
206         path: ./dist
207
208   publish:
209     name: publish
210     runs-on: ubuntu-16.04
211     needs: ['dist-x86_64-pc-windows-msvc', 'dist-aarch64-pc-windows-msvc', 'dist-x86_64-unknown-linux-gnu', 'dist-aarch64-unknown-linux-gnu', 'dist-x86_64-apple-darwin', 'dist-aarch64-apple-darwin']
212     steps:
213     - name: Install Nodejs
214       uses: actions/setup-node@v1
215       with:
216         node-version: 12.x
217
218     - run: echo "TAG=$(date --iso --utc)" >> $GITHUB_ENV
219       if: github.ref == 'refs/heads/release'
220     - run: echo "TAG=nightly" >> $GITHUB_ENV
221       if: github.ref != 'refs/heads/release'
222     - run: 'echo "TAG: $TAG"'
223
224     - name: Checkout repository
225       uses: actions/checkout@v2
226
227     - run: echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
228     - run: 'echo "HEAD_SHA: $HEAD_SHA"'
229
230     - uses: actions/download-artifact@v1
231       with:
232         name: dist-aarch64-apple-darwin
233         path: dist
234     - uses: actions/download-artifact@v1
235       with:
236         name: dist-x86_64-apple-darwin
237         path: dist
238     - uses: actions/download-artifact@v1
239       with:
240         name: dist-x86_64-unknown-linux-gnu
241         path: dist
242     - uses: actions/download-artifact@v1
243       with:
244         name: dist-aarch64-unknown-linux-gnu
245         path: dist
246     - uses: actions/download-artifact@v1
247       with:
248         name: dist-x86_64-pc-windows-msvc
249         path: dist
250     - uses: actions/download-artifact@v1
251       with:
252         name: dist-aarch64-pc-windows-msvc
253         path: dist
254     - run: ls -al ./dist
255
256     - name: Publish Release
257       uses: ./.github/actions/github-release
258       with:
259         files: "dist/*"
260         name: ${{ env.TAG }}
261         token: ${{ secrets.GITHUB_TOKEN }}
262
263     - run: npm ci
264       working-directory: ./editors/code
265
266     - name: Publish Extension
267       if: github.ref == 'refs/heads/release'
268       working-directory: ./editors/code
269       # token from https://dev.azure.com/rust-analyzer/
270       run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer.vsix