|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [created, published, prereleased] |
| 6 | + |
| 7 | +jobs: |
| 8 | + build: |
| 9 | + strategy: |
| 10 | + matrix: |
| 11 | + include: |
| 12 | + - os: macos-latest |
| 13 | + llvm: 18 |
| 14 | + platform: darwin |
| 15 | + arch: arm64 |
| 16 | + - os: ubuntu-24.04 |
| 17 | + llvm: 18 |
| 18 | + platform: linux |
| 19 | + arch: amd64 |
| 20 | + runs-on: ${{matrix.os}} |
| 21 | + steps: |
| 22 | + - name: Checkout code |
| 23 | + uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Set up Go |
| 26 | + uses: actions/setup-go@v4 |
| 27 | + with: |
| 28 | + go-version: "1.23" |
| 29 | + |
| 30 | + - name: Install dependencies |
| 31 | + if: startsWith(matrix.os, 'macos') |
| 32 | + run: | |
| 33 | + brew update |
| 34 | + brew install llvm@${{matrix.llvm}} bdw-gc openssl libffi libuv |
| 35 | + brew link --force libffi |
| 36 | + echo "$(brew --prefix llvm@${{matrix.llvm}})/bin" >> $GITHUB_PATH |
| 37 | + # llcppg dependencies |
| 38 | + brew install cjson |
| 39 | +
|
| 40 | + - name: Install dependencies |
| 41 | + if: startsWith(matrix.os, 'ubuntu') |
| 42 | + run: | |
| 43 | + echo "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-${{matrix.llvm}} main" | sudo tee /etc/apt/sources.list.d/llvm.list |
| 44 | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - |
| 45 | + sudo apt-get update |
| 46 | + sudo apt-get install -y llvm-${{matrix.llvm}}-dev clang-${{matrix.llvm}} libunwind-dev libclang-${{matrix.llvm}}-dev lld-${{matrix.llvm}} pkg-config libgc-dev libssl-dev zlib1g-dev libffi-dev libcjson-dev libuv1-dev |
| 47 | + echo "/usr/lib/llvm-${{matrix.llvm}}/bin" >> $GITHUB_PATH |
| 48 | +
|
| 49 | + - name: Install LLGO |
| 50 | + run: | |
| 51 | + git clone https://github.com/goplus/llgo.git |
| 52 | + cd llgo/compiler |
| 53 | + go install -v ./cmd/... |
| 54 | + export LLGO_ROOT=$GITHUB_WORKSPACE/llgo |
| 55 | + echo "LLGO_ROOT=$LLGO_ROOT" >> $GITHUB_ENV |
| 56 | +
|
| 57 | + - name: Build components |
| 58 | + run: | |
| 59 | + mkdir -p build/${{matrix.platform}}-${{matrix.arch}} |
| 60 | +
|
| 61 | + cd $GITHUB_WORKSPACE |
| 62 | + llgo build -o build/${{matrix.platform}}-${{matrix.arch}}/llcppsymg ./_xtool/llcppsymg |
| 63 | + llgo build -o build/${{matrix.platform}}-${{matrix.arch}}/llcppsigfetch ./_xtool/llcppsigfetch |
| 64 | +
|
| 65 | + go build -o build/${{matrix.platform}}-${{matrix.arch}}/gogensig ./cmd/gogensig |
| 66 | + go build -o build/${{matrix.platform}}-${{matrix.arch}}/llcppg . |
| 67 | + go build -o build/${{matrix.platform}}-${{matrix.arch}}/llcppcfg ./cmd/llcppcfg |
| 68 | +
|
| 69 | + cd build |
| 70 | + zip -r llcppg-${{matrix.platform}}-${{matrix.arch}}.zip ${{matrix.platform}}-${{matrix.arch}}/ |
| 71 | +
|
| 72 | + - name: Upload binaries |
| 73 | + uses: actions/upload-artifact@v4 |
| 74 | + with: |
| 75 | + name: llcppg-${{matrix.platform}}-${{matrix.arch}} |
| 76 | + path: build/llcppg-${{matrix.platform}}-${{matrix.arch}}.zip |
| 77 | + |
| 78 | + publish: |
| 79 | + needs: build |
| 80 | + runs-on: ubuntu-latest |
| 81 | + steps: |
| 82 | + - name: Download all artifacts |
| 83 | + uses: actions/download-artifact@v4 |
| 84 | + with: |
| 85 | + pattern: llcppg-*.zip |
| 86 | + path: ./artifacts |
| 87 | + |
| 88 | + - name: List artifacts |
| 89 | + run: ls -la ./artifacts |
| 90 | + |
| 91 | + - name: Upload to Release |
| 92 | + uses: softprops/action-gh-release@v2 |
| 93 | + with: |
| 94 | + files: ./artifacts/llcppg-*.zip |
| 95 | + env: |
| 96 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments