fork/rust-analyzer
git clone https://git.julia.blue/fork/rust-analyzer
f2c2c36efe
2022-07-25
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- name : Install Rust toolchain 59run : | 60rustup update --no-self-update stable 61rustup target add ${{ matrix.target }} 62rustup component add rust-src 63 64- name : Install Node.js 65uses : actions/setup-node@v1 66with : 67node-version : 14.x 68 69- name : Update apt repositories 70if : matrix.target == 'aarch64-unknown-linux-gnu' 71run : sudo apt-get update 72 73- name : Install target toolchain 74if : matrix.target == 'aarch64-unknown-linux-gnu' 75run : sudo apt-get install gcc-aarch64-linux-gnu 76 77- name : Dist 78run : cargo xtask dist --client-patch-version ${{ github.run_number }} 79 80- run : npm ci 81working-directory : editors/code 82 83- name : Package Extension (release) 84if : github.ref == 'refs/heads/release' 85run : npx vsce package -o "../../dist/rust-analyzer-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }} 86working-directory : editors/code 87 88- name : Package Extension (nightly) 89if : github.ref != 'refs/heads/release' 90run : npx vsce package -o "../../dist/rust-analyzer-${{ matrix.code-target }}.vsix" --target ${{ matrix.code-target }} --pre-release 91working-directory : editors/code 92 93- if : matrix.target == 'x86_64-unknown-linux-gnu' 94run : rm -rf editors/code/server 95 96- if : matrix.target == 'x86_64-unknown-linux-gnu' && github.ref == 'refs/heads/release' 97run : npx vsce package -o ../../dist/rust-analyzer-no-server.vsix 98working-directory : editors/code 99 100- if : matrix.target == 'x86_64-unknown-linux-gnu' && github.ref != 'refs/heads/release' 101run : npx vsce package -o ../../dist/rust-analyzer-no-server.vsix --pre-release 102working-directory : editors/code 103 104- name : Run analysis-stats on rust-analyzer 105if : matrix.target == 'x86_64-unknown-linux-gnu' 106run : target/${{ matrix.target }}/release/rust-analyzer analysis-stats . 107 108- name : Run analysis-stats on rust std library 109if : matrix.target == 'x86_64-unknown-linux-gnu' 110run : target/${{ matrix.target }}/release/rust-analyzer analysis-stats --with-deps $(rustc --print sysroot)/lib/rustlib/src/rust/library/std 111 112- name : Upload artifacts 113uses : actions/upload-artifact@v1 114with : 115name : dist-${{ matrix.target }} 116path : ./dist 117 118dist-x86_64-unknown-linux-musl : 119name : dist (x86_64-unknown-linux-musl) 120runs-on : ubuntu-latest 121env : 122RA_TARGET : x86_64-unknown-linux-musl 123# For some reason `-crt-static` is not working for clang without lld 124RUSTFLAGS : "-C link-arg=-fuse-ld=lld -C target-feature=-crt-static" 125container : 126image : rust:alpine 127volumes : 128- /usr/local/cargo/registry 129 130steps : 131- name : Install dependencies 132run : apk add --no-cache git clang lld musl-dev nodejs npm 133 134- name : Checkout repository 135uses : actions/checkout@v3 136with : 137fetch-depth : ${{ env.FETCH_DEPTH }} 138 139- name : Dist 140run : cargo xtask dist --client-patch-version ${{ github.run_number }} 141 142- run : npm ci 143working-directory : editors/code 144 145- name : Package Extension (release) 146if : github.ref == 'refs/heads/release' 147run : npx vsce package -o "../../dist/rust-analyzer-alpine-x64.vsix" --target alpine-x64 148working-directory : editors/code 149 150- name : Package Extension (nightly) 151if : github.ref != 'refs/heads/release' 152run : npx vsce package -o "../../dist/rust-analyzer-alpine-x64.vsix" --target alpine-x64 --pre-release 153working-directory : editors/code 154 155- run : rm -rf editors/code/server 156 157- name : Upload artifacts 158uses : actions/upload-artifact@v1 159with : 160name : dist-x86_64-unknown-linux-musl 161path : ./dist 162 163publish : 164name : publish 165runs-on : ubuntu-latest 166needs : [ "dist" , "dist-x86_64-unknown-linux-musl" ] 167steps : 168- name : Install Nodejs 169uses : actions/setup-node@v1 170with : 171node-version : 14.x 172 173- run : echo "TAG=$(date --iso -u)" >> $GITHUB_ENV 174if : github.ref == 'refs/heads/release' 175- run : echo "TAG=nightly" >> $GITHUB_ENV 176if : github.ref != 'refs/heads/release' 177- run : 'echo "TAG: $TAG"' 178 179- name : Checkout repository 180uses : actions/checkout@v3 181with : 182fetch-depth : ${{ env.FETCH_DEPTH }} 183 184- run : echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV 185- run : 'echo "HEAD_SHA: $HEAD_SHA"' 186 187- uses : actions/download-artifact@v1 188with : 189name : dist-aarch64-apple-darwin 190path : dist 191- uses : actions/download-artifact@v1 192with : 193name : dist-x86_64-apple-darwin 194path : dist 195- uses : actions/download-artifact@v1 196with : 197name : dist-x86_64-unknown-linux-gnu 198path : dist 199- uses : actions/download-artifact@v1 200with : 201name : dist-x86_64-unknown-linux-musl 202path : dist 203- uses : actions/download-artifact@v1 204with : 205name : dist-aarch64-unknown-linux-gnu 206path : dist 207- uses : actions/download-artifact@v1 208with : 209name : dist-x86_64-pc-windows-msvc 210path : dist 211- uses : actions/download-artifact@v1 212with : 213name : dist-aarch64-pc-windows-msvc 214path : dist 215- run : ls -al ./dist 216 217- name : Publish Release 218uses : ./.github/actions/github-release 219with : 220files : "dist/*" 221name : ${{ env.TAG }} 222token : ${{ secrets.GITHUB_TOKEN }} 223 224- run : rm dist/rust-analyzer-no-server.vsix 225 226- run : npm ci 227working-directory : ./editors/code 228 229- name : Publish Extension (Code Marketplace, release) 230if : github.ref == 'refs/heads/release' && (github.repository == 'rust-analyzer/rust-analyzer' || github.repository == 'rust-lang/rust-analyzer') 231working-directory : ./editors/code 232# token from https://dev.azure.com/rust-analyzer/ 233run : npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer-*.vsix 234 235- name : Publish Extension (OpenVSX, release) 236if : github.ref == 'refs/heads/release' && (github.repository == 'rust-analyzer/rust-analyzer' || github.repository == 'rust-lang/rust-analyzer') 237working-directory : ./editors/code 238# token from https://dev.azure.com/rust-analyzer/ 239run : npx ovsx publish --pat ${{ secrets.OPENVSX_TOKEN }} --packagePath ../../dist/rust-analyzer-*.vsix 240 241- name : Publish Extension (Code Marketplace, nightly) 242if : github.ref != 'refs/heads/release' && (github.repository == 'rust-analyzer/rust-analyzer' || github.repository == 'rust-lang/rust-analyzer') 243working-directory : ./editors/code 244run : npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer-*.vsix --pre-release 245 246- name : Publish Extension (OpenVSX, nightly) 247if : github.ref != 'refs/heads/release' && (github.repository == 'rust-analyzer/rust-analyzer' || github.repository == 'rust-lang/rust-analyzer') 248working-directory : ./editors/code 249run : npx ovsx publish --pat ${{ secrets.OPENVSX_TOKEN }} --packagePath ../../dist/rust-analyzer-*.vsix --pre-release