Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 3 additions & 25 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
112 changes: 112 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 }}
12 changes: 12 additions & 0 deletions .github/workflows/test_linux.sh
Original file line number Diff line number Diff line change
@@ -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
13 changes: 13 additions & 0 deletions .github/workflows/test_macos.sh
Original file line number Diff line number Diff line change
@@ -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
Loading