From 45b4315842312d5f5697bac81744fe782259d7c9 Mon Sep 17 00:00:00 2001 From: Aofei Sheng Date: Wed, 31 Jul 2024 08:56:03 +0800 Subject: [PATCH] deps: require zlib 1.2+ --- .github/workflows/go.yml | 42 +++++++++++++++++++++++++--------- .github/workflows/test_llgo.sh | 2 -- README.md | 15 +++++------- 3 files changed, 37 insertions(+), 22 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 7d43725a..9a412391 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -18,7 +18,7 @@ jobs: - macos-latest - ubuntu-24.04 llvm: [18] - runs-on: ${{ matrix.os }} + runs-on: ${{matrix.os}} steps: - uses: actions/checkout@v4 @@ -26,17 +26,37 @@ jobs: if: startsWith(matrix.os, 'macos') run: | brew update - brew install llvm@${{ matrix.llvm }} pkg-config bdw-gc openssl cjson sqlite python@3.12 - echo "$(brew --prefix llvm@${{ matrix.llvm }})/bin" >> $GITHUB_PATH + brew install llvm@${{matrix.llvm}} pkg-config bdw-gc openssl + echo "$(brew --prefix llvm@${{matrix.llvm}})/bin" >> $GITHUB_PATH + + # Install optional deps for demos. + # + # NOTE: Keep this list updated as new deps are introduced. + opt_deps=( + cjson # for github.com/goplus/llgo/c/cjson + sqlite # for github.com/goplus/llgo/c/sqlite + python@3.12 # for github.com/goplus/llgo/py + ) + brew install "${opt_deps[@]}" - 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 + 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 }} lld-${{ matrix.llvm }} pkg-config libgc-dev libssl-dev libcjson-dev libsqlite3-dev python3.12-dev - echo "/usr/lib/llvm-${{ matrix.llvm }}/bin" >> $GITHUB_PATH + sudo apt-get install -y llvm-${{matrix.llvm}}-dev clang-${{matrix.llvm}} lld-${{matrix.llvm}} pkg-config libgc-dev libssl-dev zlib1g-dev + echo "/usr/lib/llvm-${{matrix.llvm}}/bin" >> $GITHUB_PATH + + # Install optional deps for demos. + # + # NOTE: Keep this list updated as new deps are introduced. + opt_deps=( + libcjson-dev # for github.com/goplus/llgo/c/cjson + libsqlite3-dev # for github.com/goplus/llgo/c/sqlite + python3.12-dev # for github.com/goplus/llgo/py + ) + sudo apt-get install -y "${opt_deps[@]}" - name: Clang information run: | @@ -66,13 +86,13 @@ jobs: - name: LLGO tests if: matrix.os != 'ubuntu-latest' run: | - echo "Test result on ${{ matrix.os }} with LLVM ${{ matrix.llvm }}" > result.md - LLGOROOT=$PWD bash .github/workflows/test_llgo.sh + echo "Test result on ${{matrix.os}} with LLVM ${{matrix.llvm}}" > result.md + bash .github/workflows/test_llgo.sh - name: Test _demo and _pydemo run: | set +e - LLGOROOT=$PWD bash .github/workflows/test_demo.sh + bash .github/workflows/test_demo.sh exit 0 - name: Show test result @@ -83,10 +103,10 @@ jobs: if: false with: filePath: result.md - comment_tag: test-result-on-${{ matrix.os }}-with-llvm-${{ matrix.llvm }} + comment_tag: test-result-on-${{matrix.os}}-with-llvm-${{matrix.llvm}} - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v4 with: - token: ${{ secrets.CODECOV_TOKEN }} + token: ${{secrets.CODECOV_TOKEN}} slug: goplus/llgo diff --git a/.github/workflows/test_llgo.sh b/.github/workflows/test_llgo.sh index 0ecff3a1..a1b97fe3 100644 --- a/.github/workflows/test_llgo.sh +++ b/.github/workflows/test_llgo.sh @@ -1,8 +1,6 @@ #!/bin/bash set -e -export LLGOROOT=$PWD - testcmd=/tmp/test llgo build -o $testcmd ./c/bdwgc/_test cases=$($testcmd) diff --git a/README.md b/README.md index 514e7d10..21838002 100644 --- a/README.md +++ b/README.md @@ -317,8 +317,7 @@ Here are the Go packages that can be imported correctly: - [pkg-config 0.29+](https://www.freedesktop.org/wiki/Software/pkg-config/) - [bdwgc/libgc 8.0+](https://www.hboehm.info/gc/) - [OpenSSL 3.0+](https://www.openssl.org/) -- [cJSON 1.7+](https://github.com/DaveGamble/cJSON) (optional, for [github.com/goplus/llgo/c/cjson](https://pkg.go.dev/github.com/goplus/llgo/c/cjson)) -- [SQLite 3](https://www.sqlite.org) (optional, for [github.com/goplus/llgo/c/sqlite](https://pkg.go.dev/github.com/goplus/llgo/c/sqlite)) +- [zlib 1.2+](https://www.zlib.net) - [Python 3.12+](https://www.python.org) (optional, for [github.com/goplus/llgo/py](https://pkg.go.dev/github.com/goplus/llgo/py)) ## How to install @@ -328,10 +327,9 @@ Follow these steps to generate the `llgo` command (its usage is the same as the ### on macOS ```sh -brew update # execute if needed +brew update brew install llvm@18 pkg-config bdw-gc openssl -brew install cjson sqlite python@3.12 # optional -export PATH=$(brew --prefix llvm@18)/bin:$PATH # you may want to add this to your shell RC file, e.g. ~/.zshrc +brew install python@3.12 # optional go install -v github.com/goplus/llgo/cmd/llgo@latest ``` @@ -340,10 +338,9 @@ go install -v github.com/goplus/llgo/cmd/llgo@latest ```sh echo "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-18 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 # execute if needed -sudo apt-get install -y llvm-18-dev clang-18 lld-18 pkg-config libgc-dev libssl-dev -sudo apt-get install -y libcjson-dev libsqlite3-dev python3.12-dev # optional -export PATH=/usr/lib/llvm-18/bin:$PATH # you may want to add this to your shell RC file, e.g. ~/.bashrc +sudo apt-get update +sudo apt-get install -y llvm-18-dev clang-18 lld-18 pkg-config libgc-dev libssl-dev zlib1g-dev +sudo apt-get install -y python3.12-dev # optional go install -v github.com/goplus/llgo/cmd/llgo@latest ```