First pass at github actions (#1)

This commit is contained in:
Ry Dahl 2019-10-31 21:01:29 -04:00 committed by GitHub
parent 6bdbe7041a
commit 759b65a13b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 100 additions and 9 deletions

86
.github/workflows/ci.yml vendored Normal file
View File

@ -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

4
Cargo.lock generated
View File

@ -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)",

View File

@ -1,6 +1,6 @@
[package]
name = "test4"
version = "0.1.0"
name = "rusty_v8"
version = "0.0.1"
authors = ["Bert Belder <bertbelder@gmail.com>"]
edition = "2018"

View File

@ -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());