|
| 1 | +name: release |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - 'release/**' |
| 8 | + |
| 9 | +env: |
| 10 | + CARGO_INCREMENTAL: 0 |
| 11 | + CARGO_NET_RETRY: 10 |
| 12 | + RUSTFLAGS: "-D warnings -W unreachable-pub" |
| 13 | + RUSTUP_MAX_RETRIES: 10 |
| 14 | + FETCH_DEPTH: 0 # pull in the tags for the version string |
| 15 | + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc |
| 16 | + CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc |
| 17 | + |
| 18 | +jobs: |
| 19 | + dist: |
| 20 | + strategy: |
| 21 | + matrix: |
| 22 | + include: |
| 23 | + - os: windows-latest |
| 24 | + target: x86_64-pc-windows-msvc |
| 25 | + code-target: win32-x64 |
| 26 | + - os: windows-latest |
| 27 | + target: i686-pc-windows-msvc |
| 28 | + code-target: win32-ia32 |
| 29 | + - os: windows-latest |
| 30 | + target: aarch64-pc-windows-msvc |
| 31 | + code-target: win32-arm64 |
| 32 | + - os: ubuntu-22.04 |
| 33 | + target: x86_64-unknown-linux-gnu |
| 34 | + code-target: linux-x64 |
| 35 | + - os: ubuntu-22.04 |
| 36 | + target: aarch64-unknown-linux-gnu |
| 37 | + code-target: linux-arm64 |
| 38 | + - os: ubuntu-22.04 |
| 39 | + target: arm-unknown-linux-gnueabihf |
| 40 | + code-target: linux-armhf |
| 41 | + - os: macos-12 |
| 42 | + target: x86_64-apple-darwin |
| 43 | + code-target: darwin-x64 |
| 44 | + - os: macos-12 |
| 45 | + target: aarch64-apple-darwin |
| 46 | + code-target: darwin-arm64 |
| 47 | + |
| 48 | + env: |
| 49 | + LSP_AI_TARGET: ${{ matrix.target }} |
| 50 | + |
| 51 | + name: dist (${{ matrix.target }}) |
| 52 | + runs-on: ${{ matrix.os }} |
| 53 | + container: ${{ matrix.container }} |
| 54 | + |
| 55 | + steps: |
| 56 | + - name: Checkout repository |
| 57 | + uses: actions/checkout@v4 |
| 58 | + with: |
| 59 | + fetch-depth: ${{ env.FETCH_DEPTH }} |
| 60 | + |
| 61 | + - name: Install Rust toolchain |
| 62 | + run: | |
| 63 | + rustup update --no-self-update stable |
| 64 | + rustup target add ${{ matrix.target }} |
| 65 | + rustup component add rust-src |
| 66 | +
|
| 67 | + - name: Update apt repositories |
| 68 | + if: contains(matrix.os, 'ubuntu') |
| 69 | + run: sudo apt-get update -y |
| 70 | + |
| 71 | + - name: Install AArch64 target toolchain |
| 72 | + if: matrix.target == 'aarch64-unknown-linux-gnu' |
| 73 | + run: sudo apt-get install gcc-aarch64-linux-gnu libc6-dev-arm64-cross g++-aarch64-linux-gnu |
| 74 | + |
| 75 | + - name: Install ARM target toolchain |
| 76 | + if: matrix.target == 'arm-unknown-linux-gnueabihf' |
| 77 | + run: sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf |
| 78 | + |
| 79 | + - name: Dist |
| 80 | + run: cargo xtask dist |
| 81 | + |
| 82 | + - name: Upload artifacts |
| 83 | + uses: actions/upload-artifact@v4 |
| 84 | + with: |
| 85 | + name: dist-${{ matrix.target }} |
| 86 | + path: ./dist |
| 87 | + |
| 88 | + dist-x86_64-unknown-linux-musl: |
| 89 | + name: dist (x86_64-unknown-linux-musl) |
| 90 | + runs-on: ubuntu-latest |
| 91 | + env: |
| 92 | + LLM_LS_TARGET: x86_64-unknown-linux-musl |
| 93 | + # For some reason `-crt-static` is not working for clang without lld |
| 94 | + RUSTFLAGS: "-C link-arg=-fuse-ld=lld -C target-feature=-crt-static" |
| 95 | + container: |
| 96 | + image: rust:alpine |
| 97 | + volumes: |
| 98 | + - /usr/local/cargo/registry:/usr/local/cargo/registry |
| 99 | + |
| 100 | + steps: |
| 101 | + - name: Install dependencies |
| 102 | + run: apk add --no-cache git clang lld musl-dev nodejs npm openssl-dev pkgconfig g++ |
| 103 | + |
| 104 | + - name: Checkout repository |
| 105 | + uses: actions/checkout@v4 |
| 106 | + with: |
| 107 | + fetch-depth: ${{ env.FETCH_DEPTH }} |
| 108 | + |
| 109 | + - name: Dist |
| 110 | + run: cargo xtask dist |
| 111 | + |
| 112 | + - name: Upload artifacts |
| 113 | + uses: actions/upload-artifact@v4 |
| 114 | + with: |
| 115 | + name: dist-x86_64-unknown-linux-musl |
| 116 | + path: ./dist |
| 117 | + |
| 118 | + publish: |
| 119 | + name: publish |
| 120 | + runs-on: ubuntu-latest |
| 121 | + needs: ["dist", "dist-x86_64-unknown-linux-musl"] |
| 122 | + steps: |
| 123 | + - name: Checkout repository |
| 124 | + uses: actions/checkout@v4 |
| 125 | + with: |
| 126 | + fetch-depth: ${{ env.FETCH_DEPTH }} |
| 127 | + |
| 128 | + - run: echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV |
| 129 | + - run: 'echo "HEAD_SHA: $HEAD_SHA"' |
| 130 | + |
| 131 | + - name: Split branch name |
| 132 | + env: |
| 133 | + BRANCH: ${{ github.ref_name }} |
| 134 | + id: split |
| 135 | + run: echo "tag=${BRANCH##*/}" >> $GITHUB_OUTPUT |
| 136 | + |
| 137 | + - uses: actions/download-artifact@v4 |
| 138 | + with: |
| 139 | + name: dist-aarch64-apple-darwin |
| 140 | + path: dist |
| 141 | + - uses: actions/download-artifact@v4 |
| 142 | + with: |
| 143 | + name: dist-x86_64-apple-darwin |
| 144 | + path: dist |
| 145 | + - uses: actions/download-artifact@v4 |
| 146 | + with: |
| 147 | + name: dist-x86_64-unknown-linux-gnu |
| 148 | + path: dist |
| 149 | + - uses: actions/download-artifact@v4 |
| 150 | + with: |
| 151 | + name: dist-x86_64-unknown-linux-musl |
| 152 | + path: dist |
| 153 | + - uses: actions/download-artifact@v4 |
| 154 | + with: |
| 155 | + name: dist-aarch64-unknown-linux-gnu |
| 156 | + path: dist |
| 157 | + - uses: actions/download-artifact@v4 |
| 158 | + with: |
| 159 | + name: dist-arm-unknown-linux-gnueabihf |
| 160 | + path: dist |
| 161 | + - uses: actions/download-artifact@v4 |
| 162 | + with: |
| 163 | + name: dist-x86_64-pc-windows-msvc |
| 164 | + path: dist |
| 165 | + - uses: actions/download-artifact@v4 |
| 166 | + with: |
| 167 | + name: dist-i686-pc-windows-msvc |
| 168 | + path: dist |
| 169 | + - uses: actions/download-artifact@v4 |
| 170 | + with: |
| 171 | + name: dist-aarch64-pc-windows-msvc |
| 172 | + path: dist |
| 173 | + - run: ls -al ./dist |
| 174 | + |
| 175 | + - name: Publish Release |
| 176 | + uses: ./.github/actions/github-release |
| 177 | + with: |
| 178 | + files: "dist/*" |
| 179 | + name: ${{ steps.split.outputs.tag }} |
| 180 | + token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments