diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..198ebb78 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,86 @@ +name: ci + +on: [pull_request] # TODO(ry) [push, pull_request] + +jobs: + build: + name: ${{ matrix.kind }} ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 60 + strategy: + matrix: + os: [macOS-10.14, windows-2019, ubuntu-16.04] + steps: + - name: Configure git + run: git config --global core.symlinks true + + - name: Clone repository + uses: actions/checkout@v1 + with: + fetch-depth: 1 + submodules: true + + - name: Install rust + uses: hecrj/setup-rust-action@v1 + with: + rust-version: "1.38.0" + + - name: Install python + uses: actions/setup-python@v1 + with: + python-version: "2.7.16" + + - name: Environment (common) + run: | + echo ::set-env name=GH_ACTIONS::1 + echo ::set-env name=RUSTC_WRAPPER::sccache + echo ::set-env name=DENO_BUILD_MODE::release + + - name: Environment (linux) + if: startsWith(matrix.os, 'ubuntu') + # In order to test the installer scripts in std we need a deno + # executable in the path. See + # https://github.com/denoland/deno/blob/27cd2c97f18c0392bc04c66b786717b2bc677315/std/installer/mod.ts#L185-L193 + # TODO(ry) This path modification should rather be done in "cargo test". + run: | + curl -LO https://github.com/mozilla/sccache/releases/download/0.2.12/sccache-0.2.12-x86_64-unknown-linux-musl.tar.gz + tar -xzvf sccache-0.2.12-x86_64-unknown-linux-musl.tar.gz + echo ::add-path::`pwd`/sccache-0.2.12-x86_64-unknown-linux-musl/ + echo ::add-path::`pwd`/third_party/sscache/linux64 + echo ::add-path::`pwd`/target/release + + - name: Environment (mac) + if: startsWith(matrix.os, 'macOS') + run: | + curl -LO https://github.com/mozilla/sccache/releases/download/0.2.12/sccache-0.2.12-x86_64-apple-darwin.tar.gz + tar -xzvf sccache-0.2.12-x86_64-apple-darwin.tar.gz + echo ::add-path::`pwd`/sccache-0.2.12-x86_64-apple-darwin/ + + - name: Environment (windows) + if: startsWith(matrix.os, 'windows') + run: | + # These appear unnecessary: + #choco install curl + #choco install archive + curl -LO https://github.com/mozilla/sccache/releases/download/0.2.12/sccache-0.2.12-x86_64-pc-windows-msvc.tar.gz + tar -zxvf sccache-0.2.12-x86_64-pc-windows-msvc.tar.gz + echo ::add-path::$(pwd)\sccache-0.2.12-x86_64-pc-windows-msvc\ + echo ::add-path::$(pwd)\target\release + + - name: Start sccache + env: + AWS_ACCESS_KEY_ID: AKIAIVRN52PLDBP55LBQ + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + SCCACHE_BUCKET: deno-sccache + SCCACHE_IDLE_TIMEOUT: 0 + run: sccache --start-server + + - name: Build + run: cargo build -vv --release --locked --all-targets + + - name: Test + if: matrix.kind == 'test' + run: cargo test -vv --release --locked --all-targets + + - name: Clippy + run: cargo clippy --all-targets --release --locked -- -D clippy::all diff --git a/Cargo.lock b/Cargo.lock index 7cc5df7d..48ee55ae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -54,8 +54,8 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "test4" -version = "0.1.0" +name = "rusty_v8" +version = "0.0.1" dependencies = [ "cargo_gn 0.0.13 (registry+https://github.com/rust-lang/crates.io-index)", "which 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 62324b59..164474c0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "test4" -version = "0.1.0" +name = "rusty_v8" +version = "0.0.1" authors = ["Bert Belder "] edition = "2018" diff --git a/build.rs b/build.rs index 541bdfb5..c41d9963 100644 --- a/build.rs +++ b/build.rs @@ -48,22 +48,27 @@ fn git_submodule_update() { Command::new("git") .arg("submodule") .arg("update") + .arg("--init") .status() .expect("git submodule update failed"); } -// ./depot_tools/gclient sync --gclientfile=gclient_config.py fn gclient_sync() { - if !Path::new("third_party/depot_tools/gclient").is_file() { - // Need to run git submodule update. + let gclient = Path::new("third_party/depot_tools/gclient.py"); + + if !gclient.exists() { git_submodule_update(); } + assert!(gclient.exists()); disable_depot_tools_update(); - println!("cargo:warning=Running gcient sync to download V8. This could take a while."); - let mut cmd = Command::new("./depot_tools/gclient"); + println!("cargo:warning=Running gclient sync to download V8. This could take a while."); + let mut cmd = Command::new("python"); + cmd.arg("depot_tools/gclient.py"); cmd.arg("sync"); cmd.arg("--gclientfile=gclient_config.py"); + cmd.arg("--no-history"); + cmd.arg("--shallow"); cmd.current_dir("third_party"); let status = cmd.status().expect("gclient sync failed"); assert!(status.success());