2019-10-31 21:01:29 -04:00
|
|
|
name: ci
|
|
|
|
|
2020-01-06 18:07:46 -05:00
|
|
|
on:
|
|
|
|
- push
|
|
|
|
- pull_request
|
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-01-06 18:07:46 -05:00
|
|
|
if: |
|
|
|
|
github.event_name == 'push' ||
|
|
|
|
!startsWith(github.event.pull_request.head.label, 'denoland:')
|
2020-02-12 21:43:38 -05:00
|
|
|
runs-on: ${{ matrix.config.os }}
|
2020-01-06 18:07:46 -05:00
|
|
|
timeout-minutes: 120
|
2019-10-31 21:01:29 -04:00
|
|
|
strategy:
|
2020-05-11 17:20:48 -04:00
|
|
|
# Always run master branch builds to completion. This allows the cache to
|
|
|
|
# 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:
|
|
|
|
${{ github.event_name == 'pull_request' || (github.ref !=
|
|
|
|
'refs/heads/master' && !startsWith(github.ref, 'refs/tags/')) }}
|
2019-10-31 21:01:29 -04:00
|
|
|
matrix:
|
2020-02-12 21:43:38 -05:00
|
|
|
config:
|
|
|
|
- os: macOS-latest
|
|
|
|
target: x86_64-apple-darwin
|
2020-04-04 22:10:55 -04:00
|
|
|
variant: debug
|
2020-03-16 15:42:51 -04:00
|
|
|
|
|
|
|
- os: macOS-latest
|
|
|
|
target: x86_64-apple-darwin
|
2020-04-04 22:10:55 -04:00
|
|
|
variant: release
|
2020-03-16 15:42:51 -04:00
|
|
|
|
2020-08-27 16:34:46 -04:00
|
|
|
- os: ubuntu-18.04
|
2020-04-04 22:10:55 -04:00
|
|
|
target: x86_64-unknown-linux-gnu
|
|
|
|
variant: debug
|
2020-03-16 15:42:51 -04:00
|
|
|
|
2020-08-27 16:34:46 -04:00
|
|
|
- os: ubuntu-18.04
|
2020-04-04 22:10:55 -04:00
|
|
|
target: x86_64-unknown-linux-gnu
|
|
|
|
variant: release
|
2020-03-16 15:42:51 -04:00
|
|
|
|
2020-02-12 21:43:38 -05:00
|
|
|
- os: windows-2019
|
|
|
|
target: x86_64-pc-windows-msvc
|
2020-04-04 23:12:41 -04:00
|
|
|
variant: release # Note: we do not support windows debug builds.
|
|
|
|
|
2020-08-27 16:34:46 -04:00
|
|
|
- os: ubuntu-18.04
|
2020-04-04 23:12:41 -04:00
|
|
|
target: aarch64-unknown-linux-gnu
|
|
|
|
variant: debug
|
|
|
|
|
2020-08-27 16:34:46 -04:00
|
|
|
- os: ubuntu-18.04
|
2020-04-04 23:12:41 -04:00
|
|
|
target: aarch64-unknown-linux-gnu
|
2020-04-04 22:10:55 -04:00
|
|
|
variant: release
|
2020-01-06 18:07:46 -05:00
|
|
|
|
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' }}
|
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
|
|
|
|
uses: actions/checkout@v1
|
|
|
|
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
|
|
|
|
uses: hecrj/setup-rust-action@v1
|
|
|
|
with:
|
2020-08-05 14:35:53 -04:00
|
|
|
rust-version: 1.45.2
|
2019-10-31 21:01:29 -04:00
|
|
|
|
2020-02-12 21:43:38 -05:00
|
|
|
- name: Install rust tools
|
|
|
|
run: rustup component add clippy rustfmt
|
|
|
|
|
2019-11-29 21:58:29 -05:00
|
|
|
- name: Install python
|
|
|
|
uses: actions/setup-python@v1
|
|
|
|
with:
|
2020-04-04 22:10:55 -04:00
|
|
|
python-version: 2.7.x
|
2019-11-29 21:58:29 -05:00
|
|
|
architecture: x64
|
2019-11-01 17:28:09 -04:00
|
|
|
|
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 \
|
|
|
|
binfmt-support g++-5-aarch64-linux-gnu g++-5-multilib \
|
|
|
|
gcc-5-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 "::set-env name=CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER::/usr/bin/aarch64-linux-gnu-gcc-5"
|
|
|
|
echo "::set-env name=QEMU_LD_PREFIX::/usr/aarch64-linux-gnu"
|
|
|
|
|
2020-04-04 16:24:08 -04:00
|
|
|
- name: Configure cargo data directory
|
|
|
|
# After this point, all cargo registry and crate data is stored in
|
|
|
|
# $GITHUB_WORKSPACE/target/cargo. This allows us to cache only the files
|
|
|
|
# that are needed during the build process. Additionally, this works
|
|
|
|
# around a bug in the 'cache' action that causes directories outside of
|
|
|
|
# the workspace dir to be saved/restored incorrectly.
|
|
|
|
run: echo "::set-env name=CARGO_HOME::$(pwd)/target/cargo"
|
|
|
|
|
|
|
|
- name: Cache
|
2020-06-04 22:21:07 -04:00
|
|
|
uses: actions/cache@v2
|
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/cargo
|
|
|
|
target/sccache
|
|
|
|
target/*/.*
|
|
|
|
target/*/build
|
|
|
|
target/*/deps
|
|
|
|
key: ${{ matrix.config.target }}-${{ matrix.config.variant }}-${{ hashFiles('Cargo.lock') }}
|
2020-04-15 14:37:53 -04:00
|
|
|
restore-keys: ${{ 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: |
|
2020-01-06 18:07:46 -05:00
|
|
|
$version = "0.2.12"
|
|
|
|
$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
|
|
|
|
|
|
|
|
echo "::add-path::$(pwd)/$basename"
|
2019-10-31 21:01:29 -04:00
|
|
|
|
2020-04-04 16:24:08 -04:00
|
|
|
- name: Test
|
2020-08-27 00:07:49 -04:00
|
|
|
run:
|
|
|
|
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:
|
|
|
|
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
|
|
|
|
2019-12-22 10:43:59 -05:00
|
|
|
- name: Rustfmt
|
2020-02-12 21:43:38 -05:00
|
|
|
run: cargo fmt -- --check
|
2019-12-22 10:43:59 -05:00
|
|
|
|
2020-04-04 16:24:08 -04:00
|
|
|
- name: Prepare binary publish
|
|
|
|
run: cp
|
|
|
|
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 }}
|
2020-03-16 15:42:51 -04:00
|
|
|
|
2020-04-04 16:24:08 -04:00
|
|
|
- name: Binary publish
|
2020-03-16 15:42:51 -04:00
|
|
|
uses: softprops/action-gh-release@v1
|
2020-08-27 00:07:49 -04:00
|
|
|
if: >-
|
|
|
|
github.repository == 'denoland/rusty_v8' &&
|
|
|
|
startsWith(github.ref, 'refs/tags/')
|
2020-03-16 15:42:51 -04:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
2020-04-04 16:24:08 -04:00
|
|
|
files: target/${{ env.LIB_NAME }}_${{ matrix.config.variant }}_${{ matrix.config.target }}.${{ env.LIB_EXT }}
|
2020-03-16 15:42:51 -04:00
|
|
|
|
2020-01-06 18:07:46 -05:00
|
|
|
# TODO: add clang-format and maybe cpplint.
|
|
|
|
|
2020-01-15 15:14:39 -05:00
|
|
|
# TODO(ry) It would be ideal to check that "cargo package" also runs and
|
|
|
|
# that the resulting package is less than 10 MB. However it seems to
|
|
|
|
# result in a complete V8 rebuild. For now just be careful not to manually
|
|
|
|
# check that "cargo package" is working when updating the build.
|
|
|
|
# - name: Package
|
|
|
|
# run: cargo package -vv --locked
|
2020-01-06 18:07:46 -05:00
|
|
|
|
2019-12-04 01:45:50 -05:00
|
|
|
- name: Publish
|
2020-02-19 00:45:10 -05:00
|
|
|
# Only publish on x64 linux when there's a git tag:
|
2020-04-04 22:10:55 -04:00
|
|
|
if: >-
|
2020-01-06 18:07:46 -05:00
|
|
|
startsWith(github.ref, 'refs/tags/') &&
|
|
|
|
github.repository == 'denoland/rusty_v8' &&
|
2020-02-19 00:45:10 -05:00
|
|
|
startsWith(matrix.config.target , 'x86_64') &&
|
2020-03-16 15:42:51 -04:00
|
|
|
matrix.config.variant == 'debug' &&
|
2020-01-06 18:07:46 -05:00
|
|
|
runner.os == 'Linux'
|
2019-12-04 01:45:50 -05:00
|
|
|
env:
|
|
|
|
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
|
|
|
run: cargo publish -vv
|
|
|
|
|
2019-11-02 18:57:18 -04:00
|
|
|
- name: Stop sccache
|
2020-01-06 18:07:46 -05:00
|
|
|
if: always()
|
2019-11-02 18:57:18 -04:00
|
|
|
run: sccache --stop-server
|