chore: rename package to openworkers-v8 #61
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: ci | |
| on: | |
| push: | |
| tags: ["**"] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: write-all | |
| jobs: | |
| build: | |
| name: ${{ matrix.config.variant }} ${{ matrix.config.target }} ${{ matrix.config.features }} | |
| runs-on: ${{ matrix.config.os }} | |
| timeout-minutes: 180 | |
| strategy: | |
| fail-fast: | |
| ${{ (github.event_name == 'pull_request' || (github.ref != | |
| 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/'))) && | |
| !contains(github.event.pull_request.labels.*.name, 'no-fail-fast') }} | |
| matrix: | |
| config: | |
| # ===== macOS ARM64 (none, ptrcomp, sandbox) ===== | |
| - os: macos-15 | |
| target: aarch64-apple-darwin | |
| variant: debug | |
| features: none | |
| - os: macos-15 | |
| target: aarch64-apple-darwin | |
| variant: release | |
| features: none | |
| - os: macos-15 | |
| target: aarch64-apple-darwin | |
| variant: debug | |
| features: ptrcomp | |
| - os: macos-15 | |
| target: aarch64-apple-darwin | |
| variant: release | |
| features: ptrcomp | |
| - os: macos-15 | |
| target: aarch64-apple-darwin | |
| variant: debug | |
| features: sandbox | |
| - os: macos-15 | |
| target: aarch64-apple-darwin | |
| variant: release | |
| features: sandbox | |
| # ===== Linux x86_64 (none, ptrcomp, sandbox) ===== | |
| - os: ubuntu-22.04 | |
| target: x86_64-unknown-linux-gnu | |
| variant: debug | |
| features: none | |
| - os: ubuntu-22.04 | |
| target: x86_64-unknown-linux-gnu | |
| variant: release | |
| features: none | |
| - os: ubuntu-22.04 | |
| target: x86_64-unknown-linux-gnu | |
| variant: debug | |
| features: ptrcomp | |
| - os: ubuntu-22.04 | |
| target: x86_64-unknown-linux-gnu | |
| variant: release | |
| features: ptrcomp | |
| - os: ubuntu-22.04 | |
| target: x86_64-unknown-linux-gnu | |
| variant: debug | |
| features: sandbox | |
| - os: ubuntu-22.04 | |
| target: x86_64-unknown-linux-gnu | |
| variant: release | |
| features: sandbox | |
| # ===== macOS x86_64 (none only) ===== | |
| - os: macos-15-large | |
| target: x86_64-apple-darwin | |
| variant: debug | |
| features: none | |
| - os: macos-15-large | |
| target: x86_64-apple-darwin | |
| variant: release | |
| features: none | |
| # ===== Linux ARM64 cross-compile (none only) ===== | |
| - os: ubuntu-22.04 | |
| target: aarch64-unknown-linux-gnu | |
| variant: debug | |
| features: none | |
| - os: ubuntu-22.04 | |
| target: aarch64-unknown-linux-gnu | |
| variant: release | |
| features: none | |
| # ===== Windows x86_64 (none, release only) ===== | |
| - os: windows-2022 | |
| target: x86_64-pc-windows-msvc | |
| variant: release | |
| features: none | |
| env: | |
| V8_FROM_SOURCE: true | |
| CARGO_VARIANT_FLAG: ${{ matrix.config.variant == 'release' && '--release' || '' }} | |
| LIB_NAME: ${{ contains(matrix.config.target, 'windows') && 'rusty_v8' || 'librusty_v8' }} | |
| LIB_EXT: ${{ contains(matrix.config.target, 'windows') && 'lib' || 'a' }} | |
| RUSTFLAGS: -D warnings | |
| steps: | |
| - name: Configure git | |
| run: git config --global core.symlinks true | |
| - name: Clone repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 10 | |
| submodules: recursive | |
| - name: Install rust | |
| uses: dsherret/rust-toolchain-file@v1 | |
| - name: Install cargo-binstall | |
| uses: cargo-bins/cargo-binstall@main | |
| - name: Install nextest | |
| run: cargo binstall cargo-nextest --secure --locked --no-confirm | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.11.x | |
| architecture: x64 | |
| - name: Set cargo feature flags | |
| shell: bash | |
| run: | | |
| if [ "${{ matrix.config.features }}" = "sandbox" ]; then | |
| echo "CARGO_FEATURE_FLAGS=--features v8_enable_sandbox" >> $GITHUB_ENV | |
| echo "FEATURES_SUFFIX=_sandbox" >> $GITHUB_ENV | |
| elif [ "${{ matrix.config.features }}" = "ptrcomp" ]; then | |
| echo "CARGO_FEATURE_FLAGS=--features v8_enable_pointer_compression" >> $GITHUB_ENV | |
| echo "FEATURES_SUFFIX=_ptrcomp" >> $GITHUB_ENV | |
| else | |
| echo "CARGO_FEATURE_FLAGS=" >> $GITHUB_ENV | |
| echo "FEATURES_SUFFIX=" >> $GITHUB_ENV | |
| fi | |
| - name: Install cross compilation toolchain | |
| if: matrix.config.target == 'aarch64-unknown-linux-gnu' | |
| run: | | |
| rustup target add aarch64-unknown-linux-gnu | |
| sudo apt update | |
| sudo apt install -yq --no-install-suggests --no-install-recommends \ | |
| binfmt-support g++-10-aarch64-linux-gnu g++-10-multilib \ | |
| gcc-10-aarch64-linux-gnu libc6-arm64-cross qemu qemu-user \ | |
| qemu-user-binfmt | |
| sudo ln -s /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 \ | |
| /lib/ld-linux-aarch64.so.1 | |
| echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc-10" >> ${GITHUB_ENV} | |
| echo "QEMU_LD_PREFIX=/usr/aarch64-linux-gnu" >> ${GITHUB_ENV} | |
| - name: Write git_submodule_status.txt | |
| run: git submodule status --recursive > git_submodule_status.txt | |
| - name: Cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: |- | |
| target/sccache | |
| target/*/.* | |
| target/*/build | |
| target/*/deps | |
| key: cargo1-${{ matrix.config.target }}-${{ matrix.config.variant }}-${{ matrix.config.features }}-${{ hashFiles('Cargo.lock', 'build.rs', 'git_submodule_status.txt') }} | |
| restore-keys: cargo1-${{ matrix.config.target }}-${{ matrix.config.variant }}-${{ matrix.config.features }}- | |
| - name: Install and start sccache | |
| shell: pwsh | |
| env: | |
| SCCACHE_DIR: ${{ github.workspace }}/target/sccache | |
| SCCACHE_CACHE_SIZE: 256M | |
| SCCACHE_IDLE_TIMEOUT: 0 | |
| run: | | |
| $version = "v0.8.2" | |
| $platform = | |
| @{ "x86_64-apple-darwin" = "x86_64-apple-darwin" | |
| "aarch64-apple-darwin" = "aarch64-apple-darwin" | |
| "x86_64-unknown-linux-gnu" = "x86_64-unknown-linux-musl" | |
| "aarch64-unknown-linux-gnu" = "aarch64-unknown-linux-musl" | |
| "x86_64-pc-windows-msvc" = "x86_64-pc-windows-msvc" | |
| }['${{ matrix.config.target }}'] | |
| $basename = "sccache-$version-$platform" | |
| $url = "https://github.com/mozilla/sccache/releases/download/$version/$basename.tar.gz" | |
| cd ~ | |
| curl -LO $url | |
| tar -xzvf "$basename.tar.gz" | |
| . $basename/sccache --start-server | |
| echo "$(pwd)/$basename" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| - name: Install Clang | |
| if: startsWith(matrix.config.os, 'ubuntu') | |
| run: | | |
| echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-19 main" | sudo dd of=/etc/apt/sources.list.d/llvm-toolchain-jammy-19.list | |
| curl https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor | sudo dd of=/etc/apt/trusted.gpg.d/llvm-snapshot.gpg | |
| sudo apt-get update | |
| sudo apt-get -qq remove 'clang-*' | |
| sudo apt-get install lld-19 clang-19 clang-tools-19 clang-tidy-19 clang-format-19 libclang-19-dev -y | |
| echo "LIBCLANG_PATH=/usr/lib/llvm-19/lib" >> $GITHUB_ENV | |
| - name: check rust code formatting | |
| run: cargo fmt --check | |
| - name: check c++ code formatting | |
| if: startsWith(matrix.config.os, 'ubuntu') | |
| run: | | |
| clang-format-19 --verbose --Werror --dry-run src/*.cc src/*.hpp src/*.h | |
| - name: Test | |
| env: | |
| SCCACHE_IDLE_TIMEOUT: 0 | |
| if: matrix.config.target != 'aarch64-unknown-linux-gnu' | |
| run: cargo nextest run -v --cargo-verbose --cargo-verbose --all-targets --locked --target ${{ matrix.config.target }} ${{ env.CARGO_VARIANT_FLAG }} ${{ env.CARGO_FEATURE_FLAGS }} | |
| - name: Build (cross-compile, no tests) | |
| if: matrix.config.target == 'aarch64-unknown-linux-gnu' | |
| env: | |
| SCCACHE_IDLE_TIMEOUT: 0 | |
| run: cargo build --all-targets --locked --target ${{ matrix.config.target }} ${{ env.CARGO_VARIANT_FLAG }} ${{ env.CARGO_FEATURE_FLAGS }} | |
| - name: Clippy | |
| run: cargo clippy --all-targets --locked --target ${{ matrix.config.target }} ${{ env.CARGO_VARIANT_FLAG }} ${{ env.CARGO_FEATURE_FLAGS }} -- -D clippy::all | |
| - name: Prepare binary publish | |
| run: | | |
| gzip -9c target/${{ matrix.config.target }}/${{ matrix.config.variant }}/gn_out/obj/${{ env.LIB_NAME }}.${{ env.LIB_EXT }} > target/${{ env.LIB_NAME }}${{ env.FEATURES_SUFFIX }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.${{ env.LIB_EXT }}.gz | |
| ls -l target/${{ env.LIB_NAME }}${{ env.FEATURES_SUFFIX }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.${{ env.LIB_EXT }}.gz | |
| cp target/${{ matrix.config.target }}/${{ matrix.config.variant }}/gn_out/src_binding.rs target/src_binding${{ env.FEATURES_SUFFIX }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.rs | |
| ls -l target/src_binding${{ env.FEATURES_SUFFIX }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.rs | |
| - name: Binary publish | |
| uses: softprops/action-gh-release@v0.1.15 | |
| if: >- | |
| github.repository == 'openworkers/rusty-v8' && | |
| startsWith(github.ref, 'refs/tags/') | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| files: | | |
| target/${{ env.LIB_NAME }}${{ env.FEATURES_SUFFIX }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.${{ env.LIB_EXT }}.gz | |
| target/src_binding${{ env.FEATURES_SUFFIX }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.rs | |
| - name: Upload CI artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: src_binding${{ env.FEATURES_SUFFIX }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.rs | |
| path: target/src_binding${{ env.FEATURES_SUFFIX }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.rs | |
| build-asan: | |
| name: asan aarch64-apple-darwin | |
| runs-on: macos-15 | |
| timeout-minutes: 180 | |
| env: | |
| V8_FROM_SOURCE: true | |
| RUSTFLAGS: -D warnings | |
| steps: | |
| - name: Configure git | |
| run: git config --global core.symlinks true | |
| - name: Clone repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 10 | |
| submodules: recursive | |
| - name: Install rust | |
| uses: dsherret/rust-toolchain-file@v1 | |
| - name: Install cargo-binstall | |
| uses: cargo-bins/cargo-binstall@main | |
| - name: Install nextest | |
| run: cargo binstall cargo-nextest --secure --locked --no-confirm | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.11.x | |
| architecture: x64 | |
| - name: Write git_submodule_status.txt | |
| run: git submodule status --recursive > git_submodule_status.txt | |
| - name: Cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: |- | |
| target/sccache | |
| target/*/.* | |
| target/*/build | |
| target/*/deps | |
| key: cargo1-aarch64-apple-darwin-asan-${{ hashFiles('Cargo.lock', 'build.rs', 'git_submodule_status.txt') }} | |
| restore-keys: cargo1-aarch64-apple-darwin-asan- | |
| - name: Install and start sccache | |
| shell: pwsh | |
| env: | |
| SCCACHE_DIR: ${{ github.workspace }}/target/sccache | |
| SCCACHE_CACHE_SIZE: 256M | |
| SCCACHE_IDLE_TIMEOUT: 0 | |
| run: | | |
| $version = "v0.8.2" | |
| $platform = "aarch64-apple-darwin" | |
| $basename = "sccache-$version-$platform" | |
| $url = "https://github.com/mozilla/sccache/releases/download/$version/$basename.tar.gz" | |
| cd ~ | |
| curl -LO $url | |
| tar -xzvf "$basename.tar.gz" | |
| . $basename/sccache --start-server | |
| echo "$(pwd)/$basename" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| - name: Install Rust (nightly) | |
| uses: dtolnay/rust-toolchain@nightly | |
| - name: Test (ASAN) | |
| env: | |
| SCCACHE_IDLE_TIMEOUT: 0 | |
| run: | | |
| rustup component add rust-src --toolchain nightly-aarch64-apple-darwin | |
| curl -O http://commondatastorage.googleapis.com/chromium-browser-clang-staging/Mac/dsymutil-llvmorg-17-init-19076-g5533fc10-1.tgz | |
| tar -C tools/clang/dsymutil/ -xvzf dsymutil-llvmorg-17-init-19076-g5533fc10-1.tgz | |
| V8_FROM_SOURCE=true RUSTFLAGS="-C opt-level=1 -Zsanitizer=address" cargo +nightly -Z build-std nextest run --lib --bins --tests -v --cargo-verbose --cargo-verbose --target aarch64-apple-darwin | |
| build-windows-arm64: | |
| name: release aarch64-pc-windows-msvc | |
| runs-on: windows-2022 | |
| timeout-minutes: 180 | |
| env: | |
| CARGO_VARIANT_FLAG: --release | |
| V8_FROM_SOURCE: true | |
| CCACHE: ccache | |
| LIB_NAME: rusty_v8 | |
| LIB_EXT: lib | |
| FEATURES_SUFFIX: '' | |
| steps: | |
| - name: Configure git | |
| run: git config --global core.symlinks true | |
| - name: Clone repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 10 | |
| submodules: recursive | |
| - uses: dsherret/rust-toolchain-file@v1 | |
| - name: Install Windows ARM64 target | |
| run: rustup target add aarch64-pc-windows-msvc | |
| - name: Install nextest | |
| uses: taiki-e/install-action@nextest | |
| - name: Write git_submodule_status.txt | |
| run: git submodule status --recursive > git_submodule_status.txt | |
| - name: Cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: |- | |
| target/sccache | |
| target/aarch64-pc-windows-msvc/release/gn_out | |
| key: cargo1-aarch64-pc-windows-msvc-release-${{ hashFiles('Cargo.lock', 'build.rs', 'git_submodule_status.txt') }} | |
| restore-keys: cargo1-aarch64-pc-windows-msvc-release- | |
| - name: Install and start sccache | |
| shell: pwsh | |
| env: | |
| SCCACHE_DIR: ${{ github.workspace }}/target/sccache | |
| SCCACHE_CACHE_SIZE: 256M | |
| SCCACHE_IDLE_TIMEOUT: 0 | |
| run: | | |
| $version = "v0.8.2" | |
| $platform = "x86_64-pc-windows-msvc" | |
| $basename = "sccache-$version-$platform" | |
| $url = "https://github.com/mozilla/sccache/releases/download/$version/$basename.tar.gz" | |
| cd ~ | |
| curl -LO $url | |
| tar -xzvf "$basename.tar.gz" | |
| . $basename/sccache --start-server | |
| echo "$(pwd)/$basename" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| - name: Install Clang | |
| run: python3 tools/clang/scripts/update.py | |
| - name: Build (cross-compile, no tests) | |
| env: | |
| SCCACHE_IDLE_TIMEOUT: 0 | |
| run: cargo build --all-targets --locked --target aarch64-pc-windows-msvc --release | |
| - name: Clippy | |
| run: cargo clippy --all-targets --locked --target aarch64-pc-windows-msvc --release -- -D clippy::all | |
| - name: Prepare binary publish | |
| run: | | |
| gzip -9c target/aarch64-pc-windows-msvc/release/gn_out/obj/rusty_v8.lib > target/rusty_v8_release_aarch64-pc-windows-msvc.lib.gz | |
| ls -l target/rusty_v8_release_aarch64-pc-windows-msvc.lib.gz | |
| cp target/aarch64-pc-windows-msvc/release/gn_out/src_binding.rs target/src_binding_release_aarch64-pc-windows-msvc.rs | |
| ls -l target/src_binding_release_aarch64-pc-windows-msvc.rs | |
| - name: Binary publish | |
| uses: softprops/action-gh-release@v0.1.15 | |
| if: >- | |
| github.repository == 'openworkers/rusty-v8' && | |
| startsWith(github.ref, 'refs/tags/') | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| files: | | |
| target/rusty_v8_release_aarch64-pc-windows-msvc.lib.gz | |
| target/src_binding_release_aarch64-pc-windows-msvc.rs | |
| - name: Upload CI artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: src_binding_release_aarch64-pc-windows-msvc.rs | |
| path: target/src_binding_release_aarch64-pc-windows-msvc.rs | |
| publish: | |
| needs: [build, build-windows-arm64] | |
| runs-on: ubuntu-22.04 | |
| if: >- | |
| github.repository == 'openworkers/rusty-v8' && | |
| startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - name: Configure git | |
| run: git config --global core.symlinks true | |
| - name: Clone repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 10 | |
| submodules: false | |
| - name: Install rust | |
| uses: dsherret/rust-toolchain-file@v1 | |
| - name: Install python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.11.x | |
| architecture: x64 | |
| - name: Download CI artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: gen | |
| pattern: src_binding_*.rs | |
| merge-multiple: true | |
| - name: Publish | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| run: cargo publish -vv --locked --allow-dirty |