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