Skip to content

Build

Build #1057

Workflow file for this run

name: brgen-build
run-name: Build
on: push
concurrency:
group: build-${{ github.ref_name }}
cancel-in-progress: true
jobs:
build-linux:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Timeline
uses: Kesin11/actions-timeline@3046833d9aacfd7745c5264b7f3af851c3e2a619 # v2.2.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@96bed6edff20d1dd61ecff9b75cc519d516e6401 # master
- name: Set up Clang
uses: egor-tensin/setup-clang@ef434b41eb33a70396fb336b1bae39c76d740c3d # v1.4
with:
version: latest
platform: x64
- name: Install libc++-dev and libc++abi-dev
run: sudo apt-get install libc++-dev libc++abi-dev -y
- name: Cache
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
# prevent renovate from updating this
if: (!startsWith(github.ref , 'refs/heads/renovate/')) && (!startsWith(github.ref , 'refs/heads/dependabot/'))
id: cache_linux
env:
cache-name: cache-linux-built
with:
path: |
./built
./utils
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('build.sh') }}
- name: Pull Utils
if: ${{ steps.cache_linux.outputs.cache-hit }}
run: |
cd utils
git pull
. build shared Release futils
cd ..
- name: Build
run: |
. build.sh native Release
./tool/src2json --version
- name: Pack artifacts
run: |
mkdir -p artifacts
cp -a ./tool ./artifacts/tool
cp -a ./script/link_path.sh ./artifacts
cp -a ./example ./artifacts/example
cp -a ./LICENSE ./artifacts
cp -a ./README.md ./artifacts
cp -a ./brgen.json ./artifacts
cp -a ./script/make_cpp_test.sh ./artifacts
cp -a ./script/make_cpp_tests.sh ./artifacts
cp -a ./testkit ./artifacts/testkit
- name: Upload artifacts
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: brgen-linux
path: ./artifacts
build-macos:
runs-on: macos-latest
timeout-minutes: 20
steps:
- name: Timeline
uses: Kesin11/actions-timeline@3046833d9aacfd7745c5264b7f3af851c3e2a619 # v2.2.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@96bed6edff20d1dd61ecff9b75cc519d516e6401 # master
- name: Set up Go
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: ">=1.20"
- name: Install Homebrew Clang
run: |
brew install llvm
- name: Check Code
run: |
PREFIX=$(brew --prefix llvm)
# from https://github.com/llvm/llvm-project/issues/77786
LIBCPP=$PREFIX/lib/c++
ls $LIBCPP
echo "libc++"
nm $LIBCPP/libc++.1.dylib | c++filt
echo "libc++abi"
nm $LIBCPP/libc++abi.1.dylib | c++filt
- name: Cache
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
# prevent renovate from updating this
if: (!startsWith(github.ref , 'refs/heads/renovate/')) && (!startsWith(github.ref , 'refs/heads/dependabot/'))
id: cache_macos
env:
cache-name: cache-macos-built
with:
path: |
./built
./utils
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('build.sh') }}
- name: Pull Utils
if: ${{ steps.cache_macos.outputs.cache-hit }}
run: |
cd utils
git pull
PREFIX=$(brew --prefix llvm)
export FUTILS_CXX_COMPILER=$PREFIX/bin/clang++
export FUTILS_C_COMPILER=$PREFIX/bin/clang
export LDFLAGS="-L$PREFIX/lib/c++ -Wl,-rpath,$PREFIX/lib/c++"
. build shared Release futils
cd ..
- name: Build
run: |
PREFIX=$(brew --prefix llvm)
export FUTILS_CXX_COMPILER=$PREFIX/bin/clang++
export FUTILS_C_COMPILER=$PREFIX/bin/clang
export LDFLAGS="-L$PREFIX/lib/c++ -Wl,-rpath,$PREFIX/lib/c++"
. build.sh native Release
./tool/src2json --version
- name: Pack artifacts
run: |
mkdir -p artifacts
cp -a ./tool ./artifacts/tool
cp -a ./script/link_path.sh ./artifacts
cp -a ./example ./artifacts/example
cp -a ./LICENSE ./artifacts
cp -a ./README.md ./artifacts
cp -a ./brgen.json ./artifacts
cp -a ./script/make_cpp_test.sh ./artifacts
cp -a ./script/make_cpp_tests.sh ./artifacts
cp -a ./testkit ./artifacts/testkit
- name: Upload artifacts
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: brgen-macos
path: ./artifacts
build-windows:
runs-on: windows-latest
timeout-minutes: 20
steps:
- name: Timeline
uses: Kesin11/actions-timeline@3046833d9aacfd7745c5264b7f3af851c3e2a619 # v2.2.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@96bed6edff20d1dd61ecff9b75cc519d516e6401 # master
- name: Set up Clang
uses: egor-tensin/setup-clang@ef434b41eb33a70396fb336b1bae39c76d740c3d # v1.4
with:
version: latest
platform: x64
- name: Cache
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
id: cache_windows
# prevent renovate from updating this
if: (!startsWith(github.ref , 'refs/heads/renovate/')) && (!startsWith(github.ref , 'refs/heads/dependabot/'))
env:
cache-name: cache-windows-built
with:
path: |
./built
./utils
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('build.bat') }}
- name: Pull Utils
if: ${{ steps.cache_windows.outputs.cache-hit }}
shell: cmd
run: |
cd utils
git pull
build shared Release futils
cd ..
- name: Build
shell: cmd
run: |
call .\build.bat native Release %CD%\utils
.\tool\src2json.exe --version
- name: Pack artifacts
shell: cmd
run: |
mkdir artifacts
xcopy /E /I /Y tool artifacts\tool
xcopy /E /I /Y example artifacts\example
copy /Y LICENSE artifacts
copy /Y README.md artifacts
copy /Y brgen.json artifacts
copy /Y script\make_cpp_test.bat artifacts
copy /Y script\make_cpp_tests.bat artifacts
xcopy /E /I /Y testkit artifacts\testkit
- name: Upload artifacts
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: brgen-windows
path: ./artifacts
build-vscode-extension:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Timeline
uses: Kesin11/actions-timeline@3046833d9aacfd7745c5264b7f3af851c3e2a619 # v2.2.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
- name: Setup ast2ts
run: |
cd astlib/ast2ts
npm install
tsc
cd ../..
- name: Install VSCE
run: npm install -g vsce
- name: Build
run: |
cd lsp
npm install
vsce package
- name: Pack artifacts
run: |
mkdir -p artifacts
cp -a ./lsp/LICENSE ./artifacts
cp -a ./lsp/brgen-lsp-*.vsix ./artifacts
- name: Upload artifacts
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: brgen-vscode-extension
path: ./artifacts
build-arm-linux:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Timeline
uses: Kesin11/actions-timeline@3046833d9aacfd7745c5264b7f3af851c3e2a619 # v2.2.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@96bed6edff20d1dd61ecff9b75cc519d516e6401 # master
- name: Install Cross Compiler
run: |
sudo apt-get update && sudo apt-get install -y g++-aarch64-linux-gnu
- name: Build
run: |
go version
export GOARCH=arm64
export FUTILS_CXX_COMPILER=aarch64-linux-gnu-g++
export FUTILS_C_COMPILER=aarch64-linux-gnu-gcc
export CC=$FUTILS_C_COMPILER
. build.sh native Release
- name: Pack artifacts
run: |
mkdir -p artifacts
cp -a ./tool ./artifacts/tool
cp -a ./script/link_path.sh ./artifacts
cp -a ./example ./artifacts/example
cp -a ./LICENSE ./artifacts
cp -a ./README.md ./artifacts
cp -a ./brgen.json ./artifacts
cp -a ./script/make_cpp_test.sh ./artifacts
cp -a ./script/make_cpp_tests.sh ./artifacts
cp -a ./testkit ./artifacts/testkit
- name: Upload artifacts
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: brgen-linux-arm
path: ./artifacts
build-android:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Timeline
uses: Kesin11/actions-timeline@3046833d9aacfd7745c5264b7f3af851c3e2a619 # v2.2.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@96bed6edff20d1dd61ecff9b75cc519d516e6401 # master
- name: Install Android NDK
uses: nttld/setup-ndk@afb4c9964b521afb97c864b7d40b11e6911bd410 # v1.5.0
with:
ndk-version: r26b
- name: Build
run: |
BASE_PATH=/opt/hostedtoolcache/ndk/r26b/x64/toolchains/llvm/prebuilt/linux-x86_64
#ls -Ral $BASE_PATH
export GOARCH=arm64
export FUTILS_CXX_COMPILER=$BASE_PATH/bin/aarch64-linux-android21-clang++
export FUTILS_C_COMPILER=$BASE_PATH/bin/aarch64-linux-android21-clang
export CC=$FUTILS_C_COMPILER
. build.sh native Release
LIBCPP_SHARED=$BASE_PATH/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so
cp $LIBCPP_SHARED ./tool
- name: Pack artifacts
run: |
mkdir -p artifacts
cp -a ./tool ./artifacts/tool
cp -a ./script/link_path.sh ./artifacts
cp -a ./example ./artifacts/example
cp -a ./LICENSE ./artifacts
cp -a ./README.md ./artifacts
cp -a ./brgen.json ./artifacts
cp -a ./script/make_cpp_test.sh ./artifacts
cp -a ./script/make_cpp_tests.sh ./artifacts
cp -a ./testkit ./artifacts/testkit
- name: Upload artifacts
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: brgen-android
path: ./artifacts
collect-licenses:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Timeline
uses: Kesin11/actions-timeline@3046833d9aacfd7745c5264b7f3af851c3e2a619 # v2.2.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: fetch dependencies
run: |
go mod download
cd astlib/ast2ts
npm install
tsc
cp ../../LICENSE ./out
cd ../../lsp
npm install
cd server
npm install
cd ../client
npm install
cd ../../src/tool/json2rust
mkdir -p ./pkg
cp ../../../LICENSE ./pkg
cd ../../../web/doc
go mod download
cd ../dev
npm install
cd ../..
- name: Install gocredits
run: |
go install github.com/Songmu/gocredits/cmd/gocredits@latest
- name: Set up ruby
uses: ruby/setup-ruby@401c19e14f474b54450cd3905bb8b86e2c8509cf # v1.204.0
with:
ruby-version: ruby
- uses: github/setup-licensed@be11bcbb82e3140b6cf260e647c3efeeca8fcefd # v1.3.1
with:
version: "4.4" # required: supports matching based on string equivalence or node-semver range
- name: Collect licenses
run: |
go mod edit -json
. ./script/collect_licenses.sh
- name: List licenses
run: |
ls -alR ./license_cache
- name: Upload artifacts
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: brgen-licenses
path: ./license_cache
build-pages:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Timeline
uses: Kesin11/actions-timeline@3046833d9aacfd7745c5264b7f3af851c3e2a619 # v2.2.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Emscripten
uses: mymindstorm/setup-emsdk@6ab9eb1bda2574c4ddb79809fc9247783eaf9021 # v14
with:
actions-cache-folder: emsdk
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@96bed6edff20d1dd61ecff9b75cc519d516e6401 # master
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: "1.23"
- name: Cache
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
# prevent renovate from updating this
if: (!startsWith(github.ref , 'refs/heads/renovate/')) && (!startsWith(github.ref , 'refs/heads/dependabot/'))
id: cache_web
env:
cache-name: cache-web-built
with:
path: |
./built
./utils
./astlib/ast2ts/node_modules
./web/dev/node_modules
./emsdk
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('build.sh') }}
- name: Pull Utils
if: ${{ steps.cache_web.outputs.cache-hit }}
run: |
cd utils
git pull
. build wasm-em Release futils
cd ..
- name: Set up ast2ts
run: |
cd astlib/ast2ts
npm install
tsc
cd ../..
- name: Set up wasm-pack
run: |
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build Wasm
run: |
GOROOT=`go env GOROOT`
echo "GOROOT=$GOROOT"
export WASMEXEC_FILE="$GOROOT/misc/wasm/wasm_exec.js"
if [ ! -e "$WASMEXEC_FILE" ]; then
echo "$WASMEXEC_FILE not found"
exit 1
fi
export WEB_PRODUCTION="production"
. build.sh wasm-em Release
- name: Setup Hugo
uses: peaceiris/actions-hugo@75d2e84710de30f6ff7268e08f310b60ef14033f # v3.0.0
with:
hugo-version: "latest"
extended: true
- name: Build Hugo
run: |
cd web/doc
hugo --minify
cd ../..
- name: Upload artifact
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: brgen-web
path: "./web/public"
- name: Setup Pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
run-test:
needs: build-linux
uses: ./.github/workflows/brgen-test.yaml
puppeteer-test:
needs: build-pages
uses: ./.github/workflows/puppeteer-test.yml
release:
needs:
[
build-linux,
build-macos,
build-windows,
build-vscode-extension,
build-arm-linux,
build-android,
build-pages,
collect-licenses,
run-test,
puppeteer-test,
]
uses: ./.github/workflows/release.yml
permissions:
contents: write
deploy:
needs: puppeteer-test
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: ./.github/workflows/deploy.yml
permissions:
contents: read
pages: write
id-token: write