|
| 1 | +name: CI-Release |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + |
| 8 | +jobs: |
| 9 | + rust: |
| 10 | + name: Rust |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 15 | + env: |
| 16 | + RUSTFLAGS: -D warnings |
| 17 | + CARGO_INCREMENTAL: 0 |
| 18 | + RUN_SLOW_TESTS: 1 |
| 19 | + RUSTUP_MAX_RETRIES: 10 |
| 20 | + CARGO_NET_RETRY: 10 |
| 21 | + PROFILE: release |
| 22 | + steps: |
| 23 | + |
| 24 | + - name: Checkout repository |
| 25 | + uses: actions/checkout@v1 |
| 26 | + |
| 27 | + # We need to disable the existing toolchain to avoid updating rust-docs |
| 28 | + # which takes a long time. The fastest way to do this is to rename the |
| 29 | + # existing folder, as deleting it takes about as much time as not doing |
| 30 | + # anything and just updating rust-docs. |
| 31 | + - name: Rename existing rust toolchain (Windows) |
| 32 | + if: matrix.os == 'windows-latest' |
| 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 | + components: rustfmt, rust-src |
| 42 | + |
| 43 | + - name: Cache cargo registry |
| 44 | + uses: actions/cache@v1 |
| 45 | + with: |
| 46 | + path: ~/.cargo/registry |
| 47 | + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} |
| 48 | + |
| 49 | + - name: Cache cargo index |
| 50 | + uses: actions/cache@v1 |
| 51 | + with: |
| 52 | + path: ~/.cargo/git |
| 53 | + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} |
| 54 | + |
| 55 | + - name: Cache cargo target dir |
| 56 | + uses: actions/cache@v1 |
| 57 | + with: |
| 58 | + path: target |
| 59 | + key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} |
| 60 | + |
| 61 | + - name: Compile and Test |
| 62 | + uses: actions-rs/cargo@v1 |
| 63 | + with: |
| 64 | + command: test |
| 65 | + args: --release --all-targets |
| 66 | + |
| 67 | + - name: Prepare cache |
| 68 | + run: cargo xtask pre-cache |
| 69 | + |
| 70 | + - name: Prepare cache 2 |
| 71 | + if: matrix.os == 'windows-latest' |
| 72 | + run: Remove-Item ./target/${{ env.PROFILE }}/xtask.exe |
| 73 | + |
| 74 | + - name: Creat distribution dir |
| 75 | + run: mkdir ./dist |
| 76 | + |
| 77 | + - name: Copy binaries (non-win) |
| 78 | + if: matrix.os != 'windows-latest' |
| 79 | + run: cp ./target/${{ env.PROFILE }}/ra_lsp_server ./dist |
| 80 | + |
| 81 | + - name: Copy binaries (win) |
| 82 | + if: matrix.os == 'windows-latest' |
| 83 | + run: copy ./target/${{ env.PROFILE }}/ra_lsp_server.* ./dist |
| 84 | + |
| 85 | + - name: Upload artifacts |
| 86 | + uses: actions/upload-artifact@v1 |
| 87 | + with: |
| 88 | + name: server-${{ matrix.os }} |
| 89 | + path: ./dist |
| 90 | + |
| 91 | + type-script: |
| 92 | + name: TypeScript |
| 93 | + runs-on: ubuntu-latest |
| 94 | + env: |
| 95 | + CXX: g++-4.9 |
| 96 | + CC: gcc-4.9 |
| 97 | + steps: |
| 98 | + - name: Checkout repository |
| 99 | + uses: actions/checkout@v1 |
| 100 | + |
| 101 | + - name: Install Nodejs |
| 102 | + uses: actions/setup-node@v1 |
| 103 | + with: |
| 104 | + node-version: 12.x |
| 105 | + |
| 106 | + - run: npm ci |
| 107 | + working-directory: ./editors/code |
| 108 | + - run: npm run package --scripts-prepend-node-path |
| 109 | + working-directory: ./editors/code |
| 110 | + |
| 111 | + - name: Create distribution directory |
| 112 | + run: mkdir ./dist |
| 113 | + |
| 114 | + - name: Copy vscode extension |
| 115 | + run: mkdir ./dist/code && cp ./editors/code/*.vsix ./dist/code/ |
| 116 | + |
| 117 | + - name: Copy emacs mode |
| 118 | + run: cp -R ./editors/emacs ./dist/ |
| 119 | + |
| 120 | + - name: Upload artifacts |
| 121 | + uses: actions/upload-artifact@v1 |
| 122 | + with: |
| 123 | + name: editors |
| 124 | + path: ./dist |
0 commit comments