2019-10-31 21:01:29 -04:00
|
|
|
name: ci
|
|
|
|
|
2022-06-27 14:37:04 -04:00
|
|
|
on:
|
2022-05-28 11:16:00 -04:00
|
|
|
push:
|
|
|
|
branches: [main]
|
2022-06-15 08:04:35 -04:00
|
|
|
tags: ["**"]
|
2022-05-28 11:16:00 -04:00
|
|
|
pull_request:
|
|
|
|
branches: [main]
|
2022-06-27 14:37:04 -04:00
|
|
|
types: [labeled, opened, synchronize, reopened]
|
2019-10-31 21:01:29 -04:00
|
|
|
|
2024-02-09 17:13:24 -05:00
|
|
|
permissions: write-all
|
|
|
|
|
2019-10-31 21:01:29 -04:00
|
|
|
jobs:
|
|
|
|
build:
|
2020-03-16 15:42:51 -04:00
|
|
|
name: ${{ matrix.config.variant }} ${{ matrix.config.target }}
|
2020-02-12 21:43:38 -05:00
|
|
|
runs-on: ${{ matrix.config.os }}
|
2022-12-18 13:41:03 -05:00
|
|
|
timeout-minutes: 180
|
2019-10-31 21:01:29 -04:00
|
|
|
strategy:
|
2021-02-14 10:15:49 -05:00
|
|
|
# Always run main branch builds to completion. This allows the cache to
|
2020-05-11 17:20:48 -04:00
|
|
|
# stay mostly up-to-date in situations where a single job fails due to
|
|
|
|
# e.g. a flaky test.
|
|
|
|
# Don't fast-fail on tag build because publishing binaries shouldn't be
|
|
|
|
# prevented if 'cargo publish' fails (which can be a false negative).
|
|
|
|
fail-fast:
|
2022-06-27 14:37:04 -04:00
|
|
|
${{ (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') }}
|
2019-10-31 21:01:29 -04:00
|
|
|
matrix:
|
2020-02-12 21:43:38 -05:00
|
|
|
config:
|
2024-05-09 12:27:44 -04:00
|
|
|
- os: macos-13
|
2020-02-12 21:43:38 -05:00
|
|
|
target: x86_64-apple-darwin
|
2020-04-04 22:10:55 -04:00
|
|
|
variant: debug
|
2024-04-22 17:16:26 -04:00
|
|
|
cargo: cargo
|
2020-03-16 15:42:51 -04:00
|
|
|
|
2024-05-09 12:27:44 -04:00
|
|
|
- os: macos-13
|
2020-03-16 15:42:51 -04:00
|
|
|
target: x86_64-apple-darwin
|
2020-04-04 22:10:55 -04:00
|
|
|
variant: release
|
2024-04-22 17:16:26 -04:00
|
|
|
cargo: cargo
|
2024-03-15 16:45:16 -04:00
|
|
|
|
2024-04-12 17:26:06 -04:00
|
|
|
- os: macos-14
|
|
|
|
target: aarch64-apple-darwin
|
|
|
|
variant: asan
|
2024-04-22 17:16:26 -04:00
|
|
|
cargo: cargo
|
2024-04-12 17:26:06 -04:00
|
|
|
|
2024-03-15 16:45:16 -04:00
|
|
|
- os: macos-14
|
|
|
|
target: aarch64-apple-darwin
|
|
|
|
variant: debug
|
2024-04-22 17:16:26 -04:00
|
|
|
cargo: cargo
|
2024-03-15 16:45:16 -04:00
|
|
|
|
|
|
|
- os: macos-14
|
|
|
|
target: aarch64-apple-darwin
|
|
|
|
variant: release
|
2024-04-22 17:16:26 -04:00
|
|
|
cargo: cargo
|
2022-05-18 04:53:34 -04:00
|
|
|
|
2024-10-18 18:08:58 -04:00
|
|
|
- os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-24.04-xl' || 'ubuntu-24.04' }}
|
2020-04-04 22:10:55 -04:00
|
|
|
target: x86_64-unknown-linux-gnu
|
|
|
|
variant: debug
|
2024-04-22 17:16:26 -04:00
|
|
|
cargo: cargo
|
2020-03-16 15:42:51 -04:00
|
|
|
|
2024-10-18 18:08:58 -04:00
|
|
|
- os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-24.04-xl' || 'ubuntu-24.04' }}
|
2020-04-04 22:10:55 -04:00
|
|
|
target: x86_64-unknown-linux-gnu
|
|
|
|
variant: release
|
2024-04-22 17:16:26 -04:00
|
|
|
cargo: cargo
|
2020-03-16 15:42:51 -04:00
|
|
|
|
2024-08-20 10:48:10 -04:00
|
|
|
- os: ${{ github.repository == 'denoland/rusty_v8' && 'windows-2022-xxl' || 'windows-2022' }}
|
2020-02-12 21:43:38 -05:00
|
|
|
target: x86_64-pc-windows-msvc
|
2020-04-04 23:12:41 -04:00
|
|
|
variant: release # Note: we do not support windows debug builds.
|
2024-04-22 17:16:26 -04:00
|
|
|
cargo: cargo
|
2020-04-04 23:12:41 -04:00
|
|
|
|
2024-10-18 18:08:58 -04:00
|
|
|
- os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-24.04-xl' || 'ubuntu-24.04' }}
|
2021-02-19 05:56:11 -05:00
|
|
|
target: aarch64-unknown-linux-gnu
|
|
|
|
variant: debug
|
2024-04-22 17:16:26 -04:00
|
|
|
cargo: cargo
|
2021-03-27 15:18:37 -04:00
|
|
|
|
2024-10-18 18:08:58 -04:00
|
|
|
- os: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-24.04-xl' || 'ubuntu-24.04' }}
|
2021-02-19 05:56:11 -05:00
|
|
|
target: aarch64-unknown-linux-gnu
|
|
|
|
variant: release
|
2024-04-22 17:16:26 -04:00
|
|
|
cargo: cargo
|
|
|
|
|
2020-03-27 16:17:19 -04:00
|
|
|
env:
|
|
|
|
V8_FROM_SOURCE: true
|
2020-04-04 16:24:08 -04:00
|
|
|
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' }}
|
2021-05-03 15:19:03 -04:00
|
|
|
RUSTFLAGS: -D warnings
|
2020-03-27 16:17:19 -04:00
|
|
|
|
2019-10-31 21:01:29 -04:00
|
|
|
steps:
|
|
|
|
- name: Configure git
|
|
|
|
run: git config --global core.symlinks true
|
|
|
|
|
|
|
|
- name: Clone repository
|
2024-03-01 12:28:17 -05:00
|
|
|
uses: actions/checkout@v4
|
2019-10-31 21:01:29 -04:00
|
|
|
with:
|
2019-11-02 18:57:18 -04:00
|
|
|
fetch-depth: 10
|
2020-04-04 22:10:55 -04:00
|
|
|
submodules: recursive
|
2019-10-31 21:01:29 -04:00
|
|
|
|
|
|
|
- name: Install rust
|
2024-03-01 12:28:17 -05:00
|
|
|
uses: dsherret/rust-toolchain-file@v1
|
2019-10-31 21:01:29 -04:00
|
|
|
|
2019-11-29 21:58:29 -05:00
|
|
|
- name: Install python
|
2024-09-07 00:09:04 -04:00
|
|
|
uses: actions/setup-python@v5
|
2019-11-29 21:58:29 -05:00
|
|
|
with:
|
2023-01-24 00:17:17 -05:00
|
|
|
python-version: 3.11.x
|
2019-11-29 21:58:29 -05:00
|
|
|
architecture: x64
|
2019-11-01 17:28:09 -04:00
|
|
|
|
2024-10-18 18:08:58 -04:00
|
|
|
- name: Install ubuntu deps
|
|
|
|
if: startsWith(matrix.config.os, 'ubuntu')
|
|
|
|
run: |
|
|
|
|
sudo apt-get install -y glib2.0
|
|
|
|
|
2020-04-04 23:12:41 -04:00
|
|
|
- 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 \
|
2022-01-12 19:01:55 -05:00
|
|
|
binfmt-support g++-10-aarch64-linux-gnu g++-10-multilib \
|
2024-10-18 18:08:58 -04:00
|
|
|
gcc-10-aarch64-linux-gnu libc6-arm64-cross qemu-system qemu-user \
|
2020-04-04 23:12:41 -04:00
|
|
|
qemu-user-binfmt
|
|
|
|
|
|
|
|
sudo ln -s /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 \
|
|
|
|
/lib/ld-linux-aarch64.so.1
|
|
|
|
|
2022-01-12 19:01:55 -05:00
|
|
|
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc-10" >> ${GITHUB_ENV}
|
2020-11-17 13:57:52 -05:00
|
|
|
echo "QEMU_LD_PREFIX=/usr/aarch64-linux-gnu" >> ${GITHUB_ENV}
|
2020-04-04 23:12:41 -04:00
|
|
|
|
2021-03-27 15:18:37 -04:00
|
|
|
- name: Write git_submodule_status.txt
|
|
|
|
run: git submodule status --recursive > git_submodule_status.txt
|
|
|
|
|
2020-04-04 16:24:08 -04:00
|
|
|
- name: Cache
|
2024-09-07 00:09:04 -04:00
|
|
|
uses: actions/cache@v4
|
2020-03-18 10:48:34 -04:00
|
|
|
with:
|
2020-04-04 16:24:08 -04:00
|
|
|
# Note: rusty_v8 targets always get get rebuilt, and their outputs
|
|
|
|
# ('librusty_v8.rlib', the whole 'gn_out' directory, etc.) can be
|
|
|
|
# quite big, so we cache only those subdirectories of
|
|
|
|
# target/{debug|release} that contain the build output for crates that
|
|
|
|
# come from the registry. By additionally saving the sccache cache
|
|
|
|
# directory it's still possible to build v8 fast.
|
|
|
|
path: |-
|
|
|
|
target/sccache
|
|
|
|
target/*/.*
|
|
|
|
target/*/build
|
|
|
|
target/*/deps
|
2020-08-27 10:37:50 -04:00
|
|
|
key:
|
2021-03-27 15:18:37 -04:00
|
|
|
cargo-${{ matrix.config.target }}-${{ matrix.config.variant }}-${{ hashFiles('Cargo.lock', 'build.rs', 'git_submodule_status.txt') }}
|
2020-08-27 10:37:50 -04:00
|
|
|
restore-keys:
|
2021-03-27 15:18:37 -04:00
|
|
|
cargo-${{ matrix.config.target }}-${{ matrix.config.variant }}-
|
2020-03-18 10:48:34 -04:00
|
|
|
|
2020-01-06 18:07:46 -05:00
|
|
|
- name: Install and start sccache
|
|
|
|
shell: pwsh
|
2019-10-31 21:01:29 -04:00
|
|
|
env:
|
2020-04-04 16:24:08 -04:00
|
|
|
SCCACHE_DIR: ${{ github.workspace }}/target/sccache
|
|
|
|
SCCACHE_CACHE_SIZE: 128M
|
2019-10-31 21:01:29 -04:00
|
|
|
SCCACHE_IDLE_TIMEOUT: 0
|
2019-11-01 00:10:00 -04:00
|
|
|
run: |
|
2021-02-08 16:03:23 -05:00
|
|
|
$version = "0.2.12"
|
2020-01-06 18:07:46 -05:00
|
|
|
$platform =
|
|
|
|
@{ "macOS" = "x86_64-apple-darwin"
|
|
|
|
"Linux" = "x86_64-unknown-linux-musl"
|
|
|
|
"Windows" = "x86_64-pc-windows-msvc"
|
|
|
|
}.${{ runner.os }}
|
|
|
|
$basename = "sccache-$version-$platform"
|
|
|
|
$url = "https://github.com/mozilla/sccache/releases/download/" +
|
|
|
|
"$version/$basename.tar.gz"
|
2020-04-04 16:24:08 -04:00
|
|
|
cd ~
|
2020-01-06 18:07:46 -05:00
|
|
|
curl -LO $url
|
|
|
|
tar -xzvf "$basename.tar.gz"
|
|
|
|
. $basename/sccache --start-server
|
2020-11-17 13:57:52 -05:00
|
|
|
echo "$(pwd)/$basename" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
2020-01-06 18:07:46 -05:00
|
|
|
|
2024-04-12 17:26:06 -04:00
|
|
|
- name: Install Rust (nightly)
|
|
|
|
uses: dtolnay/rust-toolchain@nightly
|
|
|
|
if: matrix.config.variant == 'asan'
|
|
|
|
|
2024-06-11 11:10:17 -04:00
|
|
|
- name: check rust code formatting
|
|
|
|
run: cargo fmt --check
|
|
|
|
|
|
|
|
- name: check c++ code formatting
|
|
|
|
if: startsWith(matrix.config.os, 'ubuntu')
|
|
|
|
run: |
|
|
|
|
sudo apt-get install -y clang-format
|
2024-07-26 16:37:39 -04:00
|
|
|
clang-format --verbose --Werror --dry-run src/*.cc src/*.hpp src/*.h
|
2024-06-11 11:10:17 -04:00
|
|
|
|
2024-04-12 17:26:06 -04:00
|
|
|
- name: Test (ASAN)
|
|
|
|
env:
|
|
|
|
SCCACHE_IDLE_TIMEOUT: 0
|
|
|
|
if: matrix.config.variant == 'asan'
|
|
|
|
# https://github.com/rust-lang/rust/issues/87215
|
|
|
|
run: |
|
|
|
|
rustup component add rust-src --toolchain nightly-${{ matrix.config.target }}
|
|
|
|
# Is there a better way to install this tool?
|
|
|
|
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 test --lib --bins --tests -vv --target ${{ matrix.config.target }}
|
|
|
|
|
2020-04-04 16:24:08 -04:00
|
|
|
- name: Test
|
2022-01-04 15:32:48 -05:00
|
|
|
env:
|
|
|
|
SCCACHE_IDLE_TIMEOUT: 0
|
2024-04-12 17:26:06 -04:00
|
|
|
if: matrix.config.variant == 'debug' || matrix.config.variant == 'release'
|
2020-08-27 00:07:49 -04:00
|
|
|
run:
|
2024-04-22 17:16:26 -04:00
|
|
|
${{ matrix.config.cargo }} test -vv --all-targets --locked ${{ env.CARGO_VARIANT_FLAG }}
|
2020-04-04 16:24:08 -04:00
|
|
|
--target ${{ matrix.config.target }}
|
2020-03-16 15:42:51 -04:00
|
|
|
|
2020-04-04 16:24:08 -04:00
|
|
|
- name: Clippy
|
2020-08-27 00:07:49 -04:00
|
|
|
run:
|
2024-04-22 17:16:26 -04:00
|
|
|
${{ matrix.config.cargo }} clippy --all-targets --locked ${{ env.CARGO_VARIANT_FLAG }}
|
2020-04-04 16:24:08 -04:00
|
|
|
--target ${{ matrix.config.target }} -- -D clippy::all
|
2019-11-01 00:54:54 -04:00
|
|
|
|
2024-02-29 06:15:19 -05:00
|
|
|
- name: Build Musl
|
|
|
|
if: matrix.config.target == 'x86_64-unknown-linux-gnu'
|
|
|
|
run: |
|
|
|
|
docker run -v "$PWD":/usr/src/rusty_v8 -w /usr/src/rusty_v8 rust:alpine3.16 ./musl-build.sh
|
|
|
|
cp target/${{ matrix.config.variant }}/gn_out/obj/librusty_v8.a target/librusty_v8_${{ matrix.config.variant }}_x86_64-unknown-linux-musl.a
|
|
|
|
|
|
|
|
- name: Rustfmt
|
|
|
|
run: cargo fmt -- --check
|
|
|
|
|
2020-04-04 16:24:08 -04:00
|
|
|
- name: Prepare binary publish
|
2024-04-12 17:26:06 -04:00
|
|
|
if: matrix.config.variant == 'debug' || matrix.config.variant == 'release'
|
2024-06-26 22:49:06 -04:00
|
|
|
run: |
|
|
|
|
gzip -9c target/${{ matrix.config.target }}/${{ matrix.config.variant }}/gn_out/obj/${{ env.LIB_NAME }}.${{ env.LIB_EXT }} > target/${{ env.LIB_NAME }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.${{ env.LIB_EXT }}.gz
|
2024-03-15 19:30:37 -04:00
|
|
|
ls -l target/${{ env.LIB_NAME }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.${{ env.LIB_EXT }}.gz
|
2020-03-16 15:42:51 -04:00
|
|
|
|
2024-06-26 22:49:06 -04:00
|
|
|
cp target/${{ matrix.config.target }}/${{ matrix.config.variant}}/gn_out/src_binding.rs target/src_binding_${{ matrix.config.variant }}_${{ matrix.config.target }}.rs
|
|
|
|
ls -l target/src_binding_${{ matrix.config.variant }}_${{ matrix.config.target }}.rs
|
|
|
|
|
2020-04-04 16:24:08 -04:00
|
|
|
- name: Binary publish
|
2022-12-12 20:07:14 -05:00
|
|
|
uses: softprops/action-gh-release@v0.1.15
|
2020-08-27 00:07:49 -04:00
|
|
|
if: >-
|
|
|
|
github.repository == 'denoland/rusty_v8' &&
|
2024-04-12 17:26:06 -04:00
|
|
|
startsWith(github.ref, 'refs/tags/') &&
|
|
|
|
(matrix.config.variant == 'debug' || matrix.config.variant == 'release')
|
2020-03-16 15:42:51 -04:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
2024-08-21 11:26:21 -04:00
|
|
|
files: |
|
|
|
|
target/${{ env.LIB_NAME }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.${{ env.LIB_EXT }}.gz
|
|
|
|
target/src_binding_${{ matrix.config.variant }}_${{ matrix.config.target }}.rs
|
2020-03-16 15:42:51 -04:00
|
|
|
|
2024-06-26 22:49:06 -04:00
|
|
|
- name: Upload CI artifacts
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: src_binding_${{ matrix.config.variant }}_${{ matrix.config.target }}.rs
|
|
|
|
path: target/src_binding_${{ matrix.config.variant }}_${{ matrix.config.target }}.rs
|
2020-01-06 18:07:46 -05:00
|
|
|
|
2024-06-26 22:49:06 -04:00
|
|
|
publish:
|
|
|
|
needs: build
|
2024-10-18 18:08:58 -04:00
|
|
|
runs-on: ${{ github.repository == 'denoland/rusty_v8' && 'ubuntu-24.04-xl' || 'ubuntu-24.04' }}
|
2024-07-10 17:13:25 -04:00
|
|
|
if: github.repository == 'denoland/rusty_v8' && startsWith(github.ref, 'refs/tags/')
|
2024-06-26 22:49:06 -04:00
|
|
|
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 python
|
|
|
|
uses: actions/setup-python@v4
|
|
|
|
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
|
2020-01-06 18:07:46 -05:00
|
|
|
|
2019-12-04 01:45:50 -05:00
|
|
|
- name: Publish
|
|
|
|
env:
|
|
|
|
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
2024-07-10 17:13:25 -04:00
|
|
|
run: cargo publish -vv --locked --allow-dirty
|