Skip to content

Build

Build #4112

Workflow file for this run

name: brgen-build
run-name: Build
on:
push:
workflow_dispatch:
concurrency:
group: build-${{ github.ref_name }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build-rebrgen-native:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Timeline
uses: Kesin11/actions-timeline@7bf79990b7c09f5dfb570ac30b814ca597bd538e # v3.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@7e868db0f3406270dd46e1dac26c65f621456723 # master
- name: Set up Clang
uses: egor-tensin/setup-clang@23bc15cd4207e45f1566447deb48f4ff3ef932cb # v2.3
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: Setup ccache
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
with:
key: rebrgen-native-${{ runner.os }}
- name: Cache rebrgen native
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
if: (!startsWith(github.ref , 'refs/heads/renovate/')) && (!startsWith(github.ref , 'refs/heads/dependabot/'))
id: cache_rebrgen_native
env:
cache-name: cache-rebrgen-native-built
with:
path: |
./rebrgen/built
./rebrgen/utils
key: rebrgen-native-${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('rebrgen/script/build.py') }}
- name: Pull Utils
if: ${{ steps.cache_rebrgen_native.outputs.cache-hit }}
working-directory: rebrgen
run: |
cd utils
git pull
. build shared Release futils
cd ..
- name: Clone Utils
if: ${{ !(steps.cache_rebrgen_native.outputs.cache-hit) }}
working-directory: rebrgen
run: |
git clone https://github.com/on-keyday/utils.git
cd utils
. build shared Release futils
cd ..
- name: Build Native
working-directory: rebrgen
run: |
USE_CCACHE=1 BUILD_OLD_BMGEN=1 FUTILS_DIR=$(pwd)/utils python script/build.py native Release
- name: Upload Artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: rebrgen-native-tool
path: rebrgen/tool
build-rebrgen-wasm:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Timeline
uses: Kesin11/actions-timeline@7bf79990b7c09f5dfb570ac30b814ca597bd538e # v3.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Setup Emscripten
id: setup-emsdk
uses: ./.github/actions/setup-emsdk
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@7e868db0f3406270dd46e1dac26c65f621456723 # master
- name: Set up Clang
uses: egor-tensin/setup-clang@23bc15cd4207e45f1566447deb48f4ff3ef932cb # v2.3
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: Setup ccache
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
with:
key: rebrgen-wasm-${{ runner.os }}
- name: Cache rebrgen wasm
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
if: (!startsWith(github.ref , 'refs/heads/renovate/')) && (!startsWith(github.ref , 'refs/heads/dependabot/'))
id: cache_rebrgen_wasm
env:
cache-name: cache-rebrgen-wasm-built
with:
path: |
./rebrgen/built
./rebrgen/utils
key: rebrgen-wasm-${{ runner.os }}-${{ env.cache-name }}-${{ steps.setup-emsdk.outputs.version }}-${{ hashFiles('rebrgen/script/build.py') }}
- name: Pull Utils
if: ${{ steps.cache_rebrgen_wasm.outputs.cache-hit }}
working-directory: rebrgen
run: |
cd utils
git pull
rm -rf ./built
. build wasm-em Release futils
cd ..
- name: Clone Utils
if: ${{ !(steps.cache_rebrgen_wasm.outputs.cache-hit) }}
working-directory: rebrgen
run: |
git clone https://github.com/on-keyday/utils.git
cd utils
rm -rf ./built
. build wasm-em Release futils
cd ..
- name: Build WASM
working-directory: rebrgen
run: |
USE_CCACHE=1 BUILD_OLD_BMGEN=1 EMSDK_DIR=$EMSDK/ FUTILS_DIR=./utils python script/build.py web Release
cp README.md web/ || true
cp LICENSE web/ || true
- name: Upload Artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: rebrgen-wasm-web
path: rebrgen/web
build-rebrgen-glue:
needs: [build-rebrgen-native, build-rebrgen-wasm]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Timeline
uses: Kesin11/actions-timeline@7bf79990b7c09f5dfb570ac30b814ca597bd538e # v3.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Download native tool
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: rebrgen-native-tool
path: rebrgen/tool
- name: Download WASM web
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: rebrgen-wasm-web
path: rebrgen/web
- name: Install libc++-dev and libc++abi-dev
run: sudo apt-get install libc++-dev libc++abi-dev -y
- name: Generate Glue
working-directory: rebrgen
run: |
chmod -R +x ./tool
python script/bm/generate_web_glue.py
python script/ebmwebgen.py
- name: Upload Artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: bmgen-web
path: rebrgen/web
build-linux:
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
env: ["llvm", "gcc"]
steps:
- name: Timeline
uses: Kesin11/actions-timeline@7bf79990b7c09f5dfb570ac30b814ca597bd538e # v3.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@7e868db0f3406270dd46e1dac26c65f621456723 # master
- name: Set up Clang
uses: egor-tensin/setup-clang@23bc15cd4207e45f1566447deb48f4ff3ef932cb # v2.3
with:
version: latest
platform: x64
- name: Install libc++-dev and libc++abi-dev
run: sudo apt-get install libc++-dev libc++abi-dev -y
if: matrix.env == 'llvm'
- name: Setup ccache
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
with:
key: brgen-linux-${{ matrix.env }}
- name: Cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.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-${{ matrix.env }}
with:
path: |
./built
./utils
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('build.py') }}-${{ matrix.env }}
- name: Pull Utils
if: ${{ steps.cache_linux.outputs.cache-hit }}
run: |
cd utils
git pull
# default is llvm
if [ "${{ matrix.env }}" = "gcc" ]; then
export FUTILS_CXX_COMPILER=g++
export FUTILS_C_COMPILER=gcc
fi
. build shared Release futils
cd ..
- name: Build
run: |
# default is llvm
if [ "${{ matrix.env }}" = "gcc" ]; then
export FUTILS_CXX_COMPILER=g++
export FUTILS_C_COMPILER=gcc
fi
USE_CCACHE=1 FUTILS_DIR=./utils python build.py 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 ./README.ja.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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: brgen-linux-${{ matrix.env }}
path: ./artifacts
build-macos:
runs-on: macos-latest
timeout-minutes: 20
steps:
- name: Timeline
uses: Kesin11/actions-timeline@7bf79990b7c09f5dfb570ac30b814ca597bd538e # v3.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@7e868db0f3406270dd46e1dac26c65f621456723 # master
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.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: Setup ccache
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
with:
key: brgen-macos
- name: Cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.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.py') }}
- 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++ -L$PREFIX/lib/unwind -lunwind -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++ -L$PREFIX/lib/unwind -lunwind -Wl,-rpath,$PREFIX/lib/c++"
USE_CCACHE=1 FUTILS_DIR=./utils python build.py 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 ./README.ja.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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: brgen-macos
path: ./artifacts
build-windows:
runs-on: windows-latest
timeout-minutes: 20
steps:
- name: Timeline
uses: Kesin11/actions-timeline@7bf79990b7c09f5dfb570ac30b814ca597bd538e # v3.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@7e868db0f3406270dd46e1dac26c65f621456723 # master
- name: Set up Clang
uses: egor-tensin/setup-clang@23bc15cd4207e45f1566447deb48f4ff3ef932cb # v2.3
with:
version: latest
platform: x64
- name: Setup ccache
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
with:
key: brgen-windows
- name: Cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.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.py') }}
- name: Pull Utils
if: ${{ steps.cache_windows.outputs.cache-hit }}
shell: cmd
run: |
cd utils
git pull
call build.bat shared Release futils
cd ..
- name: Build
shell: pwsh
run: |
$env:USE_CCACHE = "1"
$env:FUTILS_DIR = "$pwd\utils"
python build.py native Release
.\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 README.ja.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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: brgen-windows
path: ./artifacts
build-vscode-extension:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Timeline
uses: Kesin11/actions-timeline@7bf79990b7c09f5dfb570ac30b814ca597bd538e # v3.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: brgen-vscode-extension
path: ./artifacts
build-arm-linux:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Timeline
uses: Kesin11/actions-timeline@7bf79990b7c09f5dfb570ac30b814ca597bd538e # v3.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@7e868db0f3406270dd46e1dac26c65f621456723 # master
- name: Install Cross Compiler
run: |
sudo apt-get update && sudo apt-get install -y g++-aarch64-linux-gnu
- name: Setup ccache
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
with:
key: brgen-arm-linux
- name: Cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
if: (!startsWith(github.ref , 'refs/heads/renovate/')) && (!startsWith(github.ref , 'refs/heads/dependabot/'))
id: cache_arm_linux
env:
cache-name: cache-arm-linux-built
with:
path: |
./built
./utils
key: ${{ runner.os }}-arm-${{ env.cache-name }}-${{ hashFiles('build.py') }}
- name: Pull Utils
if: ${{ steps.cache_arm_linux.outputs.cache-hit }}
run: |
cd utils
git pull
export FUTILS_CXX_COMPILER=aarch64-linux-gnu-g++
export FUTILS_C_COMPILER=aarch64-linux-gnu-gcc
. build shared Release futils
cd ..
- 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
USE_CCACHE=1 FUTILS_DIR=./utils python build.py 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 ./README.ja.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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: brgen-linux-arm
path: ./artifacts
build-android:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Timeline
uses: Kesin11/actions-timeline@7bf79990b7c09f5dfb570ac30b814ca597bd538e # v3.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@7e868db0f3406270dd46e1dac26c65f621456723 # master
- name: Install Android NDK
uses: nttld/setup-ndk@ed92fe6cadad69be94a966a7ee3271275e62f779 # v1.6.0
with:
ndk-version: r26b
- name: Setup ccache
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
with:
key: brgen-android
- name: Cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
if: (!startsWith(github.ref , 'refs/heads/renovate/')) && (!startsWith(github.ref , 'refs/heads/dependabot/'))
id: cache_android
env:
cache-name: cache-android-built
with:
path: |
./built
./utils
key: ${{ runner.os }}-android-${{ env.cache-name }}-${{ hashFiles('build.py') }}
- name: Pull Utils
if: ${{ steps.cache_android.outputs.cache-hit }}
run: |
BASE_PATH=/opt/hostedtoolcache/ndk/r26b/x64/toolchains/llvm/prebuilt/linux-x86_64
cd utils
git pull
export FUTILS_CXX_COMPILER=$BASE_PATH/bin/aarch64-linux-android21-clang++
export FUTILS_C_COMPILER=$BASE_PATH/bin/aarch64-linux-android21-clang
. build shared Release futils
cd ..
- 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
USE_CCACHE=1 FUTILS_DIR=./utils python build.py 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 ./README.ja.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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: brgen-android
path: ./artifacts
collect-licenses:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Timeline
uses: Kesin11/actions-timeline@7bf79990b7c09f5dfb570ac30b814ca597bd538e # v3.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- 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@003a5c4d8d6321bd302e38f6f0ec593f77f06600 # v1.319.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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: brgen-licenses
path: ./license_cache
build-wasm:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
env: ["development", "production"]
steps:
- name: Timeline
uses: Kesin11/actions-timeline@7bf79990b7c09f5dfb570ac30b814ca597bd538e # v3.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Setup Emscripten
id: setup-emsdk
uses: ./.github/actions/setup-emsdk
- name: Set up Ninja
uses: seanmiddleditch/gha-setup-ninja@7e868db0f3406270dd46e1dac26c65f621456723 # master
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: "1.26"
- name: Setup ccache
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
with:
key: brgen-wasm-${{ matrix.env }}
- name: Cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
if: (!startsWith(github.ref , 'refs/heads/renovate/')) && (!startsWith(github.ref , 'refs/heads/dependabot/'))
id: cache_wasm
env:
cache-name: cache-wasm-built-${{ matrix.env }}
with:
path: |
./built
./utils
key: ${{ runner.os }}-${{ env.cache-name }}-${{ steps.setup-emsdk.outputs.version }}-${{ hashFiles('build.py') }}
- name: Pull Utils
if: ${{ steps.cache_wasm.outputs.cache-hit }}
run: |
. $EMSDK/emsdk_env.sh
cd utils
git pull
rm -rf built
if [ "${{ matrix.env }}" = "production" ]; then
MODE=Release
else
MODE=Debug
fi
. build wasm-em $MODE futils
cd ..
- name: Set up wasm-pack
run: |
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build Wasm
run: |
export WEB_PRODUCTION=${{ matrix.env }}
rm -rf built
if [ "${{ matrix.env }}" = "production" ]; then
MODE=Release
else
MODE=Debug
fi
USE_CCACHE=1 EMSDK_DIR=$EMSDK/ FUTILS_DIR=./utils python build.py wasm $MODE
- name: Upload WASM lib
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: brgen-wasm-lib-${{ matrix.env }}
path: |
./web/dev/src/lib
./src/tool/json2rust/pkg
build-pages:
needs: [unictest, build-wasm, build-rebrgen-glue]
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
env: ["development", "production"]
steps:
- name: Timeline
uses: Kesin11/actions-timeline@7bf79990b7c09f5dfb570ac30b814ca597bd538e # v3.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Set up Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
with:
node-version: "23.11"
- name: Set up ast2ts
run: |
cd astlib/ast2ts
npm install
tsc
cd ../..
- name: Download brgen WASM lib
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: brgen-wasm-lib-${{ matrix.env }}
path: .
- name: Download rebrgen WASM artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: bmgen-web
path: "./rebrgen-web"
- name: Install rebrgen artifacts
run: |
chmod +x ./script/install_rebrgen_web.sh
./script/install_rebrgen_web.sh ./rebrgen-web
- name: Build npm
run: |
export WEB_PRODUCTION=${{ matrix.env }}
python build.py npm
- name: Run API server tests
if: matrix.env == 'development'
run: |
cd web/dev
npm test
- name: Setup Hugo
uses: peaceiris/actions-hugo@2752ce1d29631191ea3f27c23495fa06139a5b78 # v3.2.1
with:
hugo-version: "latest"
extended: true
- name: Build Hugo
run: |
cd web/doc
hugo --minify
cd ../..
- name: Download unictest results
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: unictest-results
path: "./unictest-results"
- name: Copy unictest results
run: |
cp -a ./unictest-results ./web/public/unictest-results
- name: Pack server kit
if: matrix.env == 'production'
run: |
chmod +x ./script/pack_server_kit.sh
./script/pack_server_kit.sh
cp script/api_server.sh web/public/
chmod +x web/public/api_server.sh
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: brgen-web-${{ matrix.env }}
path: "./web/public"
- name: Setup Pages
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
if: matrix.env == 'production'
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
id-token: write
attestations: 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
unictest:
needs: [build-linux, build-rebrgen-native]
uses: ./.github/workflows/unictest.yaml