diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index d7bc0705..f06e66df 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -119,31 +119,9 @@ jobs: - name: Test demos with generated pkgs if: startsWith(matrix.os, 'macos') - run: | - # install demo's lib - brew install lua zlib isl libgpg-error raylib z3 sqlite3 gmp libxml2 libxslt - - export PKG_CONFIG_PATH="/opt/homebrew/opt/zlib/lib/pkgconfig" - export PKG_CONFIG_PATH="/opt/homebrew/opt/sqlite/lib/pkgconfig:$PKG_CONFIG_PATH" - export PKG_CONFIG_PATH="/opt/homebrew/opt/libxml2/lib/pkgconfig:$PKG_CONFIG_PATH" - export PKG_CONFIG_PATH="/opt/homebrew/opt/libxslt/lib/pkgconfig:$PKG_CONFIG_PATH" - pkg-config --cflags --libs sqlite3 - pkg-config --cflags --libs libxslt - - llcppgtest -demos ./_llcppgtest + run: bash .github/workflows/test_macos.sh + - name: Test demos with generated pkgs if: startsWith(matrix.os, 'ubuntu') - run: | - # install demo's lib - sudo apt install liblua5.4-dev libsqlite3-dev libgmp-dev libgpg-error-dev zlib1g-dev libisl-dev libz3-dev -y - llcppgtest -demo ./_llcppgtest/cjson -conf conf/linux - llcppgtest -demo ./_llcppgtest/gmp -conf conf/linux - llcppgtest -demo ./_llcppgtest/gpgerror -conf conf/linux - llcppgtest -demo ./_llcppgtest/isl - llcppgtest -demo ./_llcppgtest/lua -conf conf/linux - llcppgtest -demo ./_llcppgtest/sqlite -conf conf/linux - llcppgtest -demo ./_llcppgtest/z3 -conf conf/linux - llcppgtest -demo ./_llcppgtest/zlib -conf conf/linux - - + run: bash .github/workflows/test_linux.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..de3a2b05 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,112 @@ +name: Release + +on: + release: + types: [created, published, prereleased] + +jobs: + build: + strategy: + matrix: + include: + - os: macos-latest + llvm: 18 + platform: darwin + arch: arm64 + - os: ubuntu-24.04 + llvm: 18 + platform: linux + arch: amd64 + runs-on: ${{matrix.os}} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: "1.23" + + - name: Install dependencies + if: startsWith(matrix.os, 'macos') + run: | + brew update + brew install llvm@${{matrix.llvm}} bdw-gc openssl libffi libuv + brew link --force libffi + echo "$(brew --prefix llvm@${{matrix.llvm}})/bin" >> $GITHUB_PATH + # llcppg dependencies + brew install cjson + - name: Install dependencies + if: startsWith(matrix.os, 'ubuntu') + run: | + 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 + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + sudo apt-get update + 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 + echo "/usr/lib/llvm-${{matrix.llvm}}/bin" >> $GITHUB_PATH + - name: Install LLGO + run: | + git clone https://github.com/goplus/llgo.git + cd llgo/compiler + go install -v ./cmd/... + export LLGO_ROOT=$GITHUB_WORKSPACE/llgo + echo "LLGO_ROOT=$LLGO_ROOT" >> $GITHUB_ENV + - name: Build components + run: | + BINDIR="$GITHUB_WORKSPACE/build/${{matrix.platform}}-${{matrix.arch}}" + mkdir -p $BINDIR + cd $GITHUB_WORKSPACE + llgo build -o $BINDIR/llcppsymg ./_xtool/llcppsymg + llgo build -o $BINDIR/llcppsigfetch ./_xtool/llcppsigfetch + go build -o $BINDIR/gogensig ./cmd/gogensig + go build -o $BINDIR/llcppg . + go build -o $BINDIR/llcppcfg ./cmd/llcppcfg + cd build + zip -r llcppg-${{matrix.platform}}-${{matrix.arch}}.zip ${{matrix.platform}}-${{matrix.arch}}/ + + - name: Prepare llcppg binaries test + run: | + go install ./cmd/llcppgtest + echo "PATH=$GITHUB_WORKSPACE/build/${{matrix.platform}}-${{matrix.arch}}:$PATH" >> $GITHUB_ENV + + - name: Test llcppg binaries with demo test + if: startsWith(matrix.os, 'macos') + run: bash .github/workflows/test_macos.sh + + - name: Test llcppg binaries with demo test + if: startsWith(matrix.os, 'ubuntu') + run: bash .github/workflows/test_linux.sh + + - name: Upload binaries + uses: actions/upload-artifact@v4 + with: + name: llcppg-${{matrix.platform}}-${{matrix.arch}} + path: build/llcppg-${{matrix.platform}}-${{matrix.arch}}.zip + + publish: + needs: build + runs-on: ubuntu-latest + steps: + - name: Download darwin arm64 artifact + uses: actions/download-artifact@v4 + with: + name: llcppg-darwin-arm64 + path: ./artifacts + + - name: Download linux amd64 artifact + uses: actions/download-artifact@v4 + with: + name: llcppg-linux-amd64 + path: ./artifacts + + - name: List artifacts + run: ls -la ./artifacts + + - name: Upload to Release + uses: softprops/action-gh-release@v2 + with: + files: | + ./artifacts/llcppg-darwin-arm64.zip + ./artifacts/llcppg-linux-amd64.zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test_linux.sh b/.github/workflows/test_linux.sh new file mode 100644 index 00000000..7652235b --- /dev/null +++ b/.github/workflows/test_linux.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -e + +sudo apt install liblua5.4-dev libsqlite3-dev libgmp-dev libgpg-error-dev zlib1g-dev libisl-dev libz3-dev -y +llcppgtest -demo ./_llcppgtest/cjson -conf conf/linux +llcppgtest -demo ./_llcppgtest/gmp -conf conf/linux +llcppgtest -demo ./_llcppgtest/gpgerror -conf conf/linux +llcppgtest -demo ./_llcppgtest/isl +llcppgtest -demo ./_llcppgtest/lua -conf conf/linux +llcppgtest -demo ./_llcppgtest/sqlite -conf conf/linux +llcppgtest -demo ./_llcppgtest/z3 -conf conf/linux +llcppgtest -demo ./_llcppgtest/zlib -conf conf/linux diff --git a/.github/workflows/test_macos.sh b/.github/workflows/test_macos.sh new file mode 100644 index 00000000..9f960c75 --- /dev/null +++ b/.github/workflows/test_macos.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -e + +brew install lua zlib isl libgpg-error raylib z3 sqlite3 gmp libxml2 libxslt + +export PKG_CONFIG_PATH="/opt/homebrew/opt/zlib/lib/pkgconfig" +export PKG_CONFIG_PATH="/opt/homebrew/opt/sqlite/lib/pkgconfig:$PKG_CONFIG_PATH" +export PKG_CONFIG_PATH="/opt/homebrew/opt/libxml2/lib/pkgconfig:$PKG_CONFIG_PATH" +export PKG_CONFIG_PATH="/opt/homebrew/opt/libxslt/lib/pkgconfig:$PKG_CONFIG_PATH" +pkg-config --cflags --libs sqlite3 +pkg-config --cflags --libs libxslt + +llcppgtest -demos ./_llcppgtest \ No newline at end of file