]> git.lizzy.rs Git - rust.git/blob - .github/workflows/release.yaml
Merge #7292
[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
98     - name: Install Nodejs
99       uses: actions/setup-node@v1
100       with:
101         node-version: 12.x
102
103     - name: Dist
104       if: github.ref == 'refs/heads/release'
105       run: cargo xtask dist --client 0.2.$GITHUB_RUN_NUMBER
106
107     - name: Dist
108       if: github.ref != 'refs/heads/release'
109       run: cargo xtask dist --nightly --client 0.3.$GITHUB_RUN_NUMBER-nightly
110
111     - name: Nightly analysis-stats check
112       if: github.ref != 'refs/heads/release'
113       run: target/${{ env.RA_TARGET }}/release/rust-analyzer analysis-stats .
114
115     - name: Upload artifacts
116       uses: actions/upload-artifact@v1
117       with:
118         name: dist-x86_64-unknown-linux-gnu
119         path: ./dist
120
121   dist-aarch64-unknown-linux-gnu:
122     name: dist (aarch64-unknown-linux-gnu)
123     runs-on: ubuntu-16.04
124     env:
125       RA_TARGET: aarch64-unknown-linux-gnu
126       CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
127
128     steps:
129     - name: Checkout repository
130       uses: actions/checkout@v2
131
132     - name: Install Rust toolchain
133       uses: actions-rs/toolchain@v1
134       with:
135         toolchain: stable
136         target: aarch64-unknown-linux-gnu
137         profile: minimal
138         override: true
139
140     - name: Install target toolchain
141       run: sudo apt-get install gcc-aarch64-linux-gnu
142
143     - name: Dist
144       run: cargo xtask dist
145
146     - name: Upload artifacts
147       uses: actions/upload-artifact@v1
148       with:
149         name: dist-aarch64-unknown-linux-gnu
150         path: ./dist
151
152   dist-x86_64-apple-darwin:
153     name: dist (x86_64-apple-darwin)
154     runs-on: macos-latest
155     env:
156       RA_TARGET: x86_64-apple-darwin
157
158     steps:
159     - name: Checkout repository
160       uses: actions/checkout@v2
161
162     - name: Install Rust toolchain
163       uses: actions-rs/toolchain@v1
164       with:
165         toolchain: stable
166         profile: minimal
167         override: true
168
169     - name: Dist
170       run: cargo xtask dist
171
172     - name: Upload artifacts
173       uses: actions/upload-artifact@v1
174       with:
175         name: dist-x86_64-apple-darwin
176         path: ./dist
177
178   dist-aarch64-apple-darwin:
179     name: dist (aarch64-apple-darwin)
180     runs-on: macos-latest
181     env:
182       RA_TARGET: aarch64-apple-darwin
183
184     steps:
185     - name: Checkout repository
186       uses: actions/checkout@v2
187
188     - name: Install Rust toolchain
189       uses: actions-rs/toolchain@v1
190       with:
191         toolchain: stable
192         target: aarch64-apple-darwin
193         profile: minimal
194         override: true
195
196     - name: Dist
197       run: SDKROOT=$(xcrun -sdk macosx11.0 --show-sdk-path) MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx11.0 --show-sdk-platform-version) cargo xtask dist
198
199     - name: Upload artifacts
200       uses: actions/upload-artifact@v1
201       with:
202         name: dist-aarch64-apple-darwin
203         path: ./dist
204
205   publish:
206     name: publish
207     runs-on: ubuntu-16.04
208     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']
209     steps:
210     - name: Install Nodejs
211       uses: actions/setup-node@v1
212       with:
213         node-version: 12.x
214
215     - run: echo "TAG=$(date --iso --utc)" >> $GITHUB_ENV
216       if: github.ref == 'refs/heads/release'
217     - run: echo "TAG=nightly" >> $GITHUB_ENV
218       if: github.ref != 'refs/heads/release'
219     - run: 'echo "TAG: $TAG"'
220
221     - name: Checkout repository
222       uses: actions/checkout@v2
223
224     - run: echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
225     - run: 'echo "HEAD_SHA: $HEAD_SHA"'
226
227     - uses: actions/download-artifact@v1
228       with:
229         name: dist-aarch64-apple-darwin
230         path: dist
231     - uses: actions/download-artifact@v1
232       with:
233         name: dist-x86_64-apple-darwin
234         path: dist
235     - uses: actions/download-artifact@v1
236       with:
237         name: dist-x86_64-unknown-linux-gnu
238         path: dist
239     - uses: actions/download-artifact@v1
240       with:
241         name: dist-aarch64-unknown-linux-gnu
242         path: dist
243     - uses: actions/download-artifact@v1
244       with:
245         name: dist-x86_64-pc-windows-msvc
246         path: dist
247     - uses: actions/download-artifact@v1
248       with:
249         name: dist-aarch64-pc-windows-msvc
250         path: dist
251     - run: ls -al ./dist
252
253     - name: Publish Release
254       uses: ./.github/actions/github-release
255       with:
256         files: "dist/*"
257         name: ${{ env.TAG }}
258         token: ${{ secrets.GITHUB_TOKEN }}
259
260     - run: npm ci
261       working-directory: ./editors/code
262
263     - name: Publish Extension
264       if: github.ref == 'refs/heads/release'
265       working-directory: ./editors/code
266       # token from https://dev.azure.com/rust-analyzer/
267       run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer.vsix